Search in sources :

Example 1 with BatchEvaluator

use of com.intellij.debugger.ui.tree.render.BatchEvaluator in project consulo-java by consulo.

the class GenericDebuggerRunner method attachVirtualMachine.

@Nullable
protected RunContentDescriptor attachVirtualMachine(RunProfileState state, @Nonnull ExecutionEnvironment env, RemoteConnection connection, boolean pollConnection) throws ExecutionException {
    DebugEnvironment environment = new DefaultDebugEnvironment(env, state, connection, pollConnection);
    final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
    if (debuggerSession == null) {
        return null;
    }
    final DebugProcessImpl debugProcess = debuggerSession.getProcess();
    if (debugProcess.isDetached() || debugProcess.isDetaching()) {
        debuggerSession.dispose();
        return null;
    }
    if (environment.isRemote()) {
        // optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
        // which is an expensive operation when executed first time
        debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
    }
    return XDebuggerManager.getInstance(env.getProject()).startSession(env, session -> {
        XDebugSessionImpl sessionImpl = (XDebugSessionImpl) session;
        ExecutionResult executionResult = debugProcess.getExecutionResult();
        sessionImpl.addExtraActions(executionResult.getActions());
        if (executionResult instanceof DefaultExecutionResult) {
            sessionImpl.addRestartActions(((DefaultExecutionResult) executionResult).getRestartActions());
        }
        return JavaDebugProcess.create(session, debuggerSession);
    }).getRunContentDescriptor();
}
Also used : DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) ExecutionException(com.intellij.execution.ExecutionException) XDebuggerManager(com.intellij.xdebugger.XDebuggerManager) JavaPatchableProgramRunner(com.intellij.execution.runners.JavaPatchableProgramRunner) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) com.intellij.execution.configurations(com.intellij.execution.configurations) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) DebugEnvironment(com.intellij.debugger.DebugEnvironment) ExecutionResult(com.intellij.execution.ExecutionResult) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SettingsEditor(com.intellij.openapi.options.SettingsEditor) DebuggerUtils(com.intellij.debugger.engine.DebuggerUtils) DefaultDebugExecutor(com.intellij.execution.executors.DefaultDebugExecutor) StringUtil(com.intellij.openapi.util.text.StringUtil) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) BatchEvaluator(com.intellij.debugger.ui.tree.render.BatchEvaluator) OwnJavaParameters(consulo.java.execution.configurations.OwnJavaParameters) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) Executor(com.intellij.execution.Executor) GenericDebugRunnerConfiguration(consulo.java.debugger.impl.GenericDebugRunnerConfiguration) DebuggerSettings(com.intellij.debugger.settings.DebuggerSettings) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) JavaDebugProcess(com.intellij.debugger.engine.JavaDebugProcess) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ExecutionResult(com.intellij.execution.ExecutionResult) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DebugEnvironment(com.intellij.debugger.DebugEnvironment) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) Nullable(javax.annotation.Nullable)

Aggregations

DebugEnvironment (com.intellij.debugger.DebugEnvironment)1 DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 DebuggerUtils (com.intellij.debugger.engine.DebuggerUtils)1 JavaDebugProcess (com.intellij.debugger.engine.JavaDebugProcess)1 DebuggerSettings (com.intellij.debugger.settings.DebuggerSettings)1 BatchEvaluator (com.intellij.debugger.ui.tree.render.BatchEvaluator)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionException (com.intellij.execution.ExecutionException)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 Executor (com.intellij.execution.Executor)1 com.intellij.execution.configurations (com.intellij.execution.configurations)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 JavaPatchableProgramRunner (com.intellij.execution.runners.JavaPatchableProgramRunner)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 SettingsEditor (com.intellij.openapi.options.SettingsEditor)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1