Collection<String> (Project project, @NotNull VirtualFile currentFile) { Set<String> result = new HashSet<>(); result.add(PluginManagerCore.CORE_PLUGIN_ID); result.addAll(PluginIdDependenciesIndex.getPluginAndDependsIds(project, Collections.singleton(currentFile))); final String pluginId = PluginIdDependenciesIndex.getPluginId(project, currentFile); if (pluginId != null) { result.remove(pluginId); return result; } final VirtualFile[] includingFiles = FileIncludeManager.getManager(project).getIncludingFiles(currentFile, false); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); Set<VirtualFile> includingAndDependsFiles = new HashSet<>(); for (VirtualFile virtualFile : includingFiles) { if (!fileIndex.isUnderSourceRootOfType(virtualFile, JavaModuleSourceRootTypes.PRODUCTION)) { continue; } includingAndDependsFiles.add(virtualFile); } final Collection<VirtualFile> dependsToFiles = PluginIdDependenciesIndex.findDependsTo(project, currentFile); includingAndDependsFiles.addAll(dependsToFiles); if (includingAndDependsFiles.isEmpty()) { return result; } final Set<String> ids = PluginIdDependenciesIndex.getPluginAndDependsIds(project, includingAndDependsFiles); result.addAll(ids); return result; }