use of com.intellij.debugger.DebugUIEnvironment 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);
}
}
});
}
}
Aggregations