void findUsages(@NotNull FindUsagesProcessPresentation processPresentation, @NotNull Processor<? super UsageInfo> usageProcessor) {
    if (!EDT.isCurrentThreadEdt()) {
      ApplicationManager.getApplication().assertReadAccessNotAllowed();
    }
    CoreProgressManager.assertUnderProgress(myProgress);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Searching for '" + myFindModel.getStringToFind() + "'");
    }
    mySearchStartedAt = System.nanoTime();
    try {
      Processor<VirtualFile> fileProcessor = wrapUsageProcessor(processPresentation, usageProcessor);

      myProgress.setIndeterminate(true);
      myProgress.setText(FindBundle.message("progress.text.scanning.indexed.files"));
      Set<VirtualFile> filesForFastWordSearch = getFilesForFastWordSearch();

      myProgress.setIndeterminate(false);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Search found " + filesForFastWordSearch.size() + " indexed files");
      }

      ConcurrentLinkedDeque<VirtualFile> deque = new ConcurrentLinkedDeque<>(
        ContainerUtil.sorted(filesForFastWordSearch, SEARCH_RESULT_FILE_COMPARATOR));
      AtomicInteger processedFastFiles = new AtomicInteger();
      FilesScanExecutor.processOnAllThreadsInReadActionWithRetries(deque, o -> {
        boolean result = fileProcessor.process(o);
        if (myProgress.isRunning()) {
          double fraction = (double)processedFastFiles.incrementAndGet() / filesForFastWordSearch.size();
          myProgress.setFraction(fraction);
        }
        return result;
      });

      myProgress.setIndeterminate(true);
      myProgress.setText(FindBundle.message("progress.text.scanning.non.indexed.files"));

      boolean canRelyOnIndices = canRelyOnSearchers();
      AtomicInteger otherFilesCount = new AtomicInteger();
      processFilesInScope(filesForFastWordSearch, canRelyOnIndices, file -> {
        boolean result = fileProcessor.process(file);
        otherFilesCount.incrementAndGet();
        return result;
      });
      if (LOG.isDebugEnabled()) {
        LOG.debug("Search processed " + otherFilesCount.get() + " non-indexed files");
        LOG.debug("Search completed in " + TimeoutUtil.getDurationMillis(mySearchStartedAt) + " ms");
      }
    }
    catch (ProcessCanceledException e) {
      processPresentation.setCanceled(true);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Search canceled after " + TimeoutUtil.getDurationMillis(mySearchStartedAt) + " ms", e);
      }
    }
    catch (Throwable th) {
      LOG.error(th);
    }

    if (!myLargeFiles.isEmpty()) {
      processPresentation.setLargeFilesWereNotScanned(myLargeFiles);
    }

    if (!myProgress.isCanceled()) {
      myProgress.setText(FindBundle.message("find.progress.search.completed"));
    }
  }
void findUsages(@NotNull FindUsagesProcessPresentation processPresentation, @NotNull Processor<? super UsageInfo> usageProcessor)