Search in sources :

Example 1 with SuspendContextCommand

use of com.intellij.debugger.engine.managerThread.SuspendContextCommand in project intellij-community by JetBrains.

the class BatchEvaluator method invoke.

public void invoke(ToStringCommand command) {
    LOG.assertTrue(DebuggerManager.getInstance(myDebugProcess.getProject()).isDebuggerManagerThread());
    final EvaluationContext evaluationContext = command.getEvaluationContext();
    final SuspendContext suspendContext = evaluationContext.getSuspendContext();
    if (!Registry.is("debugger.batch.evaluation") || !hasBatchEvaluator(evaluationContext)) {
        myDebugProcess.getManagerThread().invokeCommand(command);
    } else {
        List<ToStringCommand> toStringCommands = myBuffer.get(suspendContext);
        if (toStringCommands == null) {
            final List<ToStringCommand> commands = new ArrayList<>();
            toStringCommands = commands;
            myBuffer.put(suspendContext, commands);
            myDebugProcess.getManagerThread().invokeCommand(new SuspendContextCommand() {

                public SuspendContext getSuspendContext() {
                    return suspendContext;
                }

                public void action() {
                    myBuffer.remove(suspendContext);
                    if (!doEvaluateBatch(commands, evaluationContext)) {
                        commands.forEach(ToStringCommand::action);
                    }
                }

                public void commandCancelled() {
                    myBuffer.remove(suspendContext);
                }
            });
        }
        toStringCommands.add(command);
    }
}
Also used : SuspendContextCommand(com.intellij.debugger.engine.managerThread.SuspendContextCommand) ArrayList(java.util.ArrayList) EvaluationContext(com.intellij.debugger.engine.evaluation.EvaluationContext)

Example 2 with SuspendContextCommand

use of com.intellij.debugger.engine.managerThread.SuspendContextCommand in project intellij-community by JetBrains.

the class DebuggerManagerThreadImpl method invokeCommand.

@Override
public void invokeCommand(final DebuggerCommand command) {
    if (command instanceof SuspendContextCommand) {
        SuspendContextCommand suspendContextCommand = (SuspendContextCommand) command;
        schedule(new SuspendContextCommandImpl((SuspendContextImpl) suspendContextCommand.getSuspendContext()) {

            @Override
            public void contextAction() throws Exception {
                command.action();
            }

            @Override
            protected void commandCancelled() {
                command.commandCancelled();
            }
        });
    } else {
        schedule(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                command.action();
            }

            @Override
            protected void commandCancelled() {
                command.commandCancelled();
            }
        });
    }
}
Also used : SuspendContextCommand(com.intellij.debugger.engine.managerThread.SuspendContextCommand) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) VMDisconnectedException(com.sun.jdi.VMDisconnectedException)

Example 3 with SuspendContextCommand

use of com.intellij.debugger.engine.managerThread.SuspendContextCommand 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)

Aggregations

SuspendContextCommand (com.intellij.debugger.engine.managerThread.SuspendContextCommand)3 DebuggerContext (com.intellij.debugger.DebuggerContext)1 SuspendContext (com.intellij.debugger.engine.SuspendContext)1 EvaluationContext (com.intellij.debugger.engine.evaluation.EvaluationContext)1 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)1 DebuggerTreeNode (com.intellij.debugger.ui.tree.DebuggerTreeNode)1 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)1 VMDisconnectedException (com.sun.jdi.VMDisconnectedException)1 ArrayList (java.util.ArrayList)1 Enumeration (java.util.Enumeration)1