boolean (@NotNull Project ideProject, @NotNull ProjectData projectData, Module[] modules) { String linkedExternalProjectPath = null; for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemManager.EP_NAME.getIterable()) { ProjectSystemId externalSystemId = manager.getSystemId(); AbstractExternalSystemSettings systemSettings = getSettings(ideProject, externalSystemId); Collection projectsSettings = systemSettings.getLinkedProjectsSettings(); int linkedProjectsNumber = projectsSettings.size(); if (linkedProjectsNumber > 1) { // More than one external project of the same external system type is linked to the given ide project. return false; } else if (linkedProjectsNumber == 1) { if (linkedExternalProjectPath == null) { // More than one external project of different external system types is linked to the current ide project. linkedExternalProjectPath = ((ExternalProjectSettings)projectsSettings.iterator().next()).getExternalProjectPath(); } else { return false; } } } if (linkedExternalProjectPath != null && !linkedExternalProjectPath.equals(projectData.getLinkedExternalProjectPath())) { // New external project is being linked. return false; } for (Module module : modules) { if (!isExternalSystemAwareModule(projectData.getOwner(), module)) { return false; } } return true; }