Search in sources :

Example 6 with NodeDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.

the class JumpToObjectAction method update.

@Override
public void update(final AnActionEvent e) {
    if (!isFirstStart(e)) {
        return;
    }
    final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null) {
        e.getPresentation().setVisible(false);
        return;
    }
    DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
    if (selectedNode == null) {
        e.getPresentation().setVisible(false);
        return;
    }
    final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
    if (descriptor instanceof ValueDescriptor) {
        debugProcess.getManagerThread().schedule(new EnableCommand(debuggerContext, (ValueDescriptor) descriptor, debugProcess, e));
    } else {
        e.getPresentation().setVisible(false);
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 7 with NodeDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.

the class EditSourceAction method getSourcePosition.

private static SourcePosition getSourcePosition(DebuggerTreeNodeImpl selectedNode, DebuggerContextImpl debuggerContext) {
    final DebuggerContextImpl context = debuggerContext;
    if (selectedNode == null || context == null) {
        return null;
    }
    final Project project = selectedNode.getProject();
    final DebuggerSession debuggerSession = context.getDebuggerSession();
    if (debuggerSession == null) {
        return null;
    }
    NodeDescriptorImpl nodeDescriptor = selectedNode.getDescriptor();
    if (nodeDescriptor instanceof WatchItemDescriptor) {
        Modifier modifier = ((WatchItemDescriptor) nodeDescriptor).getModifier();
        if (modifier == null) {
            return null;
        }
        nodeDescriptor = (NodeDescriptorImpl) modifier.getInspectItem(project);
    }
    final NodeDescriptorImpl nodeDescriptor1 = nodeDescriptor;
    return ApplicationManager.getApplication().runReadAction(new Computable<SourcePosition>() {

        public SourcePosition compute() {
            return SourcePositionProvider.getSourcePosition(nodeDescriptor1, project, context);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) SourcePosition(com.intellij.debugger.SourcePosition) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) WatchItemDescriptor(com.intellij.debugger.ui.impl.watch.WatchItemDescriptor) Modifier(com.intellij.debugger.engine.evaluation.expression.Modifier) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 8 with NodeDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl 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 9 with NodeDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl 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 10 with NodeDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.

the class InterruptThreadAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final DebuggerTreeNodeImpl[] nodes = getSelectedNodes(e.getDataContext());
    if (nodes == null) {
        return;
    }
    //noinspection ConstantConditions
    final List<ThreadReferenceProxyImpl> threadsToInterrupt = new ArrayList<>();
    for (final DebuggerTreeNodeImpl debuggerTreeNode : nodes) {
        final NodeDescriptorImpl descriptor = debuggerTreeNode.getDescriptor();
        if (descriptor instanceof ThreadDescriptorImpl) {
            threadsToInterrupt.add(((ThreadDescriptorImpl) descriptor).getThreadReference());
        }
    }
    if (!threadsToInterrupt.isEmpty()) {
        final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
        final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
        if (debugProcess != null) {
            debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {

                protected void action() throws Exception {
                    boolean unsupported = false;
                    for (ThreadReferenceProxyImpl thread : threadsToInterrupt) {
                        try {
                            thread.getThreadReference().interrupt();
                        } catch (UnsupportedOperationException ignored) {
                            unsupported = true;
                        }
                    }
                    if (unsupported) {
                        final Project project = debugProcess.getProject();
                        XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Thread operation 'interrupt' is not supported by VM", MessageType.INFO).notify(project);
                    }
                }
            });
        }
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) ArrayList(java.util.ArrayList) ThreadDescriptorImpl(com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) Project(com.intellij.openapi.project.Project) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Aggregations

NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)13 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)10 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)5 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)5 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)4 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)4 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)3 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Project (com.intellij.openapi.project.Project)2 Nullable (org.jetbrains.annotations.Nullable)2 SourcePosition (com.intellij.debugger.SourcePosition)1 DebugProcess (com.intellij.debugger.engine.DebugProcess)1 Modifier (com.intellij.debugger.engine.evaluation.expression.Modifier)1 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)1 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)1 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)1 TreeBuilder (com.intellij.debugger.ui.impl.tree.TreeBuilder)1 DebuggerTree (com.intellij.debugger.ui.impl.watch.DebuggerTree)1 WatchItemDescriptor (com.intellij.debugger.ui.impl.watch.WatchItemDescriptor)1