String (@NotNull String changedFileOrDirPath, @NotNull Project project) { if (!changedFileOrDirPath.endsWith("." + GradleConstants.EXTENSION) && !changedFileOrDirPath.endsWith("." + GradleConstants.KOTLIN_DSL_SCRIPT_EXTENSION)) { return null; } if (isInsideCompileOutput(changedFileOrDirPath, project)) { return null; } File file = new File(changedFileOrDirPath); if (file.isDirectory()) { return null; } ExternalSystemManager<?,?,?,?,?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID); assert manager != null; AbstractExternalSystemSettings<?, ?,?> systemSettings = manager.getSettingsProvider().fun(project); Collection<? extends ExternalProjectSettings> projectsSettings = systemSettings.getLinkedProjectsSettings(); if (projectsSettings.isEmpty()) { return null; } Map<String, String> rootPaths = new HashMap<>(); for (ExternalProjectSettings setting : projectsSettings) { if(setting != null) { for (String path : setting.getModules()) { rootPaths.put(new File(path).getPath(), setting.getExternalProjectPath()); } } } for (File f = file.getParentFile(); f != null; f = f.getParentFile()) { String dirPath = f.getPath(); if (rootPaths.containsKey(dirPath)) { return rootPaths.get(dirPath); } } return null; }