@Override
      public void run(@NotNull ProgressIndicator indicator) {
        GlobalSearchScope scope = ReadAction.nonBlocking(
          () -> GlobalSearchScopeUtil.toGlobalSearchScope(FindInProjectUtil.getScopeFromModel(project, myHelper.myPreviousModel), project)
        ).wrapProgress(indicator).executeSynchronously();

        FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myUsageViewPresentation);
        ThreadLocal<String> lastUsageFileRef = new ThreadLocal<>();
        ThreadLocal<Reference<FindPopupItem>> recentItemRef = new ThreadLocal<>();

        projectExecutor.findUsages(project, myResultsPreviewSearchProgress, processPresentation, findModel, filesToScanInitially, usage -> {
          if (isCancelled()) {
            onStop(hash);
            return false;
          }

          if (resultsCount.getAndIncrement() >= ShowUsagesAction.getUsagesPageSize()) {
            onStop(hash);
            return false;
          }

          String file = lastUsageFileRef.get();
          String usageFile = PathUtil.toSystemIndependentName(usage.getPath());
          if (!usageFile.equals(file)) {
            resultsFilesCount.incrementAndGet();
            lastUsageFileRef.set(usageFile);
          }

          FindPopupItem recentItem = SoftReference.dereference(recentItemRef.get());
          FindPopupItem newItem;
          boolean merged = !myHelper.isReplaceState() && recentItem != null && recentItem.getUsage().merge(usage);
          if (!merged) {
            if (usage instanceof UsageInfo2UsageAdapter) {
              ((UsageInfo2UsageAdapter)usage).updateCachedPresentation();
            }

            newItem = new FindPopupItem(usage, usagePresentation(project, scope, usage));
          }
          else {
            // recompute presentation of a merged instance
            UsageInfoAdapter recentItemUsage = recentItem.getUsage();
            if (recentItemUsage instanceof UsageInfo2UsageAdapter) {
              ((UsageInfo2UsageAdapter)recentItemUsage).updateCachedPresentation();
            }

            newItem = recentItem.withPresentation(usagePresentation(project, scope, recentItemUsage));
          }
          recentItemRef.set(new WeakReference<>(newItem));

          ApplicationManager.getApplication().invokeLater(() -> {
            if (isCancelled()) {
              onStop(hash);
              return;
            }
            myPreviewSplitter.getSecondComponent().setVisible(true);
            DefaultTableModel model = (DefaultTableModel)myResultsPreviewTable.getModel();
            if (!merged) {
              model.addRow(new Object[]{newItem});
            }
            else {
              model.fireTableRowsUpdated(model.getRowCount() - 1, model.getRowCount() - 1);
            }
            myCodePreviewComponent.setVisible(true);
            if (model.getRowCount() == 1) {
              myResultsPreviewTable.setRowSelectionInterval(0, 0);
            }
            int occurrences = resultsCount.get();
            int filesWithOccurrences = resultsFilesCount.get();
            myCodePreviewComponent.setVisible(occurrences > 0);
            myReplaceAllButton.setEnabled(occurrences > 0);
            myReplaceSelectedButton.setEnabled(occurrences > 0);

            if (occurrences > 0) {
              if (occurrences < ShowUsagesAction.getUsagesPageSize()) {
                myUsagesCount = String.valueOf(occurrences);
                myFilesCount = String.valueOf(filesWithOccurrences);
                header.infoLabel.setText(FindBundle.message("message.matches.in.files", occurrences, filesWithOccurrences));
              }
              else {
                myUsagesCount = occurrences + "+";
                myFilesCount = filesWithOccurrences + "+";
                header.infoLabel.setText(FindBundle.message("message.matches.in.files.incomplete", occurrences, filesWithOccurrences));
              }
            }
            else {
              header.infoLabel.setText("");
            }
          }, state);

          return true;
        });
      }
@Override
      public void run(@NotNull ProgressIndicator indicator)