protected UsageInfo @Nullable [] findUsages(final @NotNull Project project,
                                              final @NotNull AnalysisScope scope,
                                              final int fileCount) {
    final NullityInferrer inferrer = new NullityInferrer(isAnnotateLocalVariables(), project);
    final PsiManager psiManager = PsiManager.getInstance(project);
    final List<UsageInfo> usages = new ArrayList<>();
    final Runnable searchForUsages = () -> {
      scope.accept(new PsiElementVisitor() {
        int myFileCount;

        @Override
        public void visitFile(final @NotNull PsiFile file) {
          myFileCount++;
          final VirtualFile virtualFile = file.getVirtualFile();
          final FileViewProvider viewProvider = psiManager.findViewProvider(virtualFile);
          final Document document = viewProvider == null ? null : viewProvider.getDocument();
          if (document == null || virtualFile.getFileType().isBinary()) return; //do not inspect binary files
          final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
          if (progressIndicator != null) {
            progressIndicator.setText2(ProjectUtil.calcRelativeToProjectPath(virtualFile, project));
            progressIndicator.setFraction(((double)myFileCount) / fileCount);
          }
          if (file instanceof PsiJavaFile) {
            inferrer.collect(file);
          }
        }
      });

      ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
      if (indicator != null) {
        indicator.setIndeterminate(true);
        indicator.setText(JavaBundle.message("infer.nullity.progress"));
      }

      inferrer.collect(usages);
    };
    if (ApplicationManager.getApplication().isDispatchThread()) {
      if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(searchForUsages, JavaBundle
        .message("action.description.infer.nullity.annotations"), true, project)) {
        return null;
      }
    }
    else {
      searchForUsages.run();
    }

    return usages.toArray(UsageInfo.EMPTY_ARRAY);
  }
protected UsageInfo @Nullable [] findUsages(final @NotNull Project project,
                                              final @NotNull AnalysisScope scope,
                                              final int fileCount)