void (@NotNull Map<String, Pair<DataNode<ModuleData>, IdeaModule>> moduleMap, @NotNull ProjectResolverContext resolverCtx) { final Map<String, Counter> weightMap = new HashMap<>(); for (final Pair<DataNode<ModuleData>, IdeaModule> pair : moduleMap.values()) { final DataNode<ModuleData> moduleNode = pair.first; for (DataNode<ContentRootData> contentRootNode : findAll(moduleNode, ProjectKeys.CONTENT_ROOT)) { File file = new File(contentRootNode.getData().getRootPath()); while (file != null) { weightMap.computeIfAbsent(file.getPath(), __ -> new Counter()).increment(); file = file.getParentFile(); } } for (DataNode<GradleSourceSetData> sourceSetNode : findAll(moduleNode, GradleSourceSetData.KEY)) { final Set<String> set = new HashSet<>(); for (DataNode<ContentRootData> contentRootNode : findAll(sourceSetNode, ProjectKeys.CONTENT_ROOT)) { File file = new File(contentRootNode.getData().getRootPath()); while (file != null) { set.add(file.getPath()); file = file.getParentFile(); } } for (String path : set) { weightMap.computeIfAbsent(path, __ -> new Counter()).increment(); } } } for (final Pair<DataNode<ModuleData>, IdeaModule> pair : moduleMap.values()) { final DataNode<ModuleData> moduleNode = pair.first; final ExternalProject externalProject = resolverCtx.getExtraProject(pair.second, ExternalProject.class); if (externalProject == null) continue; mergeModuleContentRoots(weightMap, externalProject, moduleNode); for (DataNode<GradleSourceSetData> sourceSetNode : findAll(moduleNode, GradleSourceSetData.KEY)) { mergeModuleContentRoots(weightMap, externalProject, sourceSetNode); } } }