Search in sources :

Example 1 with Implementation

use of org.elixir_lang.structure_view.element.modular.Implementation in project intellij-elixir by KronicDeth.

the class File method getChildren.

/*
     * Public Instance Methods
     */
@NotNull
@Override
public TreeElement[] getChildren() {
    Call[] calls = PsiTreeUtil.getChildrenOfType(navigationItem, Call.class);
    TreeElement[] children;
    if (calls != null) {
        List<TreeElement> treeElementList = new ArrayList<TreeElement>(calls.length);
        for (Call call : calls) {
            if (Implementation.is(call)) {
                treeElementList.add(new Implementation(call));
            } else if (Module.is(call)) {
                treeElementList.add(new Module(call));
            } else if (Protocol.is(call)) {
                treeElementList.add(new Protocol(call));
            } else if (Quote.is(call)) {
                treeElementList.add(new Quote(call));
            } else if (Unknown.is(call)) {
                // should always be last because it will match all macro calls
                treeElementList.add(new Unknown(call));
            }
        }
        children = treeElementList.toArray(new TreeElement[treeElementList.size()]);
    } else {
        children = new TreeElement[0];
    }
    return children;
}
Also used : Call(org.elixir_lang.psi.call.Call) Unknown(org.elixir_lang.structure_view.element.modular.Unknown) ArrayList(java.util.ArrayList) Module(org.elixir_lang.structure_view.element.modular.Module) Protocol(org.elixir_lang.structure_view.element.modular.Protocol) Implementation(org.elixir_lang.structure_view.element.modular.Implementation) TreeElement(com.intellij.ide.util.treeView.smartTree.TreeElement) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with Implementation

use of org.elixir_lang.structure_view.element.modular.Implementation in project intellij-elixir by KronicDeth.

the class GotoSymbolContributor method getItemsFromImplementation.

private void getItemsFromImplementation(@NotNull String name, @NotNull List<NavigationItem> items, @NotNull EnclosingModularByCall enclosingModularByCall, @NotNull Call call) {
    Modular modular = enclosingModularByCall.putNew(call);
    Collection<String> forNameCollection = Implementation.forNameCollection(modular, call);
    if (forNameCollection != null) {
        for (String forName : forNameCollection) {
            Implementation forNameOverriddenImplementation = new Implementation(modular, call, forName);
            String implementationName = forNameOverriddenImplementation.getName();
            if (implementationName != null && implementationName.contains(name)) {
                items.add(forNameOverriddenImplementation);
            }
        }
    }
    if (forNameCollection == null || forNameCollection.size() < 2) {
        Implementation implementation = new Implementation(modular, call);
        items.add(implementation);
    }
}
Also used : Modular(org.elixir_lang.structure_view.element.modular.Modular) Implementation(org.elixir_lang.structure_view.element.modular.Implementation)

Aggregations

Implementation (org.elixir_lang.structure_view.element.modular.Implementation)2 TreeElement (com.intellij.ide.util.treeView.smartTree.TreeElement)1 ArrayList (java.util.ArrayList)1 Call (org.elixir_lang.psi.call.Call)1 Modular (org.elixir_lang.structure_view.element.modular.Modular)1 Module (org.elixir_lang.structure_view.element.modular.Module)1 Protocol (org.elixir_lang.structure_view.element.modular.Protocol)1 Unknown (org.elixir_lang.structure_view.element.modular.Unknown)1 NotNull (org.jetbrains.annotations.NotNull)1