void registerReference(@NotNull PsiReference ref, @NotNull JavaResolveResult resolveResult) {
      PsiElement refElement = resolveResult.getElement();
      PsiFile psiFile = refElement == null ? null : refElement.getContainingFile();
      if (psiFile != null) psiFile = (PsiFile)psiFile.getNavigationElement(); // look at navigation elements because all references resolve into Cls elements when highlighting library source
      if (refElement != null && psiFile != null && myFile.getViewProvider().equals(psiFile.getViewProvider())) {
        registerLocalRef(ref, refElement.getNavigationElement());
      }

      if (resolveResult.getCurrentFileResolveScope() instanceof PsiImportStatementBase importStatement) {
        registerImportStatement(importStatement);
      }
      else if (refElement == null && ref instanceof PsiJavaReference javaReference) {
        JavaResolveResult[] results = javaReference.multiResolve(true);
        if (results.length > 0) {
          for (JavaResolveResult result : results) {
            if (result.getCurrentFileResolveScope() instanceof PsiImportStatementBase importStatement) {
              registerImportStatement(importStatement);
              break;
            }
          }
        } else if (ref instanceof PsiJavaCodeReferenceElement javaRef) {
          for (PsiImportStatementBase potentialImport : IncompleteModelUtil.getPotentialImports(javaRef)) {
            registerImportStatement(potentialImport);
          }
        }
      }
    }
void registerReference(@NotNull PsiReference ref, @NotNull JavaResolveResult resolveResult)