use of com.intellij.execution.process.ProcessAdapter in project intellij-plugins by JetBrains.
the class RubyMotionUtilImpl method generateApp.
public void generateApp(final VirtualFile dir, final Module module, Sdk sdk, final ProjectType projectType) {
final Project project = module.getProject();
final String applicationHomePath = dir.getPath();
final File tempDirectory;
try {
tempDirectory = FileUtil.createTempDirectory("RubyMotion", ".RubyMine");
} catch (IOException e) {
throw new Error(e);
}
final File generatedApp = new File(tempDirectory, module.getName());
final Filter[] filters = null;
final ProcessAdapter processListener = new ProcessAdapter() {
public void processTerminated(ProcessEvent event) {
FileUtil.moveDirWithContent(generatedApp, VfsUtilCore.virtualToIoFile(dir));
tempDirectory.delete();
if (module.isDisposed()) {
return;
}
RModuleUtil.getInstance().refreshRubyModuleTypeContent(module);
GeneratorsUtil.openFileInEditor(project, "app/app_delegate.rb", applicationHomePath);
GeneratorsUtil.openFileInEditor(project, RakeUtilBase.RAKE_FILE, applicationHomePath);
GeneratorsUtil.openFileInEditor(project, BundlerUtil.GEMFILE, applicationHomePath);
}
};
final MergingCommandLineArgumentsProvider resultProvider = new MergingCommandLineArgumentsProvider(new String[] { getRubyMotionPath() + "/bin/motion", "create", "--template=" + projectType.name().toLowerCase(Locale.US), module.getName() }, null, null, null, sdk);
ConsoleRunner.run(module, null, processListener, filters, null, ConsoleRunner.ProcessLaunchMode.BACKGROUND_TASK_WITH_PROGRESS, "Generating RubyMotion Application '" + module.getName() + "'...", tempDirectory.getAbsolutePath(), resultProvider, null, false);
}
use of com.intellij.execution.process.ProcessAdapter 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.ProcessAdapter in project buck by facebook.
the class BuckToGeneralTestEventsConverter method onStartTesting.
@Override
public void onStartTesting() {
mConnection = mProject.getMessageBus().connect();
mConnection.subscribe(TestResultsAvailableConsumer.BUCK_TEST_RESULTS_AVAILABLE, this);
mConnection.subscribe(TestRunCompleteConsumer.BUCK_TEST_RUN_COMPLETE, this);
mConnection.subscribe(TestRunStartedConsumer.BUCK_TEST_RUN_STARTED, this);
mConnection.subscribe(BuckBuildStartConsumer.BUCK_BUILD_START, this);
mConnection.subscribe(BuckBuildEndConsumer.BUCK_BUILD_END, this);
mConnection.subscribe(CompilerErrorConsumer.COMPILER_ERROR_CONSUMER, this);
myHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
mConnection.disconnect();
}
});
}
use of com.intellij.execution.process.ProcessAdapter in project intellij-leiningen-plugin by derkork.
the class LeiningenRunConfigurationType method runConfiguration.
public static void runConfiguration(Project project, LeiningenRunnerParameters params, DataContext context) {
RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(params, project);
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(DefaultRunExecutor.EXECUTOR_ID);
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);
try {
runner.execute(env, new ProgramRunner.Callback() {
public void processStarted(RunContentDescriptor runContentDescriptor) {
final ProcessHandler runContentDescriptorProcessHandler = runContentDescriptor.getProcessHandler();
if (runContentDescriptorProcessHandler != null) {
runContentDescriptorProcessHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
LocalFileSystem.getInstance().refreshWithoutFileWatcher(true);
}
});
}
}
});
} catch (ExecutionException e) {
}
}
use of com.intellij.execution.process.ProcessAdapter in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoBeforeRunTaskProvider method executeTask.
@Override
public boolean executeTask(DataContext context, RunConfiguration configuration, ExecutionEnvironment env, GoCommandBeforeRunTask task) {
Semaphore done = new Semaphore();
Ref<Boolean> result = Ref.create(false);
GoRunConfigurationBase goRunConfiguration = (GoRunConfigurationBase) configuration;
Module module = goRunConfiguration.getConfigurationModule().getModule();
Project project = configuration.getProject();
String workingDirectory = goRunConfiguration.getWorkingDirectory();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (StringUtil.isEmpty(task.getCommand()))
return;
if (project == null || project.isDisposed())
return;
GoSdkService sdkService = GoSdkService.getInstance(project);
if (!sdkService.isGoModule(module))
return;
done.down();
GoExecutor.in(module).withParameterString(task.getCommand()).withWorkDirectory(workingDirectory).showOutputOnError().showNotifications(false, true).withPresentableName("Executing `" + task + "`").withProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
done.up();
result.set(event.getExitCode() == 0);
}
}).executeWithProgress(false, result1 -> VirtualFileManager.getInstance().asyncRefresh(null));
}
});
done.waitFor();
return result.get();
}
Aggregations