@NotNull
    @Override
    public RenameDialog createRenameDialog(@NotNull Project project,
                                           @NotNull PsiElement element,
                                           PsiElement nameSuggestionContext,
                                           Editor editor) {
      return new RenameWithOptionalReferencesDialog(project, element, nameSuggestionContext, editor) {

        @Override
        protected boolean getSearchForReferences() {
          return RefactoringSettings.getInstance().RENAME_SEARCH_FOR_REFERENCES_FOR_DIRECTORY;
        }

        @Override
        protected void setSearchForReferences(boolean value) {
          RefactoringSettings.getInstance().RENAME_SEARCH_FOR_REFERENCES_FOR_DIRECTORY = value;
        }

        @Override
        protected void canRun() throws ConfigurationException {
          super.canRun();
          checkRenameModule(myModule, getNewName());
        }

        @Override
        protected RenameProcessor createRenameProcessor(@NotNull String newName) {
          return new RenameProcessor(
            getProject(), getPsiElement(), newName, getRefactoringScope(),
            isSearchInComments(), isSearchInNonJavaFiles()
          ) {
            @Override
            public void performRefactoring(UsageInfo @NotNull [] usages) {
              renameModule(myModule, newName);
              super.performRefactoring(usages);
            }

            @NotNull
            @Override
            protected String getCommandName() {
              return JavaRefactoringBundle.message("rename.module.directory.command", newName);
            }
          };
        }
      };
    }
@NotNull
    @Override
    public RenameDialog createRenameDialog(@NotNull Project project,
                                           @NotNull PsiElement element,
                                           PsiElement nameSuggestionContext,
                                           Editor editor)