ProjectData (@Nullable Project project) { if (project == null) return null; String contextProjectFileDirectory = myContext.getProjectFileDirectory(); ExternalProjectSettings linkedProjectSettings = null; for (Object settings : ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID).getLinkedProjectsSettings()) { if (settings instanceof ExternalProjectSettings) { String projectPath = ((ExternalProjectSettings)settings).getExternalProjectPath(); if (FileUtil.isAncestor(projectPath, contextProjectFileDirectory, false)) { linkedProjectSettings = (ExternalProjectSettings)settings; break; } } } if(linkedProjectSettings == null) return null; final ExternalProjectInfo projectInfo = ProjectDataManager.getInstance().getExternalProjectData(project, GradleConstants.SYSTEM_ID, linkedProjectSettings.getExternalProjectPath()); return projectInfo != null && projectInfo.getExternalProjectStructure() != null ? projectInfo.getExternalProjectStructure().getData() : null; }