public final boolean update() { boolean changes = super.update(); if (getPsiElement() == null) { final String invalidPrefix = IdeBundle.message("node.hierarchy.invalid"); if (!myHighlightedText.getText().startsWith(invalidPrefix)) { myHighlightedText .getBeginning() .addText(invalidPrefix, HierarchyNodeDescriptor.getInvalidPrefixAttributes()); } return true; } if (changes && myIsBase) { final LayeredIcon icon = new LayeredIcon(2); icon.setIcon(getIcon(), 0); icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0); setIcon(icon); } final PsiElement psiElement = getPsiClass(); final CompositeAppearance oldText = myHighlightedText; myHighlightedText = new CompositeAppearance(); TextAttributes classNameAttributes = null; if (myColor != null) { classNameAttributes = new TextAttributes(myColor, null, null, null, Font.PLAIN); } if (psiElement instanceof PsiClass) { myHighlightedText .getEnding() .addText( ClassPresentationUtil.getNameForClass((PsiClass) psiElement, false), classNameAttributes); myHighlightedText .getEnding() .addText( " (" + JavaHierarchyUtil.getPackageName((PsiClass) psiElement) + ")", HierarchyNodeDescriptor.getPackageNameAttributes()); } else if (psiElement instanceof PsiFunctionalExpression) { myHighlightedText .getEnding() .addText( ClassPresentationUtil.getFunctionalExpressionPresentation( ((PsiFunctionalExpression) psiElement), false)); } myName = myHighlightedText.getText(); if (!Comparing.equal(myHighlightedText, oldText)) { changes = true; } return changes; }
@Override public String getElementLocation(final Object element) { if (element instanceof PsiClass) { return ClassPresentationUtil.getNameForClass((PsiClass) element, true); } return null; }
@Override public String getElementText(KotlinLightClass element) { return ClassPresentationUtil.getNameForClass(element, false); }