use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.
the class KarmaServerRestarter method onRunnerExecutionStarted.
public void onRunnerExecutionStarted(@NotNull final OSProcessHandler processHandler) {
myActiveRunners.incrementAndGet();
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
myActiveRunners.decrementAndGet();
processHandler.removeProcessListener(this);
}
});
}
use of com.intellij.execution.process.ProcessEvent in project flutter-intellij by flutter.
the class OpenInAndroidStudioAction method openFileInStudio.
private static void openFileInStudio(@NotNull VirtualFile file, @NotNull String androidStudioPath) {
try {
final GeneralCommandLine cmd;
if (SystemInfo.isMac) {
cmd = new GeneralCommandLine().withExePath("open").withParameters("-a", androidStudioPath, file.getPath());
} else {
cmd = new GeneralCommandLine().withExePath(androidStudioPath).withParameters(file.getPath());
}
final OSProcessHandler handler = new OSProcessHandler(cmd);
handler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull final ProcessEvent event) {
if (event.getExitCode() != 0) {
FlutterMessages.showError("Error Opening", file.getPath());
}
}
});
handler.startNotify();
} catch (ExecutionException ex) {
FlutterMessages.showError("Error Opening", "Exception: " + ex.getMessage());
}
}
use of com.intellij.execution.process.ProcessEvent in project flutter-intellij by flutter.
the class OpenInXcodeAction method openFile.
private static void openFile(@NotNull VirtualFile file) {
final Project project = ProjectUtil.guessProjectForFile(file);
final FlutterSdk sdk = project != null ? FlutterSdk.getFlutterSdk(project) : null;
if (sdk == null) {
FlutterSdkAction.showMissingSdkDialog(project);
return;
}
final PubRoot pubRoot = PubRoot.forFile(file);
if (pubRoot == null) {
FlutterMessages.showError("Error Opening Xcode", "Unable to run `flutter build` (no pub root found)");
return;
}
// Trigger an iOS build if necessary.
if (!hasBeenBuilt(pubRoot)) {
final ProgressHelper progressHelper = new ProgressHelper(project);
progressHelper.start("Building for iOS");
sdk.flutterBuild(pubRoot, "ios", "--debug").start(null, new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
progressHelper.done();
if (event.getExitCode() != 0) {
FlutterMessages.showError("Error Opening Xcode", "`flutter build` returned: " + event.getExitCode());
return;
}
openWithXcode(file.getPath());
}
});
} else {
openWithXcode(file.getPath());
}
}
use of com.intellij.execution.process.ProcessEvent in project flutter-intellij by flutter.
the class FlutterApp method start.
/**
* Creates a process that will launch the flutter app.
* <p>
* (Assumes we are launching it in --machine mode.)
*/
@NotNull
public static FlutterApp start(@NotNull ExecutionEnvironment env, @NotNull Project project, @Nullable Module module, @NotNull RunMode mode, @NotNull FlutterDevice device, @NotNull GeneralCommandLine command, @NotNull String analyticsStart, @NotNull String analyticsStop) throws ExecutionException {
LOG.info(analyticsStart + " " + project.getName() + " (" + mode.mode() + ")");
LOG.info(command.toString());
final ProcessHandler process = new OSProcessHandler(command);
Disposer.register(project, process::destroyProcess);
// Send analytics for the start and stop events.
FlutterInitializer.sendAnalyticsAction(analyticsStart);
final DaemonApi api = new DaemonApi(process);
final FlutterApp app = new FlutterApp(project, module, mode, device, process, env, api);
process.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
LOG.info(analyticsStop + " " + project.getName() + " (" + mode.mode() + ")");
FlutterInitializer.sendAnalyticsAction(analyticsStop);
// Send analytics about whether this session used the reload workflow, the restart workflow, or neither.
final String workflowType = app.reloadCount > 0 ? "reload" : (app.restartCount > 0 ? "restart" : "none");
FlutterInitializer.getAnalytics().sendEvent("workflow", workflowType);
}
});
api.listen(process, new io.flutter.run.daemon.FlutterAppListener(app, project));
return app;
}
use of com.intellij.execution.process.ProcessEvent in project ballerina by ballerina-lang.
the class BallerinaTestRunningState method startProcess.
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
ProcessHandler processHandler = super.startProcess();
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void startNotified(ProcessEvent event) {
if (myHistoryProcessHandler != null) {
myHistoryProcessHandler.apply(processHandler);
}
}
});
return processHandler;
}
Aggregations