@Nullable
  public static VirtualFile getAnyRoot(@NotNull VirtualFile virtualFile, @NotNull Project project) {
    ProjectFileIndex index = ProjectFileIndex.getInstance(project);
    VirtualFile root = index.getContentRootForFile(virtualFile);
    if (root == null) root = index.getClassRootForFile(virtualFile);
    if (root == null) root = index.getSourceRootForFile(virtualFile);
    if (root == null || !root.isDirectory()) {
      root = BaseProjectDirectories.getInstance(project).getBaseDirectoryFor(virtualFile);
    }

    return root;
  }
@Nullable
  public static VirtualFile getAnyRoot(@NotNull VirtualFile virtualFile, @NotNull Project project)