public static boolean isSourceRoot(@NotNull VirtualFile directoryFile, @NotNull Project project) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    return directoryFile.equals(fileIndex.getSourceRootForFile(directoryFile));
  }
public static boolean isSourceRoot(@NotNull VirtualFile directoryFile, @NotNull Project project)