Search in sources :

Example 1 with DartMethodDeclaration

use of com.jetbrains.lang.dart.psi.DartMethodDeclaration in project intellij-plugins by JetBrains.

the class DartHierarchyNodeDescriptor method update.

@Override
public boolean update() {
    boolean changes = super.update();
    final CompositeAppearance oldText = myHighlightedText;
    myHighlightedText = new CompositeAppearance();
    NavigatablePsiElement element = (NavigatablePsiElement) getPsiElement();
    if (element == null) {
        return invalidElement();
    }
    final ItemPresentation presentation = element.getPresentation();
    if (presentation != null) {
        if (element instanceof DartMethodDeclaration) {
            if (DartComponentType.typeOf(element) != DartComponentType.CONSTRUCTOR) {
                // Do not print constructors as Class.Class.Class(args) Class
                final DartClass cls = PsiTreeUtil.getParentOfType(element, DartClass.class);
                if (cls != null) {
                    myHighlightedText.getEnding().addText(cls.getName() + ".");
                }
            }
        }
        myHighlightedText.getEnding().addText(presentation.getPresentableText());
        PsiFile file = element.getContainingFile();
        if (file != null) {
            myHighlightedText.getEnding().addText(" (" + file.getName() + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
        }
    }
    myName = myHighlightedText.getText();
    if (!Comparing.equal(myHighlightedText, oldText)) {
        changes = true;
    }
    return changes;
}
Also used : DartClass(com.jetbrains.lang.dart.psi.DartClass) DartMethodDeclaration(com.jetbrains.lang.dart.psi.DartMethodDeclaration) ItemPresentation(com.intellij.navigation.ItemPresentation) CompositeAppearance(com.intellij.openapi.roots.ui.util.CompositeAppearance) PsiFile(com.intellij.psi.PsiFile) NavigatablePsiElement(com.intellij.psi.NavigatablePsiElement)

Aggregations

ItemPresentation (com.intellij.navigation.ItemPresentation)1 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)1 NavigatablePsiElement (com.intellij.psi.NavigatablePsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 DartClass (com.jetbrains.lang.dart.psi.DartClass)1 DartMethodDeclaration (com.jetbrains.lang.dart.psi.DartMethodDeclaration)1