private static List<FileTargetContextWrapper> findSourceRootTypes(Collection<? extends FileTargetContext> targetContexts) {
    return ContainerUtil.map(targetContexts, c -> {
      Project project = c.getFileSystemItem().getProject();

      VirtualFile file = c.getFileSystemItem().getVirtualFile();
      if (file != null) {
        ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(project);
        return new FileTargetContextWrapper(c, fileIndex.getContainingSourceRootType(file), fileIndex.isInGeneratedSources(file));
      }
      else {
        return new FileTargetContextWrapper(c, null, false);
      }
    });
  }
private static List<FileTargetContextWrapper> findSourceRootTypes(Collection<? extends FileTargetContext> targetContexts)