@Override
  protected void doOKAction() {
    final String packageName = getPackageName();

    final Ref<@DialogMessage String> errorStringRef = new Ref<>();
    CommandProcessor.getInstance().executeCommand(myProject, () -> {
      try {
        final PsiDirectory baseDir = myModule == null ? null : PackageUtil.findPossiblePackageDirectoryInModule(myModule, packageName);
        myTargetDirectory = myModule == null ? null
            : PackageUtil.findOrCreateDirectoryForPackage(myModule, packageName, baseDir, true);
        if (myTargetDirectory == null) {
          errorStringRef.set("");
          return;
        }
        errorStringRef.set(RefactoringMessageUtil.checkCanCreateClass(myTargetDirectory, getClassName()));
      }
      catch (IncorrectOperationException e) {
        errorStringRef.set(e.getMessage());
      }
    }, GroovyBundle.message("create.directory.command"), null);

    if (errorStringRef.get() != null) {
      if (!errorStringRef.get().isEmpty()) {
        Messages.showMessageDialog(myProject, errorStringRef.get(), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
      }
      return;
    }
    super.doOKAction();
  }
@Override
  protected void doOKAction()