use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class RunnerAndConfigurationSettingsImpl method checkSettings.
@Override
public void checkSettings(@Nullable Executor executor) throws RuntimeConfigurationException {
myConfiguration.checkConfiguration();
if (myConfiguration instanceof RunConfigurationBase) {
final RunConfigurationBase runConfigurationBase = (RunConfigurationBase) myConfiguration;
Set<ProgramRunner> runners = new THashSet<>();
runners.addAll(myRunnerSettings.settings.keySet());
runners.addAll(myConfigurationPerRunnerSettings.settings.keySet());
for (ProgramRunner runner : runners) {
if (executor == null || runner.canRun(executor.getId(), myConfiguration)) {
runConfigurationBase.checkRunnerSettings(runner, myRunnerSettings.settings.get(runner), myConfigurationPerRunnerSettings.settings.get(runner));
}
}
if (executor != null) {
runConfigurationBase.checkSettingsBeforeRun();
}
}
}
use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class RunnerAndConfigurationSettingsImpl method importFromTemplate.
@SuppressWarnings("deprecation")
private <T> void importFromTemplate(@NotNull RunnerItem<T> templateItem, @NotNull RunnerItem<T> item) {
for (ProgramRunner runner : templateItem.settings.keySet()) {
T data = item.createSettings(runner);
item.settings.put(runner, data);
if (data != null) {
Element temp = new Element(DUMMY_ELEMENT_NAME);
T templateSettings = templateItem.settings.get(runner);
if (templateSettings != null) {
try {
((JDOMExternalizable) templateSettings).writeExternal(temp);
((JDOMExternalizable) data).readExternal(temp);
} catch (WriteExternalException | InvalidDataException e) {
LOG.error(e);
}
}
}
}
}
use of com.intellij.execution.runners.ProgramRunner 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.runners.ProgramRunner 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.runners.ProgramRunner in project intellij-plugins by JetBrains.
the class CfmlUnitRunConfiguration method getState.
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
return new RunProfileState() {
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = new MyProcessHandler();
final ConsoleView console = createConsole(getProject(), processHandler, env, executor);
console.addMessageFilter(new CfmlStackTraceFilterProvider(getProject()));
// processHandler.startNotify();
runTests(processHandler);
return new DefaultExecutionResult(console, processHandler);
}
};
}
Aggregations