use of com.intellij.debugger.ui.tree.NodeDescriptor in project intellij-community by JetBrains.
the class DescriptorTestCase method expandAll.
protected void expandAll(final Tree tree, final Runnable runnable, final Set<Value> alreadyExpanded, final NodeFilter filter, final SuspendContextImpl context) {
invokeRatherLater(context, () -> {
boolean anyCollapsed = false;
for (int i = 0; i < tree.getRowCount(); i++) {
final TreeNode treeNode = (TreeNode) tree.getPathForRow(i).getLastPathComponent();
if (tree.isCollapsed(i) && !treeNode.isLeaf()) {
NodeDescriptor nodeDescriptor = null;
if (treeNode instanceof DebuggerTreeNodeImpl) {
nodeDescriptor = ((DebuggerTreeNodeImpl) treeNode).getDescriptor();
}
boolean shouldExpand = filter == null || filter.shouldExpand(treeNode);
if (shouldExpand) {
// additional checks to prevent infinite expand
if (nodeDescriptor instanceof ValueDescriptor) {
final Value value = ((ValueDescriptor) nodeDescriptor).getValue();
shouldExpand = !alreadyExpanded.contains(value);
if (shouldExpand) {
alreadyExpanded.add(value);
}
}
}
if (shouldExpand) {
anyCollapsed = true;
tree.expandRow(i);
}
}
}
if (anyCollapsed) {
expandAll(tree, runnable, alreadyExpanded, filter, context);
} else {
runnable.run();
}
});
}
use of com.intellij.debugger.ui.tree.NodeDescriptor in project intellij-community by JetBrains.
the class InstancesTree method getSelectedReference.
@Nullable
ObjectReference getSelectedReference() {
TreePath selectionPath = getSelectionPath();
Object selectedItem = selectionPath != null ? selectionPath.getLastPathComponent() : null;
if (selectedItem instanceof XValueNodeImpl) {
XValueNodeImpl xValueNode = (XValueNodeImpl) selectedItem;
XValue valueContainer = xValueNode.getValueContainer();
if (valueContainer instanceof NodeDescriptorProvider) {
NodeDescriptor descriptor = ((NodeDescriptorProvider) valueContainer).getDescriptor();
if (descriptor instanceof ValueDescriptor) {
Value value = ((ValueDescriptor) descriptor).getValue();
if (value instanceof ObjectReference)
return (ObjectReference) value;
}
}
}
return null;
}
use of com.intellij.debugger.ui.tree.NodeDescriptor in project intellij-community by JetBrains.
the class DescriptorTree method dfstImpl.
private void dfstImpl(NodeDescriptor descriptor, List<NodeDescriptor> children, DFSTWalker walker) {
if (children != null) {
for (NodeDescriptor child : children) {
walker.visit(descriptor, child);
dfstImpl(child, myChildrenMap.get(child), walker);
}
}
}
use of com.intellij.debugger.ui.tree.NodeDescriptor in project android by JetBrains.
the class InstancesTreeView method expandMoreNodesUntilFound.
@Nullable
private DebuggerTreeNodeImpl expandMoreNodesUntilFound(@NotNull DebuggerTreeNodeImpl node, @NotNull Instance targetInstance) {
if (node.getDescriptor() instanceof ContainerDescriptorImpl) {
int startIndex = 0;
if (node.getChildCount() > 0) {
DebuggerTreeNodeImpl lastNode = (DebuggerTreeNodeImpl) node.getChildAt(node.getChildCount() - 1);
if (lastNode.getDescriptor() instanceof ExpansionDescriptorImpl) {
lastNode.removeFromParent();
startIndex = node.getChildCount() - 1;
} else {
for (int scanIndex = 0; scanIndex < node.getChildCount(); ++scanIndex) {
DebuggerTreeNodeImpl scanNode = (DebuggerTreeNodeImpl) node.getChildAt(scanIndex);
NodeDescriptor nodeDescriptor = scanNode.getDescriptor();
if (nodeDescriptor instanceof InstanceFieldDescriptorImpl && ((InstanceFieldDescriptorImpl) nodeDescriptor).getInstance() == targetInstance) {
return scanNode;
}
}
return null;
}
}
int maxSize = ((ContainerDescriptorImpl) node.getDescriptor()).getInstances().size();
while (startIndex < maxSize) {
addContainerChildren(node, startIndex, false);
for (int scanIndex = startIndex; scanIndex < node.getChildCount(); ++scanIndex) {
DebuggerTreeNodeImpl scanNode = (DebuggerTreeNodeImpl) node.getChildAt(scanIndex);
NodeDescriptor nodeDescriptor = scanNode.getDescriptor();
if (nodeDescriptor instanceof InstanceFieldDescriptorImpl && ((InstanceFieldDescriptorImpl) nodeDescriptor).getInstance() == targetInstance) {
addExpansionNode(node, node.getChildCount(), maxSize);
return scanNode;
}
}
startIndex = node.getChildCount();
}
}
return null;
}
Aggregations