void (@NotNull PsiJavaCodeReferenceElement element, @Nullable PsiElement resolved) { PsiElement parent = element.getParent(); TextAttributesScheme colorsScheme = myHolder.getColorsScheme(); if (parent instanceof PsiMethodCallExpression) { PsiMethod method = ((PsiMethodCallExpression)parent).resolveMethod(); PsiElement methodNameElement = element.getReferenceNameElement(); if (method != null && methodNameElement != null&& !(methodNameElement instanceof PsiKeyword)) { myHolder.add(HighlightNamesUtil.highlightMethodName(method, methodNameElement, false, colorsScheme)); } } else if (parent instanceof PsiConstructorCall) { try { PsiMethod method = ((PsiConstructorCall)parent).resolveConstructor(); PsiMember methodOrClass = method != null ? method : resolved instanceof PsiClass ? (PsiClass)resolved : null; if (methodOrClass != null) { PsiElement referenceNameElement = element.getReferenceNameElement(); if(referenceNameElement != null) { // exclude type parameters from the highlighted text range myHolder.add(HighlightNamesUtil.highlightMethodName(methodOrClass, referenceNameElement, false, colorsScheme)); } } } catch (IndexNotReadyException ignored) { } } else if (resolved instanceof PsiPackage) { // highlight package (and following dot) as a class myHolder.add(HighlightNamesUtil.highlightPackage(resolved, element, colorsScheme)); } else if (resolved instanceof PsiClass) { myHolder.add(HighlightNamesUtil.highlightClassName((PsiClass)resolved, element, colorsScheme)); } }