use of com.jetbrains.lang.dart.ide.runner.base.DartRunConfiguration in project intellij-plugins by JetBrains.
the class DartCommandLineRunningState method doStartProcess.
protected ProcessHandler doStartProcess(@Nullable final String overriddenMainFilePath) throws ExecutionException {
final GeneralCommandLine commandLine = createCommandLine(overriddenMainFilePath);
// Workaround for "Observatory listening on ..." message that is concatenated (without line break) with the message following it
final OSProcessHandler processHandler = new ColoredProcessHandler(commandLine) {
@Override
public void coloredTextAvailable(@NotNull String text, @NotNull Key attributes) {
if (text.startsWith(DartConsoleFilter.OBSERVATORY_LISTENING_ON)) {
text += "\n";
}
super.coloredTextAvailable(text, attributes);
}
};
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
final String prefix = DartConsoleFilter.OBSERVATORY_LISTENING_ON + "http://";
final String text = event.getText().trim();
if (text.startsWith(prefix)) {
processHandler.removeProcessListener(this);
final String url = "http://" + text.substring(prefix.length());
for (Consumer<String> consumer : myObservatoryUrlConsumers) {
consumer.consume(url);
}
}
}
});
// Check for and display any analysis errors when we launch a Dart app.
final Project project = getEnvironment().getProject();
try {
final DartRunConfiguration dartRunConfiguration = (DartRunConfiguration) getEnvironment().getRunProfile();
final VirtualFile launchFile = dartRunConfiguration.getRunnerParameters().getDartFileOrDirectory();
String launchTitle = "Analysis issues with " + dartRunConfiguration.getName();
DartExecutionHelper.displayIssues(project, launchFile, launchTitle, dartRunConfiguration.getIcon());
} catch (RuntimeConfigurationError error) {
DartExecutionHelper.clearIssueNotifications(project);
}
ProcessTerminatedListener.attach(processHandler, getEnvironment().getProject());
return processHandler;
}
use of com.jetbrains.lang.dart.ide.runner.base.DartRunConfiguration in project intellij-plugins by JetBrains.
the class DartTestRunningState method createConsole.
private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) {
final Project project = env.getProject();
final DartRunConfiguration runConfiguration = (DartRunConfiguration) env.getRunProfile();
final DartTestRunnerParameters runnerParameters = (DartTestRunnerParameters) runConfiguration.getRunnerParameters();
final TestConsoleProperties testConsoleProperties = new DartConsoleProperties(runConfiguration, env);
final ConsoleView consoleView = SMTestRunnerConnectionUtil.createConsole(DART_FRAMEWORK_NAME, testConsoleProperties);
try {
final VirtualFile dartFile = runnerParameters.getDartFileOrDirectory();
consoleView.addMessageFilter(new DartConsoleFilter(project, dartFile));
consoleView.addMessageFilter(new DartRelativePathsConsoleFilter(project, runnerParameters.computeProcessWorkingDirectory(project)));
consoleView.addMessageFilter(new UrlFilter());
} catch (RuntimeConfigurationError ignore) {
/* can't happen because already checked */
}
Disposer.register(project, consoleView);
return consoleView;
}
Aggregations