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();
}
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;
}
}
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;
}
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);
}
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;
}
Aggregations