@Override
  public void importData(final @NotNull Collection<? extends DataNode<BuildScriptClasspathData>> toImport,
                         @Nullable final ProjectData projectData,
                         @NotNull final Project project,
                         @NotNull final IdeModifiableModelsProvider modelsProvider) {
    if (projectData == null || toImport.isEmpty()) {
      return;
    }

    final GradleInstallationManager gradleInstallationManager = GradleInstallationManager.getInstance();

    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
    assert manager != null;
    AbstractExternalSystemLocalSettings<?> localSettings = manager.getLocalSettingsProvider().fun(project);

    final String linkedExternalProjectPath = projectData.getLinkedExternalProjectPath();
    final File gradleHomeDir = toImport.iterator().next().getData().getGradleHomeDir();
    final GradleLocalSettings gradleLocalSettings = GradleLocalSettings.getInstance(project);
    if (gradleHomeDir != null) {
      gradleLocalSettings.setGradleHome(linkedExternalProjectPath, gradleHomeDir.getPath());
    }
    final GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedExternalProjectPath);

    Interner<List<String>> interner = Interner.createInterner();
    final NotNullLazyValue<List<String>> externalProjectGradleSdkLibs = NotNullLazyValue.lazy(() -> {
      final Set<String> gradleSdkLibraries = new LinkedHashSet<>();
      File gradleHome = gradleInstallationManager.getGradleHome(project, linkedExternalProjectPath);
      if (gradleHome != null && gradleHome.isDirectory()) {
        final Collection<File> libraries = gradleInstallationManager.getClassRoots(project, linkedExternalProjectPath);
        if (libraries != null) {
          for (File library : libraries) {
            gradleSdkLibraries.add(FileUtil.toCanonicalPath(library.getPath()));
          }
        }
      }
      return interner.intern(new ArrayList<>(gradleSdkLibraries));
    });

    final Map<String, ExternalProjectBuildClasspathPojo> localProjectBuildClasspath =
      new HashMap<>(localSettings.getProjectBuildClasspath());

    for (final DataNode<BuildScriptClasspathData> node : toImport) {
      if (GradleConstants.SYSTEM_ID.equals(node.getData().getOwner())) {
        DataNode<ModuleData> moduleDataNode = ExternalSystemApiUtil.findParent(node, ProjectKeys.MODULE);
        if (moduleDataNode == null) continue;

        String externalModulePath = moduleDataNode.getData().getLinkedExternalProjectPath();
        if (settings == null || settings.getDistributionType() == null) {
          LOG.warn("Gradle SDK distribution type was not configured for the project at " + linkedExternalProjectPath);
        }

        final Set<String> buildClasspathSources = new LinkedHashSet<>();
        final Set<String> buildClasspathClasses = new LinkedHashSet<>();
        BuildScriptClasspathData buildScriptClasspathData = node.getData();
        for (BuildScriptClasspathData.ClasspathEntry classpathEntry : buildScriptClasspathData.getClasspathEntries()) {
          for (String path : classpathEntry.getSourcesFile()) {
            buildClasspathSources.add(FileUtil.toCanonicalPath(path));
          }

          for (String path : classpathEntry.getClassesFile()) {
            buildClasspathClasses.add(FileUtil.toCanonicalPath(path));
          }
        }

        ExternalProjectBuildClasspathPojo projectBuildClasspathPojo = localProjectBuildClasspath.get(linkedExternalProjectPath);
        if (projectBuildClasspathPojo == null) {
          projectBuildClasspathPojo = new ExternalProjectBuildClasspathPojo(
            moduleDataNode.getData().getExternalName(), new ArrayList<>(), new HashMap<>());
          localProjectBuildClasspath.put(linkedExternalProjectPath, projectBuildClasspathPojo);
        }

        projectBuildClasspathPojo.setProjectBuildClasspath(externalProjectGradleSdkLibs.getValue());

        List<String> buildClasspath = new ArrayList<>(buildClasspathSources.size() + buildClasspathClasses.size());
        buildClasspath.addAll(buildClasspathSources);
        buildClasspath.addAll(buildClasspathClasses);
        buildClasspath = interner.intern(buildClasspath);

        projectBuildClasspathPojo.getModulesBuildClasspath().put(externalModulePath,
                                                                 new ExternalModuleBuildClasspathPojo(externalModulePath, buildClasspath));

        DataNode<ProjectData> projectDataNode = ExternalSystemApiUtil.findParent(moduleDataNode, ProjectKeys.PROJECT);
        if (projectDataNode != null) {
          DataNode<DependencyAccessorsModel> dependenciesAccessorsModelNode =
            ExternalSystemApiUtil.find(projectDataNode, BuildScriptClasspathData.ACCESSORS);
          if (dependenciesAccessorsModelNode != null) {
            DependencyAccessorsModel accessorsModel = dependenciesAccessorsModelNode.getData();
            buildClasspath.addAll(accessorsModel.getSources());
            buildClasspath.addAll(accessorsModel.getClasses());
          }
        }
      }
    }
    localSettings.setProjectBuildClasspath(localProjectBuildClasspath);

    if (!project.isDisposed()) {
      GradleBuildClasspathManager.getInstance(project).reload();
    }
  }
@Override
  public void importData(final @NotNull Collection<? extends DataNode<BuildScriptClasspathData>> toImport,
                         @Nullable final ProjectData projectData,
                         @NotNull final Project project,
                         @NotNull final IdeModifiableModelsProvider modelsProvider)