@SuppressWarnings("unchecked")
  @Override
  public <T> void importData(@NotNull DataNode<T> node,
                             @NotNull Project project,
                             @NotNull IdeModifiableModelsProvider modelsProvider) {
    if (project.isDisposed()) return;

    MultiMap<Key<?>, DataNode<?>> grouped = ExternalSystemApiUtil.recursiveGroup(Collections.singletonList(node));

    final Collection<DataNode<?>> projects = grouped.get(ProjectKeys.PROJECT);
    // only one project(can be multi-module project) expected for per single import
    assert projects.size() == 1 || projects.isEmpty();

    final DataNode<ProjectData> projectNode = (DataNode<ProjectData>)ContainerUtil.getFirstItem(projects);
    final ProjectData projectData;
    ProjectSystemId projectSystemId;
    if (projectNode != null) {
      projectData = projectNode.getData();
      projectSystemId = projectNode.getData().getOwner();
      ExternalProjectsDataStorage.getInstance(project).saveInclusionSettings(projectNode);
    }
    else {
      projectData = null;
      DataNode<ModuleData> aModuleNode = (DataNode<ModuleData>)ContainerUtil.getFirstItem(grouped.get(ProjectKeys.MODULE));
      projectSystemId = aModuleNode != null ? aModuleNode.getData().getOwner() : null;
    }

    if (projectSystemId != null) {
      ExternalSystemUtil.scheduleExternalViewStructureUpdate(project, projectSystemId);
    }

    List<Runnable> onSuccessImportTasks = new SmartList<>();
    List<Runnable> onFailureImportTasks = new SmartList<>();

    final Collection<DataNode<?>> operationDescriptorNodes =
      grouped.getOrPut(ExternalSystemOperationDescriptor.OPERATION_DESCRIPTOR_KEY, () ->
        new DataNode<>(ExternalSystemOperationDescriptor.OPERATION_DESCRIPTOR_KEY, new ExternalSystemOperationDescriptor(), null)
    );
    final ExternalSystemOperationDescriptor operationDescriptor =
      (ExternalSystemOperationDescriptor)ContainerUtil.getFirstItem(operationDescriptorNodes)
        .getData();

    long allStartTime = System.currentTimeMillis();
    long activityId = operationDescriptor.getActivityId();

    ExternalSystemSyncActionsCollector.logPhaseStarted(project, activityId, Phase.DATA_SERVICES);

    boolean importSucceeded = false;
    int errorsCount = 0;

    String projectPath = ObjectUtils.doIfNotNull(projectData, ProjectData::getLinkedExternalProjectPath);
    var topic = project.getMessageBus()
      .syncPublisher(ProjectDataImportListener.TOPIC);

    topic.onImportStarted(projectPath);
    Span dataServicesSpan = ExternalSystemTelemetryUtil.getTracer(projectSystemId)
      .spanBuilder("ProjectDataServices")
      .startSpan();
    try (Scope ignore = dataServicesSpan.makeCurrent()) {
      // keep order of services execution
      final Set<Key<?>> allKeys = new TreeSet<>(grouped.keySet());
      ProjectDataService.EP_NAME.forEachExtensionSafe(dataService -> allKeys.add(dataService.getTargetDataKey()));
      WorkspaceDataService.EP_NAME.forEachExtensionSafe(dataService -> allKeys.add(dataService.getTargetDataKey()));

      final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
      if (indicator != null) {
        indicator.setIndeterminate(false);
      }
      final int size = allKeys.size();
      int count = 0;
      List<Runnable> postImportTasks = new SmartList<>();
      for (Key<?> key : allKeys) {
        if (indicator != null) {
          String message = ExternalSystemBundle.message(
            "progress.update.text", projectSystemId != null ? projectSystemId.getReadableName() : "",
            ExternalSystemBundle.message("progress.update.refresh", getReadableText(key)));
          indicator.setText(message);
          indicator.setFraction((double)count++ / size);
        }
        doImportData(key, grouped.get(key), projectSystemId, projectData, project, modelsProvider,
                     postImportTasks, onSuccessImportTasks, onFailureImportTasks);
      }

      ExternalSystemTelemetryUtil.runWithSpan(projectSystemId, "postImportTasks", span -> {
        for (Runnable postImportTask : postImportTasks) {
          postImportTask.run();
        }
      });

      commit(modelsProvider, project, true, "Imported data", activityId, projectSystemId);
      if (indicator != null) {
        indicator.setIndeterminate(true);
      }

      topic.onImportFinished(projectPath);
      importSucceeded = true;
    }
    catch (Throwable t) {
      dataServicesSpan.recordException(t);
      dataServicesSpan.setStatus(StatusCode.ERROR);
      errorsCount += 1;
      topic.onImportFailed(projectPath, t);
      ExternalSystemSyncActionsCollector.logError(null, activityId, t);
      LOG.error(t);
      //noinspection ConstantConditions
      ExceptionUtil.rethrowAllAsUnchecked(t);
    }
    finally {
      if (importSucceeded) {
        ExternalSystemTelemetryUtil.runWithSpan(projectSystemId, "runFinalTasks",
                                                __ -> runFinalTasks(project, projectPath, onSuccessImportTasks));
      }
      else {
        ExternalSystemTelemetryUtil.runWithSpan(projectSystemId, "runFinalTasks",
                                                __ -> runFinalTasks(project, projectPath, onFailureImportTasks));
      }
      if (!importSucceeded) {
        dispose(modelsProvider, project, true);
      }

      long timeMs = System.currentTimeMillis() - allStartTime;
      dataServicesSpan.end();
      ExternalSystemSyncActionsCollector.logPhaseFinished(project, activityId, Phase.DATA_SERVICES, timeMs, errorsCount);
      ExternalSystemSyncActionsCollector.logSyncFinished(project, activityId, importSucceeded);

      Application app = ApplicationManager.getApplication();
      if (!app.isUnitTestMode() && !app.isHeadlessEnvironment()) {
        StartUpPerformanceService.Companion.getInstance().reportStatistics(project);
      }
    }
  }
@SuppressWarnings("unchecked")
  @Override
  public <T> void importData(@NotNull DataNode<T> node,
                             @NotNull Project project,
                             @NotNull IdeModifiableModelsProvider modelsProvider)