public static boolean processUsages(@NotNull Project project,
                                      @NotNull PsiFile containingFile,
                                      @NotNull final SearchScope useScope,
                                      @NotNull PsiMember member,
                                      @Nullable PsiFile ignoreFile,
                                      @NotNull Processor<? super UsageInfo> usageInfoProcessor) {
    String name = member.getName();
    if (name == null) {
      log("* "+member.getName()+" no name; false");
      return false;
    }
    PsiSearchHelper searchHelper = PsiSearchHelper.getInstance(project);
    if (useScope instanceof GlobalSearchScope) {

      PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(name, (GlobalSearchScope)useScope, ignoreFile);
      if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES
          // try to search for private and package-private members unconditionally - they are unlikely to have millions of usages
          && (member.hasModifierProperty(PsiModifier.PUBLIC) || member.hasModifierProperty(PsiModifier.PROTECTED))) {
        log("* "+member.getName()+" too many usages; false");
        return false;
      }

      //search usages if it cheap
      //if count is 0 there is no usages since we've called myRefCountHolder.isReferenced() before
      if (cheapEnough == PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES && !canBeReferencedViaWeirdNames(member, containingFile)) {
        log("* "+member.getName()+" 0 usages; true");
        return true;
      }

      if (member instanceof PsiMethod && member.hasModifierProperty(PsiModifier.PUBLIC)) {
        String propertyName = PropertyUtilBase.getPropertyName(member);
        if (propertyName != null) {
          SearchScope fileScope = containingFile.getUseScope();
          if (fileScope instanceof GlobalSearchScope &&
              searchHelper.isCheapEnoughToSearch(propertyName, (GlobalSearchScope)fileScope, ignoreFile) ==
              PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) {
            log("* "+member.getName()+" too many prop usages; false");
            return false;
          }
        }
      }
    }
    FindUsagesOptions options;
    Collection<PsiMember> toSearch = new SmartList<>(member);
    if (member instanceof PsiPackage) {
      options = new JavaPackageFindUsagesOptions(useScope);
      options.isSearchForTextOccurrences = true;
    }
    else if (member instanceof PsiClass) {
      options = new JavaClassFindUsagesOptions(useScope);
      options.isSearchForTextOccurrences = true;
    }
    else if (member instanceof PsiMethod method) {
      options = new JavaMethodFindUsagesOptions(useScope);
      options.isSearchForTextOccurrences = method.isConstructor();
      toSearch.addAll(DeepestSuperMethodsSearch.search(method).findAll());
    }
    else if (member instanceof PsiVariable) {
      options = new JavaVariableFindUsagesOptions(useScope);
      options.isSearchForTextOccurrences = false;
    }
    else {
      options = new FindUsagesOptions(useScope);
      options.isSearchForTextOccurrences = true;
    }
    options.isUsages = true;
    return ContainerUtil.process(toSearch, m -> JavaFindUsagesHelper.processElementUsages(m, options, usageInfoProcessor));
  }
public static boolean processUsages(@NotNull Project project,
                                      @NotNull PsiFile containingFile,
                                      @NotNull final SearchScope useScope,
                                      @NotNull PsiMember member,
                                      @Nullable PsiFile ignoreFile,
                                      @NotNull Processor<? super UsageInfo> usageInfoProcessor)