Search in sources :

Example 16 with DebuggerCommandImpl

use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.

the class AddSteppingFilterAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
    DebugProcessImpl process = debuggerContext.getDebugProcess();
    if (process == null) {
        return;
    }
    final StackFrameProxyImpl proxy = PopFrameAction.getStackFrameProxy(e);
    process.getManagerThread().schedule(new DebuggerCommandImpl() {

        protected void action() throws Exception {
            final String name = getClassName(proxy != null ? proxy : debuggerContext.getFrameProxy());
            if (name == null) {
                return;
            }
            final Project project = e.getData(CommonDataKeys.PROJECT);
            ApplicationManager.getApplication().invokeLater(() -> {
                String filter = Messages.showInputDialog(project, "", "Add Stepping Filter", null, name, null);
                if (filter != null) {
                    ClassFilter[] newFilters = ArrayUtil.append(DebuggerSettings.getInstance().getSteppingFilters(), new ClassFilter(filter));
                    DebuggerSettings.getInstance().setSteppingFilters(newFilters);
                }
            });
        }
    });
}
Also used : StackFrameProxyImpl(com.intellij.debugger.jdi.StackFrameProxyImpl) Project(com.intellij.openapi.project.Project) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ClassFilter(com.intellij.ui.classFilter.ClassFilter) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 17 with DebuggerCommandImpl

use of com.intellij.debugger.engine.events.DebuggerCommandImpl 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 18 with DebuggerCommandImpl

use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.

the class DebuggerManagerThreadImpl method startLongProcessAndFork.

void startLongProcessAndFork(Runnable process) {
    assertIsManagerThread();
    startNewWorkerThread();
    try {
        process.run();
    } finally {
        final WorkerThreadRequest request = getCurrentThreadRequest();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Switching back to " + request);
        }
        super.invokeAndWait(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                switchToRequest(request);
            }

            @Override
            protected void commandCancelled() {
                LOG.debug("Event queue was closed, killing request");
                request.requestStop();
            }
        });
    }
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) VMDisconnectedException(com.sun.jdi.VMDisconnectedException)

Example 19 with DebuggerCommandImpl

use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.

the class JavaBreakpointHandler method registerBreakpoint.

@Override
public void registerBreakpoint(@NotNull XBreakpoint breakpoint) {
    Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
    if (javaBreakpoint == null) {
        javaBreakpoint = createJavaBreakpoint(breakpoint);
        breakpoint.putUserData(Breakpoint.DATA_KEY, javaBreakpoint);
    }
    if (javaBreakpoint != null) {
        final Breakpoint bpt = javaBreakpoint;
        BreakpointManager.addBreakpoint(bpt);
        // use schedule not to block initBreakpoints
        myProcess.getManagerThread().schedule(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                bpt.createRequest(myProcess);
            }

            @Override
            public Priority getPriority() {
                return Priority.HIGH;
            }
        });
    }
}
Also used : XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl)

Example 20 with DebuggerCommandImpl

use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.

the class DebuggerContextUtil method setStackFrame.

public static void setStackFrame(final DebuggerStateManager manager, final StackFrameProxyImpl stackFrame) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    final DebuggerContextImpl context = manager.getContext();
    final DebuggerSession session = context.getDebuggerSession();
    if (session != null) {
        session.getProcess().getManagerThread().schedule(new DebuggerCommandImpl() {

            @Override
            public Priority getPriority() {
                return Priority.HIGH;
            }

            @Override
            protected void action() throws Exception {
                SuspendContextImpl threadSuspendContext = SuspendManagerUtil.findContextByThread(session.getProcess().getSuspendManager(), stackFrame.threadProxy());
                final DebuggerContextImpl newContext = DebuggerContextImpl.createDebuggerContext(session, threadSuspendContext, stackFrame.threadProxy(), stackFrame);
                DebuggerInvocationUtil.swingInvokeLater(session.getProject(), () -> {
                    manager.setState(newContext, session.getState(), DebuggerSession.Event.REFRESH, null);
                    SourceCodeChecker.checkSource(newContext);
                });
            }
        });
    } else {
        manager.setState(DebuggerContextImpl.EMPTY_CONTEXT, DebuggerSession.State.DISPOSED, DebuggerSession.Event.REFRESH, null);
    }
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl)

Aggregations

DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)24 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)9 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)8 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)5 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)4 Project (com.intellij.openapi.project.Project)4 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)3 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)3 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)3 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)3 ExecutionException (com.intellij.execution.ExecutionException)3 VMDisconnectedException (com.sun.jdi.VMDisconnectedException)3 List (java.util.List)3 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)2 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)2 InvalidDataException (com.intellij.openapi.util.InvalidDataException)2 XDebugSession (com.intellij.xdebugger.XDebugSession)2 ArrayList (java.util.ArrayList)2 Client (com.android.ddmlib.Client)1 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1