use of com.intellij.execution.runners.RunContentBuilder in project intellij-plugins by JetBrains.
the class JstdCoverageProgramRunner method start.
@Nullable
private static RunContentDescriptor start(@Nullable JstdServer server, @NotNull ExecutionEnvironment environment) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
JstdRunConfiguration runConfiguration = (JstdRunConfiguration) environment.getRunProfile();
CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(runConfiguration);
String coverageFilePath = coverageEnabledConfiguration.getCoverageFilePath();
JstdRunProfileState jstdState = new JstdRunProfileState(environment, runConfiguration.getRunSettings(), coverageFilePath);
ExecutionResult executionResult = jstdState.executeWithServer(server);
RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, environment);
final RunContentDescriptor descriptor = contentBuilder.showRunContent(environment.getContentToReuse());
ProcessHandler processHandler = executionResult.getProcessHandler();
if (processHandler instanceof NopProcessHandler) {
if (server != null) {
server.addLifeCycleListener(new JstdServerLifeCycleAdapter() {
@Override
public void onBrowserCaptured(@NotNull JstdBrowserInfo info) {
ExecutionUtil.restartIfActive(descriptor);
server.removeLifeCycleListener(this);
}
}, contentBuilder);
}
} else {
CoverageHelper.attachToProcess(runConfiguration, processHandler, environment.getRunnerSettings());
}
return descriptor;
}
use of com.intellij.execution.runners.RunContentBuilder in project intellij-plugins by JetBrains.
the class JstdRunProgramRunner method start.
public static RunContentDescriptor start(@Nullable JstdServer server, boolean fromDebug, @NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
JstdRunProfileState jstdState = JstdRunProfileState.cast(state);
ExecutionResult executionResult = jstdState.executeWithServer(server);
RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, environment);
final RunContentDescriptor descriptor = contentBuilder.showRunContent(environment.getContentToReuse());
if (server != null && executionResult.getProcessHandler() instanceof NopProcessHandler) {
server.addLifeCycleListener(new JstdServerLifeCycleAdapter() {
@Override
public void onBrowserCaptured(@NotNull JstdBrowserInfo info) {
if (fromDebug) {
final Alarm alarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, descriptor);
alarm.addRequest(() -> ExecutionUtil.restartIfActive(descriptor), 1000);
} else {
ExecutionUtil.restartIfActive(descriptor);
}
server.removeLifeCycleListener(this);
}
}, contentBuilder);
}
return descriptor;
}
use of com.intellij.execution.runners.RunContentBuilder in project intellij-plugins by JetBrains.
the class FlexRunner method launchWebFlexUnit.
protected RunContentDescriptor launchWebFlexUnit(final Project project, final RunContentDescriptor contentToReuse, final ExecutionEnvironment env, final FlexUnitRunnerParameters params, final String swfFilePath) throws ExecutionException {
final SwfPolicyFileConnection policyFileConnection = new SwfPolicyFileConnection();
policyFileConnection.open(params.getSocketPolicyPort());
final FlexUnitConnection flexUnitConnection = new FlexUnitConnection();
flexUnitConnection.open(params.getPort());
final ProcessHandler processHandler = new DefaultDebugProcessHandler() {
@Override
protected void destroyProcessImpl() {
flexUnitConnection.write("Finish");
flexUnitConnection.close();
policyFileConnection.close();
super.destroyProcessImpl();
}
@Override
public boolean detachIsDefault() {
return false;
}
};
final ExecutionConsole console = createFlexUnitRunnerConsole(project, env, processHandler);
flexUnitConnection.addListener(new FlexUnitListener(processHandler));
launchWithSelectedApplication(swfFilePath, params.getLauncherParameters());
final RunContentBuilder contentBuilder = new RunContentBuilder(new DefaultExecutionResult(console, processHandler), env);
Disposer.register(project, contentBuilder);
return contentBuilder.showRunContent(contentToReuse);
}
use of com.intellij.execution.runners.RunContentBuilder in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoCoverageProgramRunner method doExecute.
@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
assert state instanceof GoTestRunningState;
GoTestRunningState runningState = (GoTestRunningState) state;
GoTestRunConfiguration runConfiguration = ObjectUtils.tryCast(environment.getRunProfile(), GoTestRunConfiguration.class);
if (runConfiguration == null) {
return null;
}
FileDocumentManager.getInstance().saveAllDocuments();
CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(runConfiguration);
runningState.setCoverageFilePath(coverageEnabledConfiguration.getCoverageFilePath());
ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
if (executionResult == null) {
return null;
}
CoverageHelper.attachToProcess(runConfiguration, executionResult.getProcessHandler(), environment.getRunnerSettings());
return new RunContentBuilder(executionResult, environment).showRunContent(environment.getContentToReuse());
}
use of com.intellij.execution.runners.RunContentBuilder in project intellij-plugins by JetBrains.
the class FlexRunner method standardLaunch.
@Nullable
private RunContentDescriptor standardLaunch(final Project project, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment environment) throws ExecutionException {
final ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
if (executionResult == null)
return null;
final RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, environment);
return contentBuilder.showRunContent(contentToReuse);
}
Aggregations