private static boolean addClassesUsages(@NotNull PsiPackage aPackage,
                                          @NotNull JavaPackageFindUsagesOptions options,
                                          @NotNull Processor<? super UsageInfo> processor) {
    ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    if (progress != null){
      progress.pushState();
    }

    try {
      List<PsiClass> classes = new ArrayList<>();
      addClassesInPackage(aPackage, options.isIncludeSubpackages, classes);
      for (PsiClass aClass : classes) {
        if (progress != null) {
          String name = ReadAction.compute(() -> aClass.getName());
          progress.setText(JavaAnalysisBundle.message("find.searching.for.references.to.class.progress", name));
        }
        ProgressManager.checkCanceled();
        boolean success = ReferencesSearch.search(new ReferencesSearch.SearchParameters(aClass, options.searchScope, false, options.fastTrack)).forEach(
          new ReadActionProcessor<>() {
            @Override
            public boolean processInReadAction(PsiReference psiReference) {
              return addResult(psiReference, options, processor);
            }
          });
        if (!success) return false;
      }
    }
    finally {
      if (progress != null){
        progress.popState();
      }
    }

    return true;
  }
private static boolean addClassesUsages(@NotNull PsiPackage aPackage,
                                          @NotNull JavaPackageFindUsagesOptions options,
                                          @NotNull Processor<? super UsageInfo> processor)