void (final @NotNull Collection<? extends DataNode<CompositeBuildData>> toImport, @Nullable ProjectData projectData, @NotNull final Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { if (toImport.isEmpty()) { if (projectData != null) { GradleProjectSettings projectSettings = GradleSettings.getInstance(project).getLinkedProjectSettings(projectData.getLinkedExternalProjectPath()); if (projectSettings != null && projectSettings.getCompositeBuild() != null && projectSettings.getCompositeBuild().getCompositeDefinitionSource() == CompositeDefinitionSource.SCRIPT) { projectSettings.setCompositeBuild(null); } } return; } if (toImport.size() != 1) { throw new IllegalArgumentException( String.format("Expected to get a single composite data node but got %d: %s", toImport.size(), toImport)); } CompositeBuildData compositeBuildData = toImport.iterator().next().getData(); GradleProjectSettings projectSettings = GradleSettings.getInstance(project).getLinkedProjectSettings(compositeBuildData.getRootProjectPath()); if (projectSettings != null) { GradleProjectSettings.CompositeBuild compositeBuild = new GradleProjectSettings.CompositeBuild(); compositeBuild.setCompositeDefinitionSource(CompositeDefinitionSource.SCRIPT); for (BuildParticipant buildParticipant : compositeBuildData.getCompositeParticipants()) { compositeBuild.getCompositeParticipants().add(buildParticipant.copy()); } projectSettings.setCompositeBuild(compositeBuild); } }