@Override
  public boolean canClose(String packageName) {
    if (packageName.isEmpty() || packageName.equals(myInitialText)) {
      return false;
    }

    CommandProcessor.getInstance().executeCommand(myProject, () -> ApplicationManager.getApplication().runWriteAction(() -> {
      String dirPath = myPackageRoot.getVirtualFile().getPresentableUrl();
      String actionName = IdeBundle.message("progress.creating.package", dirPath, packageName);
      LocalHistoryAction action = LocalHistory.getInstance().startAction(actionName);
      try {
        createdElement = DirectoryUtil.createSubdirectories(packageName, myPackageRoot, DELIMITER);
      }
      catch (IncorrectOperationException ex) {
        ApplicationManager.getApplication().invokeLater(
          () -> Messages.showMessageDialog(myProject,
                                           CreateElementActionBase.filterMessage(ex.getMessage()),
                                           CommonBundle.getErrorTitle(),
                                           Messages.getErrorIcon())
        );
      }
      finally {
        action.finish();
      }
    }), IdeBundle.message("command.create.package"), null);

    return createdElement != null;
  }
@Override
  public boolean canClose(String packageName)