Search in sources :

Example 1 with XValueNodeImpl

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

the class PyViewNumericContainerAction method update.

@Override
public void update(AnActionEvent e) {
    e.getPresentation().setVisible(false);
    TreePath[] paths = getSelectedPaths(e.getDataContext());
    if (paths != null) {
        if (paths.length > 1) {
            e.getPresentation().setVisible(false);
            return;
        }
        XValueNodeImpl node = getSelectedNode(e.getDataContext());
        if (node != null && node.getValueContainer() instanceof PyDebugValue && node.isComputed()) {
            PyDebugValue debugValue = (PyDebugValue) node.getValueContainer();
            String nodeType = debugValue.getType();
            if ("ndarray".equals(nodeType)) {
                e.getPresentation().setText("View as Array");
                e.getPresentation().setVisible(true);
            } else if (("DataFrame".equals(nodeType))) {
                e.getPresentation().setText("View as DataFrame");
                e.getPresentation().setVisible(true);
            } else {
                e.getPresentation().setVisible(false);
            }
        } else {
            e.getPresentation().setVisible(false);
        }
    }
}
Also used : PyDebugValue(com.jetbrains.python.debugger.PyDebugValue) TreePath(javax.swing.tree.TreePath) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)

Example 2 with XValueNodeImpl

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

the class JumpToAllocationSourceAction method getStack.

@Nullable
private List<StackFrameItem> getStack(AnActionEvent e) {
    final Project project = e.getProject();
    final XValueNodeImpl selectedNode = getSelectedNode(e.getDataContext());
    final ObjectReference ref = selectedNode != null ? getObjectReference(selectedNode) : null;
    if (project == null || ref == null) {
        return null;
    }
    final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    if (session != null) {
        final MemoryViewDebugProcessData data = DebuggerManager.getInstance(project).getDebugProcess(session.getDebugProcess().getProcessHandler()).getUserData(MemoryViewDebugProcessData.KEY);
        return data != null ? data.getTrackedStacks().getStack(ref) : null;
    }
    return null;
}
Also used : MemoryViewDebugProcessData(com.intellij.debugger.memory.component.MemoryViewDebugProcessData) Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) ObjectReference(com.sun.jdi.ObjectReference) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with XValueNodeImpl

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

the class ViewAsGroup method getSelectedValues.

@NotNull
public static List<JavaValue> getSelectedValues(AnActionEvent event) {
    List<XValueNodeImpl> selectedNodes = XDebuggerTreeActionBase.getSelectedNodes(event.getDataContext());
    if (selectedNodes.isEmpty())
        return Collections.emptyList();
    List<JavaValue> res = new ArrayList<>(selectedNodes.size());
    for (XValueNodeImpl node : selectedNodes) {
        XValue container = node.getValueContainer();
        if (container instanceof JavaValue) {
            res.add((JavaValue) container);
        }
    }
    return res;
}
Also used : JavaValue(com.intellij.debugger.engine.JavaValue) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) ArrayList(java.util.ArrayList) XValue(com.intellij.xdebugger.frame.XValue) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with XValueNodeImpl

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

the class ViewTextAction method createCollector.

@NotNull
@Override
protected ValueCollector createCollector(@NotNull AnActionEvent e) {
    XValueNodeImpl node = getStringNode(e);
    return new ValueCollector(XDebuggerTree.getTree(e.getDataContext())) {

        MyDialog dialog = null;

        @Override
        public void handleInCollector(Project project, String value, XDebuggerTree tree) {
            String text = StringUtil.unquoteString(value);
            if (dialog == null) {
                dialog = new MyDialog(project, text, node);
                dialog.setTitle(ActionsBundle.message(node != null ? "action.Debugger.ViewEditText.text" : "action.Debugger.ViewText.text"));
                dialog.show();
            }
            dialog.setText(text);
        }
    };
}
Also used : Project(com.intellij.openapi.project.Project) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with XValueNodeImpl

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

the class AdjustArrayRangeAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
    DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null) {
        return;
    }
    final Project project = debuggerContext.getProject();
    final XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
    if (node == null) {
        return;
    }
    final XValue container = node.getValueContainer();
    if (!(container instanceof JavaValue)) {
        return;
    }
    final ValueDescriptorImpl descriptor = ((JavaValue) container).getDescriptor();
    ArrayRenderer renderer = getArrayRenderer(descriptor);
    if (renderer == null) {
        return;
    }
    //String title = createNodeTitle("", selectedNode);
    //String label = selectedNode.toString();
    //int index = label.indexOf('=');
    //if (index > 0) {
    //  title = title + " " + label.substring(index);
    //}
    String title = node.getName();
    final ArrayRenderer clonedRenderer = renderer.clone();
    clonedRenderer.setForced(true);
    if (ShowSettingsUtil.getInstance().editConfigurable(project, new NamedArrayConfigurable(title, clonedRenderer))) {
        debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(debuggerContext.getSuspendContext()) {

            @Override
            public void contextAction() throws Exception {
                final Renderer lastRenderer = descriptor.getLastRenderer();
                if (lastRenderer instanceof ArrayRenderer) {
                    ((JavaValue) container).setRenderer(clonedRenderer, node);
                } else if (lastRenderer instanceof CompoundNodeRenderer) {
                    final CompoundNodeRenderer compoundRenderer = (CompoundNodeRenderer) lastRenderer;
                    final ChildrenRenderer childrenRenderer = compoundRenderer.getChildrenRenderer();
                    if (childrenRenderer instanceof ExpressionChildrenRenderer) {
                        ExpressionChildrenRenderer.setPreferableChildrenRenderer(descriptor, clonedRenderer);
                        ((JavaValue) container).reBuild(node);
                    }
                }
            }
        });
    }
}
Also used : JavaValue(com.intellij.debugger.engine.JavaValue) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) XValue(com.intellij.xdebugger.frame.XValue) Project(com.intellij.openapi.project.Project) ValueDescriptorImpl(com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

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