Search in sources :

Example 1 with DebuggerPanelsManager

use of com.intellij.debugger.ui.DebuggerPanelsManager in project intellij-community by JetBrains.

the class JavaDebuggerLauncherImpl method startDebugSession.

@Override
public void startDebugSession(@NotNull JavaDebugConnectionData info, @NotNull ExecutionEnvironment executionEnvironment, @NotNull RemoteServer<?> server) throws ExecutionException {
    final Project project = executionEnvironment.getProject();
    final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(project);
    final JavaDebugServerModeHandler serverModeHandler = info.getServerModeHandler();
    boolean serverMode = serverModeHandler != null;
    final RemoteConnection remoteConnection = new RemoteConnection(true, info.getHost(), String.valueOf(info.getPort()), serverMode);
    DebugEnvironment debugEnvironment = new RemoteServerDebugEnvironment(project, remoteConnection, executionEnvironment.getRunProfile());
    DebugUIEnvironment debugUIEnvironment = new RemoteServerDebugUIEnvironment(debugEnvironment, executionEnvironment);
    RunContentDescriptor debugContentDescriptor = manager.attachVirtualMachine(debugUIEnvironment);
    LOG.assertTrue(debugContentDescriptor != null);
    ProcessHandler processHandler = debugContentDescriptor.getProcessHandler();
    LOG.assertTrue(processHandler != null);
    if (serverMode) {
        serverModeHandler.attachRemote();
        DebuggerManager.getInstance(executionEnvironment.getProject()).addDebugProcessListener(processHandler, new DebugProcessListener() {

            public void processDetached(DebugProcess process, boolean closedByUser) {
                try {
                    serverModeHandler.detachRemote();
                } catch (ExecutionException e) {
                    LOG.info(e);
                }
            }
        });
    }
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) JavaDebugServerModeHandler(com.intellij.remoteServer.runtime.deployment.debug.JavaDebugServerModeHandler) Project(com.intellij.openapi.project.Project) DebugProcess(com.intellij.debugger.engine.DebugProcess) DebugProcessListener(com.intellij.debugger.engine.DebugProcessListener) DebuggerPanelsManager(com.intellij.debugger.ui.DebuggerPanelsManager) RemoteDebugProcessHandler(com.intellij.debugger.engine.RemoteDebugProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) RemoteConnection(com.intellij.execution.configurations.RemoteConnection) ExecutionException(com.intellij.execution.ExecutionException) DebugEnvironment(com.intellij.debugger.DebugEnvironment) DebugUIEnvironment(com.intellij.debugger.DebugUIEnvironment)

Aggregations

DebugEnvironment (com.intellij.debugger.DebugEnvironment)1 DebugUIEnvironment (com.intellij.debugger.DebugUIEnvironment)1 DebugProcess (com.intellij.debugger.engine.DebugProcess)1 DebugProcessListener (com.intellij.debugger.engine.DebugProcessListener)1 RemoteDebugProcessHandler (com.intellij.debugger.engine.RemoteDebugProcessHandler)1 DebuggerPanelsManager (com.intellij.debugger.ui.DebuggerPanelsManager)1 ExecutionException (com.intellij.execution.ExecutionException)1 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 Project (com.intellij.openapi.project.Project)1 JavaDebugServerModeHandler (com.intellij.remoteServer.runtime.deployment.debug.JavaDebugServerModeHandler)1