private static @Nullable Icon calcFileLayerIcon(VirtualFile vFile, Project project) {
    ProjectFileIndex index = ProjectFileIndex.getInstance(project);
    if (vFile != null) {
      VirtualFile parent = vFile.getParent();

      if (index.isExcluded(vFile)) {
        //If the parent directory is also excluded it'll have a special icon (see DirectoryIconProvider), so it makes no sense to add
        // additional marks for all files under it.
        if (parent == null || !index.isExcluded(parent)) {
          return AllIcons.Nodes.ExcludedFromCompile;
        }
      }
      else {
        VirtualFile sourceRoot = index.getSourceRootForFile(vFile);
        if (vFile.equals(sourceRoot)) {
          VirtualFile parentSourceRoot = parent == null ? null : index.getSourceRootForFile(parent);

          // do not mark files under folder of the same root type (e.g. test root file under test root dir)
          // but mark file if they are under different root type (e.g. test root file under source root dir)
          if (parentSourceRoot == null || !sourceRoot.equals(parentSourceRoot)) {
            JpsModuleSourceRootType<?> rootType = index.getContainingSourceRootType(vFile);
            return rootType != null ? SourceRootPresentation.getSourceRootFileLayerIcon(rootType) : null;
          }
        }
      }
    }
    return null;
  }
private static @Nullable Icon calcFileLayerIcon(VirtualFile vFile, Project project)