@NotNull
  protected final PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) {
    log.debug("invokeDialog");
    final MyInputValidator validator = new MyInputValidator(project, directory);
    Messages.showInputDialog(
        project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator);

    final PsiElement[] elements = validator.getCreatedElements();
    log.debug("Result: " + Arrays.toString(elements));
    return elements;
  }
 @Override
 @NotNull
 protected PsiElement[] invokeDialog(final Project project, PsiDirectory directory) {
   MyInputValidator validator = new MyValidator(project, directory);
   if (ApplicationManager.getApplication().isUnitTestMode()) {
     try {
       return validator.create("test");
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
   } else {
     Messages.showInputDialog(
         project,
         IdeBundle.message("prompt.enter.new.file.name"),
         IdeBundle.message("title.new.file"),
         null,
         null,
         validator);
     return validator.getCreatedElements();
   }
 }