use of com.intellij.execution.process.ProcessHandler in project android by JetBrains.
the class ProcessHandlerConsolePrinterTest method testSetProcessHandler.
public void testSetProcessHandler() {
ProcessHandlerConsolePrinter printer = new ProcessHandlerConsolePrinter(null);
printer.stdout("stdout1");
printer.stderr("stderr1");
ProcessHandler handler = mock(ProcessHandler.class);
printer.setProcessHandler(handler);
// The stored messages are sent to the newly-set process handler.
InOrder inOrder = Mockito.inOrder(handler);
inOrder.verify(handler).notifyTextAvailable("stdout1\n", STDOUT);
inOrder.verify(handler).notifyTextAvailable("stderr1\n", STDERR);
printer.stdout("stdout2");
// New messages are sent to the process handler.
verify(handler).notifyTextAvailable("stdout2\n", STDOUT);
}
use of com.intellij.execution.process.ProcessHandler in project intellij-plugins by JetBrains.
the class DartTestRunningState method execute.
@Override
@NotNull
public ExecutionResult execute(@NotNull final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = startProcess();
final ConsoleView consoleView = createConsole(getEnvironment());
consoleView.attachToProcess(processHandler);
final DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler, createActions(consoleView, processHandler, executor));
if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
DartConsoleProperties properties = (DartConsoleProperties) ((SMTRunnerConsoleView) consoleView).getProperties();
AbstractRerunFailedTestsAction rerunFailedTestsAction = properties.createRerunFailedTestsAction(consoleView);
assert rerunFailedTestsAction != null;
rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
} else {
executionResult.setRestartActions(new ToggleAutoTestAction());
}
return executionResult;
}
use of com.intellij.execution.process.ProcessHandler in project intellij-plugins by JetBrains.
the class FlexUnitRunConfiguration method getState.
@Override
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
final FlexBuildConfiguration bc;
try {
bc = myRunnerParameters.checkAndGetModuleAndBC(getProject()).second;
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e.getMessage());
}
final BuildConfigurationNature nature = bc.getNature();
if (nature.isDesktopPlatform() || nature.isMobilePlatform()) {
return new FlashRunConfiguration.AirRunState(getProject(), env, myRunnerParameters) {
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = startProcess();
final ExecutionConsole console = FlexBaseRunner.createFlexUnitRunnerConsole(getProject(), env, processHandler);
return new DefaultExecutionResult(console, processHandler);
}
};
}
return EmptyRunProfileState.INSTANCE;
}
use of com.intellij.execution.process.ProcessHandler 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.process.ProcessHandler in project intellij-plugins by JetBrains.
the class AdlUtil method runDebugger.
// http://kb2.adobe.com/cps/407/kb407625.html
public static void runDebugger(final Module module, final Runnable postTask) throws ExecutionException {
final Project project = module.getProject();
final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createConfiguration("FlashUIDesigner", RemoteFlashRunConfigurationType.getFactory());
final RemoteFlashRunConfiguration configuration = (RemoteFlashRunConfiguration) settings.getConfiguration();
RunManagerEx.disableTasks(project, settings.getConfiguration(), CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
ProgramRunner.Callback callback = new ProgramRunner.Callback() {
@Override
public void processStarted(final RunContentDescriptor descriptor) {
final ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
DesignerApplication application = DesignerApplicationManager.getApplication();
if (application != null) {
Disposer.register(application, new Disposable() {
@Override
public void dispose() {
if (!project.isDisposed()) {
ApplicationManager.getApplication().invokeLater(() -> ExecutionManager.getInstance(project).getContentManager().removeRunContent(executor, descriptor));
}
processHandler.destroyProcess();
}
});
postTask.run();
}
}
};
FlexBuildConfiguration buildConfiguration = FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration();
configuration.getRunnerParameters().setModuleName(module.getName());
configuration.getRunnerParameters().setBCName(buildConfiguration.getName());
final FlexRunner runner = new FlexRunner(callback, buildConfiguration);
runner.execute(new ExecutionEnvironment(executor, runner, settings, project));
}
Aggregations