@Override
  public void actionPerformed(@NotNull AnActionEvent event) {
    final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
    final Project project = event.getData(CommonDataKeys.PROJECT);
    if (view == null || project == null) return;

    final PsiDirectory directory = DirectoryChooserUtil.getOrChooseDirectory(view);
    if (directory == null) return;

    final CreateGroupHandler validator;
    final String message, title;

    if (isPackage(project, Collections.singletonList(directory))) {
      validator = new CreatePackageHandler(project, directory);
      message = IdeBundle.message("prompt.enter.new.package.name");
      title = IdeBundle.message("title.new.package");
    }
    else {
      validator = new CreateDirectoryHandler(project, directory);
      message = IdeBundle.message("prompt.enter.new.directory.name");
      title = IdeBundle.message("title.new.directory");
    }

    String initialText = validator.getInitialText();
    Consumer<List<PsiElement>> consumer = elements -> {
      // we don't have API for multi-selection in the views,
      // so let's at least make sure the created elements are visible, and the first one is selected
      for (PsiElement element : ContainerUtil.iterateBackward(elements)) {
        view.selectElement(element);
      }
    };

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      @SuppressWarnings("TestOnlyProblems")
      String testDirectoryName = event.getData(TEST_DIRECTORY_NAME_KEY);
      if (testDirectoryName != null && validator.checkInput(testDirectoryName) && validator.canClose(testDirectoryName)) {
        consumer.accept(Collections.singletonList(validator.getCreatedElement()));
        return;
      }
    }

    if (Experiments.getInstance().isFeatureEnabled("show.create.new.element.in.popup")) {
      createLightWeightPopup(project, title, initialText, directory, validator, consumer).showCenteredInCurrentWindow(project);
    }
    else {
      Messages.showInputDialog(project, message, title, null, initialText, validator, TextRange.from(initialText.length(), 0));
      consumer.accept(Collections.singletonList(validator.getCreatedElement()));
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent event)