Search in sources :

Example 21 with XValueNodeImpl

use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.

the class XDebuggerTreeActionBase method getSelectedNode.

@Nullable
public static XValueNodeImpl getSelectedNode(final DataContext dataContext) {
    XDebuggerTree tree = XDebuggerTree.getTree(dataContext);
    if (tree == null)
        return null;
    TreePath path = tree.getSelectionPath();
    if (path == null)
        return null;
    Object node = path.getLastPathComponent();
    return node instanceof XValueNodeImpl ? (XValueNodeImpl) node : null;
}
Also used : TreePath(javax.swing.tree.TreePath) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with XValueNodeImpl

use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl 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

XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)22 NotNull (org.jetbrains.annotations.NotNull)7 Project (com.intellij.openapi.project.Project)6 XValue (com.intellij.xdebugger.frame.XValue)6 XDebugSession (com.intellij.xdebugger.XDebugSession)5 XDebuggerTree (com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)5 TreePath (javax.swing.tree.TreePath)5 JavaValue (com.intellij.debugger.engine.JavaValue)4 ObjectReference (com.sun.jdi.ObjectReference)3 Nullable (org.jetbrains.annotations.Nullable)3 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)2 ResultConsumer (com.intellij.concurrency.ResultConsumer)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 MemoryViewDebugProcessData (com.intellij.debugger.memory.component.MemoryViewDebugProcessData)1 InstancesWindow (com.intellij.debugger.memory.ui.InstancesWindow)1 NodeDescriptorProvider (com.intellij.debugger.ui.impl.watch.NodeDescriptorProvider)1