Search in sources :

Example 41 with ItemPresentation

use of com.intellij.navigation.ItemPresentation in project intellij-elixir by KronicDeth.

the class Quote method getPresentation.

/*
     * Methods
     */
/**
 * Returns the presentation of the tree element.
 *
 * @return the element presentation.
 */
@NotNull
@Override
public ItemPresentation getPresentation() {
    String location = null;
    if (parent != null) {
        ItemPresentation parentItemPresentation = parent.getPresentation();
        if (parentItemPresentation instanceof Parent) {
            Parent parentParentPresentation = (Parent) parentItemPresentation;
            location = parentParentPresentation.getLocatedPresentableText();
        }
    }
    return new org.elixir_lang.navigation.item_presentation.Quote(location, navigationItem);
}
Also used : Parent(org.elixir_lang.navigation.item_presentation.Parent) ItemPresentation(com.intellij.navigation.ItemPresentation) NotNull(org.jetbrains.annotations.NotNull)

Example 42 with ItemPresentation

use of com.intellij.navigation.ItemPresentation in project intellij-elixir by KronicDeth.

the class Use method getPresentation.

/**
 * Returns the presentation of the tree element.
 *
 * @return the element presentation.
 */
@NotNull
@Override
public ItemPresentation getPresentation() {
    ItemPresentation itemPresentation = modular.getPresentation();
    String location = null;
    if (itemPresentation instanceof Parent) {
        Parent parentPresenation = (Parent) itemPresentation;
        location = parentPresenation.getLocatedPresentableText();
    }
    PsiElement[] arguments = finalArguments(navigationItem);
    return new org.elixir_lang.navigation.item_presentation.Use(location, arguments);
}
Also used : Parent(org.elixir_lang.navigation.item_presentation.Parent) ItemPresentation(com.intellij.navigation.ItemPresentation) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Example 43 with ItemPresentation

use of com.intellij.navigation.ItemPresentation in project Perl5-IDEA by Camelcade.

the class PerlStructureViewElement method getPresentation.

@NotNull
@Override
public ItemPresentation getPresentation() {
    ItemPresentation itemPresentation = createPresentation();
    if ((isInherited() || isImported()) && itemPresentation instanceof PerlItemPresentationBase) {
        if (getValue() instanceof PerlDeprecatable && ((PerlDeprecatable) getValue()).isDeprecated()) {
            ((PerlItemPresentationBase) itemPresentation).setAttributesKey(PerlSyntaxHighlighter.UNUSED_DEPRECATED);
        } else {
            ((PerlItemPresentationBase) itemPresentation).setAttributesKey(CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES);
        }
    }
    if (isImported() && itemPresentation instanceof PerlItemPresentationSimple) {
        PerlExportDescriptor exportDescriptor = getExportDescriptor();
        assert exportDescriptor != null;
        ((PerlItemPresentationSimple) itemPresentation).setPresentableText(exportDescriptor.getImportedName());
    }
    return itemPresentation;
}
Also used : PerlItemPresentationSimple(com.perl5.lang.perl.idea.presentations.PerlItemPresentationSimple) PerlExportDescriptor(com.perl5.lang.perl.extensions.packageprocessor.PerlExportDescriptor) ItemPresentation(com.intellij.navigation.ItemPresentation) PerlItemPresentationBase(com.perl5.lang.perl.idea.presentations.PerlItemPresentationBase) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ItemPresentation (com.intellij.navigation.ItemPresentation)43 NotNull (org.jetbrains.annotations.NotNull)11 NavigationItem (com.intellij.navigation.NavigationItem)8 Nullable (org.jetbrains.annotations.Nullable)8 PsiFile (com.intellij.psi.PsiFile)6 Parent (org.elixir_lang.navigation.item_presentation.Parent)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 PsiElement (com.intellij.psi.PsiElement)5 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)4 NavigatablePsiElement (com.intellij.psi.NavigatablePsiElement)4 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)3 LayeredIcon (com.intellij.ui.LayeredIcon)3 DartClass (com.jetbrains.lang.dart.psi.DartClass)3 StructureViewTreeElement (com.intellij.ide.structureView.StructureViewTreeElement)2 ColoredItemPresentation (com.intellij.navigation.ColoredItemPresentation)2 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 JBColor (com.intellij.ui.JBColor)2 RowIcon (com.intellij.ui.RowIcon)2