use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class AdjustArrayRangeAction method createNodeTitle.
private static String createNodeTitle(String prefix, DebuggerTreeNodeImpl node) {
if (node != null) {
DebuggerTreeNodeImpl parent = node.getParent();
NodeDescriptorImpl descriptor = parent.getDescriptor();
if (descriptor instanceof ValueDescriptorImpl && ((ValueDescriptorImpl) descriptor).isArray()) {
int index = parent.getIndex(node);
return createNodeTitle(prefix, parent) + "[" + index + "]";
}
String name = (node.getDescriptor() != null) ? node.getDescriptor().getName() : null;
return (name != null) ? prefix + " " + name : prefix;
}
return prefix;
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method update.
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
DebugProcessImpl debugProcess = getDebuggerContext(e.getDataContext()).getDebugProcess();
boolean visible = false;
if (debugProcess != null) {
visible = true;
for (DebuggerTreeNodeImpl aSelectedNode : selectedNode) {
NodeDescriptorImpl threadDescriptor = aSelectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || ((ThreadDescriptorImpl) threadDescriptor).isSuspended()) {
visible = false;
break;
}
}
}
e.getPresentation().setVisible(visible);
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
if (!threadDescriptor.isFrozen()) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class ThreadsPanel method updateNodeLabels.
private static void updateNodeLabels(DebuggerTreeNodeImpl from) {
final int childCount = from.getChildCount();
for (int idx = 0; idx < childCount; idx++) {
final DebuggerTreeNodeImpl child = (DebuggerTreeNodeImpl) from.getChildAt(idx);
child.getDescriptor().updateRepresentation(null, child::labelChanged);
updateNodeLabels(child);
}
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl 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();
}
});
}
Aggregations