@Override
  protected @Nullable PsiDirectory getTargetDirectory(DataContext dataContext, IdeView view) {
    final PsiDirectory[] directories = view.getDirectories();
    for (PsiDirectory directory : directories) {
      final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
      if (aPackage == null) {
        continue;
      }
      if (directory.findFile(PsiPackage.PACKAGE_INFO_FILE) != null) {
        Messages.showErrorDialog(CommonDataKeys.PROJECT.getData(dataContext),
                                 JavaBundle.message("error.package.already.contains.package-info", aPackage.getQualifiedName()),
                                 IdeBundle.message("title.cannot.create.file"));
        return null;
      }
      else if (directory.findFile("package.html") != null) {
        if (Messages.showOkCancelDialog(CommonDataKeys.PROJECT.getData(dataContext),
                                        JavaBundle.message("error.package.already.contains.package.html", aPackage.getQualifiedName()),
                                        JavaBundle.message("error.package.html.found.title"),
                                        IdeBundle.message("button.create"), CommonBundle.getCancelButtonText(),
                                        Messages.getQuestionIcon()) != Messages.OK) {
          return null;
        }
      }

    }
    return super.getTargetDirectory(dataContext, view);
  }
@Override
  protected @Nullable PsiDirectory getTargetDirectory(DataContext dataContext, IdeView view)