Search in sources :

Example 11 with ValueDescriptor

use of com.intellij.debugger.ui.tree.ValueDescriptor in project intellij-community by JetBrains.

the class JavaMarkObjectActionHandler method isMarked.

@Override
public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) {
    final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext());
    if (node == null)
        return false;
    final NodeDescriptorImpl descriptor = node.getDescriptor();
    if (!(descriptor instanceof ValueDescriptor))
        return false;
    DebugProcess debugProcess = node.getTree().getDebuggerContext().getDebugProcess();
    return ((ValueDescriptor) descriptor).getMarkup(debugProcess) != null;
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 12 with ValueDescriptor

use of com.intellij.debugger.ui.tree.ValueDescriptor in project intellij-community by JetBrains.

the class ShowAllAs method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    DebuggerTreeNodeImpl selectedNode = (DebuggerTreeNodeImpl) ((DebuggerUtilsEx) DebuggerUtils.getInstance()).getSelectedNode(e.getDataContext());
    if (selectedNode == null)
        return;
    if (!isPrimitiveArray(selectedNode))
        return;
    final DebuggerContext debuggerContext = DebuggerUtils.getInstance().getDebuggerContext(e.getDataContext());
    if (debuggerContext == null || debuggerContext.getDebugProcess() == null)
        return;
    for (Enumeration children = selectedNode.children(); children.hasMoreElements(); ) {
        final DebuggerTreeNode child = (DebuggerTreeNode) children.nextElement();
        if (child.getDescriptor() instanceof ValueDescriptor) {
            debuggerContext.getDebugProcess().getManagerThread().invokeCommand(new SuspendContextCommand() {

                public SuspendContext getSuspendContext() {
                    return debuggerContext.getSuspendContext();
                }

                public void action() {
                    child.setRenderer(myRenderer);
                }

                public void commandCancelled() {
                }
            });
        }
    }
}
Also used : SuspendContextCommand(com.intellij.debugger.engine.managerThread.SuspendContextCommand) DebuggerTreeNode(com.intellij.debugger.ui.tree.DebuggerTreeNode) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) Enumeration(java.util.Enumeration) ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) DebuggerContext(com.intellij.debugger.DebuggerContext) SuspendContext(com.intellij.debugger.engine.SuspendContext)

Example 13 with ValueDescriptor

use of com.intellij.debugger.ui.tree.ValueDescriptor 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;
}
Also used : NodeDescriptorProvider(com.intellij.debugger.ui.impl.watch.NodeDescriptorProvider) TreePath(javax.swing.tree.TreePath) ObjectReference(com.sun.jdi.ObjectReference) ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) NodeDescriptor(com.intellij.debugger.ui.tree.NodeDescriptor) Value(com.sun.jdi.Value) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)13 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)6 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)4 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)4 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)3 ValueMarkup (com.intellij.xdebugger.impl.ui.tree.ValueMarkup)3 Value (com.sun.jdi.Value)3 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)2 NodeDescriptor (com.intellij.debugger.ui.tree.NodeDescriptor)2 Pair (com.intellij.openapi.util.Pair)2 HashMap (com.intellij.util.containers.HashMap)2 Patches (com.intellij.Patches)1 com.intellij.debugger (com.intellij.debugger)1 DebuggerContext (com.intellij.debugger.DebuggerContext)1 DebuggerAction (com.intellij.debugger.actions.DebuggerAction)1 DebuggerActions (com.intellij.debugger.actions.DebuggerActions)1 DebugProcess (com.intellij.debugger.engine.DebugProcess)1 SuspendContext (com.intellij.debugger.engine.SuspendContext)1 com.intellij.debugger.engine.evaluation (com.intellij.debugger.engine.evaluation)1