Search in sources :

Example 6 with SimpleNode

use of com.intellij.ui.treeStructure.SimpleNode in project intellij-community by JetBrains.

the class SelectExternalTaskDialog method doOKAction.

@Override
protected void doOKAction() {
    SimpleNode node = getSelectedNode();
    if (node instanceof NullNode)
        node = null;
    myResult = node instanceof TaskNode ? Pair.create(((TaskNode) node).getModuleOwnerName(), ((TaskNode) node).getData()) : null;
    super.doOKAction();
}
Also used : TaskNode(com.intellij.openapi.externalSystem.view.TaskNode) NullNode(com.intellij.ui.treeStructure.NullNode) SimpleNode(com.intellij.ui.treeStructure.SimpleNode)

Example 7 with SimpleNode

use of com.intellij.ui.treeStructure.SimpleNode in project android by JetBrains.

the class DependencyGraphPanel method findTopDependencyNode.

@NotNull
static AbstractDependencyNode<? extends PsAndroidDependency> findTopDependencyNode(@NotNull AbstractDependencyNode<?> node) {
    AbstractDependencyNode<?> current = node;
    while (true) {
        SimpleNode parent = current.getParent();
        if (!(parent instanceof AbstractDependencyNode)) {
            return current;
        }
        current = (AbstractDependencyNode<?>) parent;
    }
}
Also used : SimpleNode(com.intellij.ui.treeStructure.SimpleNode) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with SimpleNode

use of com.intellij.ui.treeStructure.SimpleNode in project android by JetBrains.

the class TargetModulesTreeStructure method getDeclaredDependencyNodeHierarchy.

@NotNull
private static List<AbstractDependencyNode<? extends PsAndroidDependency>> getDeclaredDependencyNodeHierarchy(AbstractDependencyNode<?> node) {
    List<AbstractDependencyNode<? extends PsAndroidDependency>> nodes = Lists.newArrayList();
    if (node.isDeclared()) {
        nodes.add(node);
    }
    SimpleNode current = node;
    while (true) {
        SimpleNode parent = current.getParent();
        if (parent instanceof AbstractDependencyNode && ((AbstractDependencyNode) parent).isDeclared()) {
            nodes.add((AbstractDependencyNode<? extends PsAndroidDependency>) parent);
        } else if (parent == null) {
            break;
        }
        current = parent;
    }
    return nodes;
}
Also used : AbstractDependencyNode(com.android.tools.idea.gradle.structure.configurables.android.dependencies.treeview.AbstractDependencyNode) SimpleNode(com.intellij.ui.treeStructure.SimpleNode) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with SimpleNode

use of com.intellij.ui.treeStructure.SimpleNode in project android by JetBrains.

the class AbstractBaseTreeBuilder method expandParents.

public void expandParents(@NotNull List<? extends SimpleNode> nodes) {
    List<SimpleNode> toExpand = Lists.newArrayList();
    for (SimpleNode node : nodes) {
        SimpleNode parent = node.getParent();
        if (parent != null) {
            toExpand.add(parent);
        }
    }
    expand(toExpand.toArray(), null);
}
Also used : SimpleNode(com.intellij.ui.treeStructure.SimpleNode)

Example 10 with SimpleNode

use of com.intellij.ui.treeStructure.SimpleNode in project intellij-community by JetBrains.

the class SettingsFilter method update.

private ActionCallback update(@NotNull DocumentEvent.EventType type, boolean adjustSelection, boolean now) {
    if (myUpdateRejected) {
        return ActionCallback.REJECTED;
    }
    String text = getFilterText();
    if (text.isEmpty()) {
        myContext.setHoldingFilter(false);
        myFiltered = null;
    } else {
        myContext.setHoldingFilter(true);
        myHits = myRegistrar.getConfigurables(myGroups, type, myFiltered, text, myProject);
        myFiltered = myHits.getAll();
    }
    mySearch.getTextEditor().setBackground(myFiltered != null && myFiltered.isEmpty() ? LightColors.RED : UIUtil.getTextFieldBackground());
    Configurable current = myContext.getCurrentConfigurable();
    boolean shouldMoveSelection = myHits == null || (!myHits.getNameFullHits().contains(current) && !myHits.getContentHits().contains(current));
    if (shouldMoveSelection && type != DocumentEvent.EventType.INSERT && (myFiltered == null || myFiltered.contains(current))) {
        shouldMoveSelection = false;
    }
    Configurable candidate = adjustSelection ? current : null;
    if (shouldMoveSelection && myHits != null) {
        if (!myHits.getNameHits().isEmpty()) {
            candidate = findConfigurable(myHits.getNameHits(), myHits.getNameFullHits());
        } else if (!myHits.getContentHits().isEmpty()) {
            candidate = findConfigurable(myHits.getContentHits(), null);
        }
    }
    updateSpotlight(false);
    if ((myFiltered == null || !myFiltered.isEmpty()) && candidate == null && myLastSelected != null) {
        candidate = myLastSelected;
        myLastSelected = null;
    }
    if (candidate == null && current != null) {
        myLastSelected = current;
    }
    SimpleNode node = !adjustSelection ? null : findNode(candidate);
    ActionCallback callback = fireUpdate(node, adjustSelection, now);
    myDocumentWasChanged = true;
    return callback;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) SimpleNode(com.intellij.ui.treeStructure.SimpleNode)

Aggregations

SimpleNode (com.intellij.ui.treeStructure.SimpleNode)20 BaseDomElementNode (com.intellij.util.xml.tree.BaseDomElementNode)5 NullNode (com.intellij.ui.treeStructure.NullNode)4 DomElement (com.intellij.util.xml.DomElement)3 TreePath (javax.swing.tree.TreePath)3 NotNull (org.jetbrains.annotations.NotNull)3 DomCollectionChildDescription (com.intellij.util.xml.reflect.DomCollectionChildDescription)2 DomElementsGroupNode (com.intellij.util.xml.tree.DomElementsGroupNode)2 DomFileElementNode (com.intellij.util.xml.tree.DomFileElementNode)2 DomModelTreeView (com.intellij.util.xml.tree.DomModelTreeView)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 AbstractDependencyNode (com.android.tools.idea.gradle.structure.configurables.android.dependencies.treeview.AbstractDependencyNode)1 AbstractTreeUi (com.intellij.ide.util.treeView.AbstractTreeUi)1 Result (com.intellij.openapi.application.Result)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 ProjectNode (com.intellij.openapi.externalSystem.view.ProjectNode)1 TaskNode (com.intellij.openapi.externalSystem.view.TaskNode)1 Configurable (com.intellij.openapi.options.Configurable)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 PackagingElementNode (com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingElementNode)1