beforeRunTaks

(cherry picked from commit f9fc313746720cd09ec122982907baf90eb1cdd8)
This commit is contained in:
Vladimir Krivosheev
2017-04-10 18:19:55 +02:00
parent d2e2c092e9
commit 5d6162e78a
9 changed files with 135 additions and 166 deletions
@@ -39,7 +39,6 @@ import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
@@ -142,12 +141,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
}
protected void disposeSession(final DebuggerSession debuggerSession) throws InterruptedException, InvocationTargetException {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
debuggerSession.dispose();
}
});
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> debuggerSession.dispose());
}
@Override
@@ -261,15 +255,12 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
final RemoteConnection debugParameters =
DebuggerManagerImpl.createDebugParameters(javaCommandLineState.getJavaParameters(), debuggerRunnerSettings, true);
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
try {
debuggerSession[0] = attachVirtualMachine(javaCommandLineState, javaCommandLineState.getEnvironment(), debugParameters, false);
}
catch (ExecutionException e) {
fail(e.getMessage());
}
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
try {
debuggerSession[0] = attachVirtualMachine(javaCommandLineState, javaCommandLineState.getEnvironment(), debugParameters, false);
}
catch (ExecutionException e) {
fail(e.getMessage());
}
});
@@ -338,17 +329,14 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
final RemoteState remoteState = new RemoteStateState(myProject, remoteConnection);
final DebuggerSession[] debuggerSession = new DebuggerSession[1];
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
try {
debuggerSession[0] = attachVirtualMachine(remoteState, new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
.runProfile(new MockConfiguration())
.build(), remoteConnection, pollConnection);
}
catch (ExecutionException e) {
fail(e.getMessage());
}
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
try {
debuggerSession[0] = attachVirtualMachine(remoteState, new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
.runProfile(new MockConfiguration())
.build(), remoteConnection, pollConnection);
}
catch (ExecutionException e) {
fail(e.getMessage());
}
});
debuggerSession[0].getProcess().getProcessHandler().addProcessListener(new ProcessAdapter() {
@@ -361,13 +349,10 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
}
protected void createBreakpoints(final String className) {
final PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
@Override
public PsiFile compute() {
PsiClass psiClass = JavaPsiFacade.getInstance(myProject).findClass(className, GlobalSearchScope.allScope(myProject));
assertNotNull(psiClass);
return psiClass.getContainingFile();
}
final PsiFile psiFile = ApplicationManager.getApplication().runReadAction((Computable<PsiFile>)() -> {
PsiClass psiClass = JavaPsiFacade.getInstance(myProject).findClass(className, GlobalSearchScope.allScope(myProject));
assertNotNull(psiClass);
return psiClass.getContainingFile();
});
createBreakpoints(psiFile);
@@ -441,12 +426,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
public DebuggerContextImpl createDebuggerContext(final SuspendContextImpl suspendContext, StackFrameProxyImpl stackFrame) {
final DebuggerSession[] session = new DebuggerSession[1];
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
session[0] = DebuggerManagerEx.getInstanceEx(myProject).getSession(suspendContext.getDebugProcess());
}
});
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> session[0] = DebuggerManagerEx.getInstanceEx(myProject).getSession(suspendContext.getDebugProcess()));
DebuggerContextImpl debuggerContext = DebuggerContextImpl.createDebuggerContext(
session[0],
@@ -575,9 +555,6 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
return "";
}
@Override
public void checkConfiguration() throws RuntimeConfigurationException { }
@Override
public void readExternal(Element element) throws InvalidDataException { }