use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class RunContextAction method isEnabledAndVisible.
private Pair<Boolean, Boolean> isEnabledAndVisible(ConfigurationContext context) {
RunnerAndConfigurationSettings configuration = context.findExisting();
if (configuration == null) {
configuration = context.getConfiguration();
}
ProgramRunner runner = configuration == null ? null : getRunner(configuration.getConfiguration());
if (runner == null) {
return Pair.create(false, false);
}
return Pair.create(!ExecutorRegistry.getInstance().isStarting(context.getProject(), myExecutor.getId(), runner.getRunnerId()), true);
}
use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class ExecutionManagerImpl method createEnvironmentBuilder.
@NotNull
private static ExecutionEnvironmentBuilder createEnvironmentBuilder(@NotNull Project project, @NotNull Executor executor, @Nullable RunnerAndConfigurationSettings configuration) {
ExecutionEnvironmentBuilder builder = new ExecutionEnvironmentBuilder(project, executor);
ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executor.getId(), configuration != null ? configuration.getConfiguration() : null);
if (runner == null && configuration != null) {
LOG.error("Cannot find runner for " + configuration.getName());
} else if (runner != null) {
assert configuration != null;
builder.runnerAndSettings(runner, configuration);
}
return builder;
}
use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class RunConfigurationBeforeRunProvider method getAvailableConfigurations.
@NotNull
private static List<RunnerAndConfigurationSettings> getAvailableConfigurations(@NotNull RunConfiguration runConfiguration) {
Project project = runConfiguration.getProject();
if (project == null || !project.isInitialized()) {
return Collections.emptyList();
}
List<RunnerAndConfigurationSettings> configurations = new ArrayList<>(RunManagerImpl.getInstanceImpl(project).getSortedConfigurations());
String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
for (Iterator<RunnerAndConfigurationSettings> iterator = configurations.iterator(); iterator.hasNext(); ) {
RunnerAndConfigurationSettings settings = iterator.next();
ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
if (runner == null || settings.getConfiguration() == runConfiguration) {
iterator.remove();
}
}
return configurations;
}
use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class RunConfigurationBeforeRunProvider method canExecuteTask.
@Override
public boolean canExecuteTask(RunConfiguration configuration, RunConfigurableBeforeRunTask task) {
RunnerAndConfigurationSettings settings = task.getSettings();
if (settings == null) {
return false;
}
String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
final ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
return runner != null && runner.canRun(executorId, settings.getConfiguration());
}
use of com.intellij.execution.runners.ProgramRunner in project intellij-community by JetBrains.
the class ConfigurationSettingsEditor method init.
private void init() {
if (myCompound == null) {
myCompound = new SettingsEditorGroup<>();
Disposer.register(this, myCompound);
if (myConfigurationEditor instanceof SettingsEditorGroup) {
SettingsEditorGroup<RunConfiguration> group = (SettingsEditorGroup<RunConfiguration>) myConfigurationEditor;
List<Pair<String, SettingsEditor<RunConfiguration>>> editors = group.getEditors();
for (Pair<String, SettingsEditor<RunConfiguration>> pair : editors) {
myCompound.addEditor(pair.getFirst(), new ConfigToSettingsWrapper(pair.getSecond()));
}
} else {
myCompound.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new ConfigToSettingsWrapper(myConfigurationEditor));
}
myRunnersComponent = new RunnersEditorComponent();
final Executor[] executors = ExecutorRegistry.getInstance().getRegisteredExecutors();
for (final Executor executor : executors) {
ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executor.getId(), myConfiguration);
if (runner != null) {
JComponent perRunnerSettings = createCompositePerRunnerSettings(executor, runner);
if (perRunnerSettings != null) {
myRunnersComponent.addExecutorComponent(executor, perRunnerSettings);
}
}
}
if (myRunnerEditors.size() > 0) {
myCompound.addEditor(RUNNERS_TAB_NAME, new CompositeSettingsEditor<RunnerAndConfigurationSettings>(getFactory()) {
@Override
public CompositeSettingsBuilder<RunnerAndConfigurationSettings> getBuilder() {
return new CompositeSettingsBuilder<RunnerAndConfigurationSettings>() {
@Override
public Collection<SettingsEditor<RunnerAndConfigurationSettings>> getEditors() {
return myRunnerEditors;
}
@Override
public JComponent createCompoundEditor() {
return myRunnersComponent.getComponent();
}
};
}
});
}
}
}
Aggregations