Search in sources :

Example 21 with DebuggerCommandImpl

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

the class HotSwapManager method reloadModifiedClasses.

public static void reloadModifiedClasses(final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses, final HotSwapProgress reloadClassesProgress) {
    final MultiProcessCommand reloadClassesCommand = new MultiProcessCommand();
    reloadClassesProgress.setCancelWorker(() -> reloadClassesCommand.cancel());
    for (final DebuggerSession debuggerSession : modifiedClasses.keySet()) {
        reloadClassesCommand.addCommand(debuggerSession.getProcess(), new DebuggerCommandImpl() {

            protected void action() throws Exception {
                reloadClassesProgress.setDebuggerSession(debuggerSession);
                getInstance(reloadClassesProgress.getProject()).reloadClasses(debuggerSession, modifiedClasses.get(debuggerSession), reloadClassesProgress);
            }

            protected void commandCancelled() {
                debuggerSession.setModifiedClassesScanRequired(true);
            }
        });
    }
    reloadClassesProgress.setTitle(DebuggerBundle.message("progress.hotswap.reloading"));
    reloadClassesCommand.run();
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl)

Example 22 with DebuggerCommandImpl

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

the class DebuggerTestCase method waitForCompleted.

protected void waitForCompleted() {
    final SynchronizationBasedSemaphore s = new SynchronizationBasedSemaphore();
    s.down();
    final InvokeThread.WorkerThreadRequest request = getDebugProcess().getManagerThread().getCurrentRequest();
    final Thread thread = new Thread("Joining " + request) {

        @Override
        public void run() {
            try {
                request.join();
            } catch (Exception ignored) {
            }
        }
    };
    thread.start();
    if (request.isDone()) {
        thread.interrupt();
    }
    waitFor(() -> {
        try {
            thread.join();
        } catch (InterruptedException ignored) {
        }
    });
    invokeRatherLater(new DebuggerCommandImpl() {

        @Override
        protected void action() throws Exception {
            LOG.assertTrue(false);
        }

        @Override
        protected void commandCancelled() {
            //We wait for invokeRatherLater's
            invokeRatherLater(new DebuggerCommandImpl() {

                @Override
                protected void action() throws Exception {
                    LOG.assertTrue(false);
                }

                @Override
                protected void commandCancelled() {
                    s.up();
                }
            });
        }
    });
    waitFor(() -> s.waitFor());
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) InvocationTargetException(java.lang.reflect.InvocationTargetException) WriteExternalException(com.intellij.openapi.util.WriteExternalException) ExecutionException(com.intellij.execution.ExecutionException) InvalidDataException(com.intellij.openapi.util.InvalidDataException)

Example 23 with DebuggerCommandImpl

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

the class ExecutionWithDebuggerToolsTestCase method pumpSwingThread.

protected void pumpSwingThread() {
    LOG.assertTrue(SwingUtilities.isEventDispatchThread());
    final InvokeRatherLaterRequest request = myRatherLaterRequests.get(0);
    request.invokesN++;
    if (request.invokesN == RATHER_LATER_INVOKES_N) {
        myRatherLaterRequests.remove(0);
        if (!myRatherLaterRequests.isEmpty())
            pumpSwingThread();
    }
    if (request.myDebuggerCommand instanceof SuspendContextCommandImpl) {
        request.myDebugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(((SuspendContextCommandImpl) request.myDebuggerCommand).getSuspendContext()) {

            @Override
            public void contextAction() throws Exception {
                pumpDebuggerThread(request);
            }

            @Override
            protected void commandCancelled() {
                pumpDebuggerThread(request);
            }
        });
    } else {
        request.myDebugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {

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

            @Override
            protected void commandCancelled() {
                pumpDebuggerThread(request);
            }
        });
    }
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) ExecutionException(com.intellij.execution.ExecutionException) CompoundRuntimeException(com.intellij.util.lang.CompoundRuntimeException) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 24 with DebuggerCommandImpl

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

the class ClassesFilteredView method setActive.

public void setActive(boolean active, @NotNull DebuggerManagerThreadImpl managerThread) {
    if (myIsActive == active) {
        return;
    }
    myIsActive = active;
    managerThread.schedule(new DebuggerCommandImpl() {

        @Override
        protected void action() throws Exception {
            if (active) {
                doActivate();
            } else {
                doPause();
            }
        }
    });
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl)

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