Search in sources :

Example 21 with ItemPresentation

use of com.intellij.navigation.ItemPresentation in project intellij-plugins by JetBrains.

the class DartStructureViewElement method getPresentableText.

@Nullable
@Override
public String getPresentableText() {
    final NavigatablePsiElement element = getElement();
    final ItemPresentation presentation = element == null ? null : element.getPresentation();
    return presentation == null ? null : presentation.getPresentableText();
}
Also used : ItemPresentation(com.intellij.navigation.ItemPresentation) NavigatablePsiElement(com.intellij.psi.NavigatablePsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with ItemPresentation

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

the class ElixirPsiImplUtil method getPresentation.

@Contract(pure = true)
@Nullable
public static ItemPresentation getPresentation(@NotNull final ElixirIdentifier identifier) {
    Parameter parameter = new Parameter(identifier);
    Parameter parameterizedParameter = Parameter.putParameterized(parameter);
    ItemPresentation itemPresentation = null;
    if ((parameterizedParameter.type == Parameter.Type.FUNCTION_NAME || parameterizedParameter.type == Parameter.Type.MACRO_NAME) && parameterizedParameter.parameterized != null) {
        final NavigatablePsiElement parameterized = parameterizedParameter.parameterized;
        if (parameterized instanceof Call) {
            CallDefinitionClause callDefinitionClause = CallDefinitionClause.fromCall((Call) parameterized);
            if (callDefinitionClause != null) {
                itemPresentation = callDefinitionClause.getPresentation();
            }
        }
    }
    return itemPresentation;
}
Also used : Call(org.elixir_lang.psi.call.Call) CallDefinitionClause.enclosingModularMacroCall(org.elixir_lang.structure_view.element.CallDefinitionClause.enclosingModularMacroCall) ItemPresentation(com.intellij.navigation.ItemPresentation) Parameter(org.elixir_lang.annonator.Parameter) Contract(org.jetbrains.annotations.Contract) Nullable(org.jetbrains.annotations.Nullable)

Example 23 with ItemPresentation

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

the class CallDefinition 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 parentPresentation = (Parent) itemPresentation;
        location = parentPresentation.getLocatedPresentableText();
    }
    // pseudo-named-arguments
    boolean callback = false;
    //noinspection ConstantConditions
    return new NameArity(location, callback, time, visibility(), overridable, override, name, arity);
}
Also used : Parent(org.elixir_lang.navigation.item_presentation.Parent) NameArity(org.elixir_lang.navigation.item_presentation.NameArity) ItemPresentation(com.intellij.navigation.ItemPresentation) NotNull(org.jetbrains.annotations.NotNull)

Example 24 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 25 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 = ElixirPsiImplUtil.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)

Aggregations

ItemPresentation (com.intellij.navigation.ItemPresentation)40 NotNull (org.jetbrains.annotations.NotNull)10 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 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)3 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)3 NavigatablePsiElement (com.intellij.psi.NavigatablePsiElement)3 LayeredIcon (com.intellij.ui.LayeredIcon)3 DartClass (com.jetbrains.lang.dart.psi.DartClass)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 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