@Nullable
  public static PsiDirectory resolveToDirectory(final Project project, final PsiElement element) {
    if (!(element instanceof PsiDirectoryContainer)) {
      return (PsiDirectory)element;
    }

    PsiDirectory[] directories = ((PsiDirectoryContainer)element).getDirectories();
    return switch (directories.length) {
      case 0 -> null;
      case 1 -> directories[0];
      default -> DirectoryChooserUtil.chooseDirectory(directories, directories[0], project, new HashMap<>());
    };
  }
@Nullable
  public static PsiDirectory resolveToDirectory(final Project project, final PsiElement element)