Search in sources :

Example 11 with DebuggerTreeNodeImpl

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;
}
Also used : ValueDescriptorImpl(com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 12 with DebuggerTreeNodeImpl

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);
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ThreadDescriptorImpl(com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 13 with DebuggerTreeNodeImpl

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();
                }
            });
        }
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ThreadDescriptorImpl(com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl)

Example 14 with DebuggerTreeNodeImpl

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);
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)

Example 15 with DebuggerTreeNodeImpl

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();
        }
    });
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) TreeNode(javax.swing.tree.TreeNode) ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) NodeDescriptor(com.intellij.debugger.ui.tree.NodeDescriptor) Value(com.sun.jdi.Value)

Aggregations

DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)26 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)11 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)10 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)9 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)7 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)6 Nullable (org.jetbrains.annotations.Nullable)6 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)5 Project (com.intellij.openapi.project.Project)5 SourcePosition (com.intellij.debugger.SourcePosition)4 DebuggerTree (com.intellij.debugger.ui.impl.watch.DebuggerTree)4 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)3 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 FieldDescriptorImpl (com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl)2 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)2 NodeDescriptor (com.intellij.debugger.ui.tree.NodeDescriptor)2 Document (com.intellij.openapi.editor.Document)2