HighlightInfo (@NotNull PsiMember methodOrClass, @NotNull PsiElement elementToHighlight, boolean isDeclaration, @NotNull TextAttributesScheme colorsScheme) { boolean isInherited = false; boolean isStaticallyImported = false; if (!isDeclaration) { isStaticallyImported = isStaticallyImported(elementToHighlight); if (isCalledOnThis(elementToHighlight)) { PsiClass containingClass = methodOrClass instanceof PsiMethod ? methodOrClass.getContainingClass() : null; PsiClass enclosingClass = containingClass == null ? null : PsiTreeUtil.getParentOfType(elementToHighlight, PsiClass.class); while (enclosingClass != null) { isInherited = enclosingClass.isInheritor(containingClass, true); if (isInherited) break; enclosingClass = PsiTreeUtil.getParentOfType(enclosingClass, PsiClass.class, true); } } } LOG.assertTrue(methodOrClass instanceof PsiMethod || !isDeclaration); HighlightInfoType type = methodOrClass instanceof PsiMethod ? getMethodNameHighlightType((PsiMethod)methodOrClass, isDeclaration, isInherited, isStaticallyImported) : JavaHighlightInfoTypes.CONSTRUCTOR_CALL; if (type != null) { TextAttributes attributes = mergeWithScopeAttributes(methodOrClass, type, colorsScheme); if (!isDeclaration) { attributes = mergeWithVisibilityAttributes(methodOrClass, attributes, colorsScheme); } HighlightInfo.Builder builder = nameBuilder(type).range(elementToHighlight); if (attributes != null) { builder.textAttributes(attributes); } return builder.createUnconditionally(); } return null; }