private PsiElement[] doInvokeDialog(Project project, @NotNull PsiDirectory directory) {
    myDialog = new NewActionDialog(project, directory);
    try {
      myDialog.show();
      if (myDialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
        pluginDescriptorToPatch = DevkitActionsUtil.choosePluginModuleDescriptor(directory);
        if (pluginDescriptorToPatch != null) {
          MyInputValidator validator = new MyInputValidator(project, directory);
          // this actually runs the action to create the class from template
          validator.canClose(myDialog.getActionName());
          return validator.getCreatedElements();
        }
      }
      return PsiElement.EMPTY_ARRAY;
    }
    finally {
      myDialog = null;
      pluginDescriptorToPatch = null;
    }
  }
private PsiElement[] doInvokeDialog(Project project, @NotNull PsiDirectory directory)