private void doIndexFiles(@NotNull ProjectDumbIndexingHistoryImpl projectDumbIndexingHistory) {
    IndexingRequestToken indexingRequest = myProject.getService(ProjectIndexingDependenciesService.class).getLatestIndexingRequestToken();
    IndexUpdateRunner indexUpdateRunner = new IndexUpdateRunner(myIndex, indexingRequest);

    ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
    indicator.setIndeterminate(false);
    var originalSuspender = ProgressSuspender.getSuspender(unwrapAll(indicator));
    Function0<Boolean> pauseCondition = originalSuspender == null ? () -> false : originalSuspender::isSuspended;

    IndexUpdateRunner.FileSet fileSets = getExplicitlyRequestedFilesSets(pauseCondition);
    if (!fileSets.isEmpty()) {
      var reporter = IndexingProgressReporter2.Companion.createInstance(indicator, fileSets.size());
      doIndexFiles(projectDumbIndexingHistory, indexUpdateRunner, fileSets, reporter);
    }

    // Order is important: getRefreshedFiles may return some subset of getExplicitlyRequestedFilesSets files (e.g., new files)
    // We first index explicitly requested files, this will also mark indexed files as "up-to-date", then we index remaining dirty files
    fileSets = getRefreshedFiles(projectDumbIndexingHistory, pauseCondition);
    if (!fileSets.isEmpty()) {
      var reporter = IndexingProgressReporter2.Companion.createInstance(indicator, fileSets.size());
      doIndexFiles(projectDumbIndexingHistory, indexUpdateRunner, fileSets, reporter);
    }
  }
private void doIndexFiles(@NotNull ProjectDumbIndexingHistoryImpl projectDumbIndexingHistory)