private static boolean acceptUsage(@NotNull PsiElement usage, @NotNull FindUsagesOptions options) {
    if (!(usage instanceof PsiJavaCodeReferenceElement referenceElement)) {
      return true;
    }
    if (options instanceof JavaPackageFindUsagesOptions javaOptions && !javaOptions.isIncludeSubpackages &&
        referenceElement.resolve() instanceof PsiPackage) {
      PsiElement parent = usage.getParent();
      if (parent instanceof PsiJavaCodeReferenceElement parentReference && parentReference.resolve() instanceof PsiPackage) {
        return false;
      }
    }

    if (!(usage instanceof PsiReferenceExpression)){
      if (options instanceof JavaFindUsagesOptions javaOptions && javaOptions.isSkipImportStatements){
        PsiElement parent = usage.getParent();
        while(parent instanceof PsiJavaCodeReferenceElement){
          parent = parent.getParent();
        }
        if (parent instanceof PsiImportStatement){
          return false;
        }
      }

      if (options instanceof JavaPackageFindUsagesOptions packageOptions && packageOptions.isSkipPackageStatements){
        PsiElement parent = usage.getParent();
        while(parent instanceof PsiJavaCodeReferenceElement){
          parent = parent.getParent();
        }
        return !(parent instanceof PsiPackageStatement);
      }
    }
    return true;
  }
private static boolean acceptUsage(@NotNull PsiElement usage, @NotNull FindUsagesOptions options)