protected PsiDirectory adjustForRename(DataContext dataContext, PsiElement element) {
    if (element instanceof PsiDirectoryContainer) {
      final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext);
      if (module != null) {
        PsiDirectory[] directories = ((PsiDirectoryContainer)element).getDirectories(GlobalSearchScope.moduleScope(module));
        Optional<PsiDirectory> directoryWithPackage = Arrays.stream(directories).filter(this::isSuitableDirectory).findFirst();
        return directoryWithPackage.orElse(null);
      }
    }
    return element instanceof PsiDirectory && isSuitableDirectory((PsiDirectory)element) ? (PsiDirectory)element : null;
  }
protected PsiDirectory adjustForRename(DataContext dataContext, PsiElement element)