@Override
  public boolean isAvailableOnDataContext(@NotNull DataContext dataContext) {
    Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
    if (module == null) {
      return false;
    }
    PsiElement element = PsiElementRenameHandler.getElement(dataContext);
    if (!(element instanceof PsiDirectory directory)) {
      return false;
    }
    //noinspection deprecation
    if (directory.getVirtualFile().equals(directory.getProject().getBaseDir())) {
      // this is project root, we can't rename project root yet
      return false;
    }
    if (!PlainDirectoryRenameHandler.isPlainDirectory(directory)) {
      // this is a package
      return false;
    }
    if (RenamePsiElementProcessor.forElement(directory).getClass() != RenamePsiDirectoryProcessor.class) {
      // another plugin overrides our processor
      // we cannot deal with it properly
      return false;
    }
    return module.getName().equals(directory.getName());
  }
@Override
  public boolean isAvailableOnDataContext(@NotNull DataContext dataContext)