public static boolean isSourceRoot(@NotNull PsiDirectory psiDirectory) {
    return isSourceRoot(psiDirectory.getVirtualFile(), psiDirectory.getProject());
  }
public static boolean isSourceRoot(@NotNull PsiDirectory psiDirectory)