use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class CompoundRunConfiguration method hasRunningSingletones.
protected boolean hasRunningSingletones() {
Project project = getProject();
if (project.isDisposed())
return false;
final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
return executionManager.getRunningDescriptors(s -> {
RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project);
for (RunConfiguration runConfiguration : mySetToRun) {
if (runConfiguration instanceof CompoundRunConfiguration && ((CompoundRunConfiguration) runConfiguration).hasRunningSingletones()) {
return true;
}
RunnerAndConfigurationSettings settings = manager.findConfigurationByTypeAndName(runConfiguration.getType().getId(), runConfiguration.getName());
if (settings != null && settings.isSingleton() && runConfiguration.equals(s.getConfiguration())) {
return true;
}
}
return false;
}).size() > 0;
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class CompoundRunConfiguration method getState.
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull final ExecutionEnvironment environment) throws ExecutionException {
try {
checkConfiguration();
} catch (RuntimeConfigurationException e) {
throw new ExecutionException(e.getMessage());
}
return new RunProfileState() {
@Nullable
@Override
public ExecutionResult execute(final Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
ApplicationManager.getApplication().invokeLater(() -> {
RunManagerImpl manager = RunManagerImpl.getInstanceImpl(getProject());
for (RunConfiguration configuration : getSetToRun()) {
RunnerAndConfigurationSettings settings = new RunnerAndConfigurationSettingsImpl(manager, configuration, false);
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(executor, settings);
if (builder != null) {
ExecutionManager.getInstance(getProject()).restartRunProfile(builder.activeTarget().dataContext(null).build());
}
}
});
return null;
}
};
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class ProjectStartupConfigurable method createNewWrapper.
private ChooseRunConfigurationPopup.ItemWrapper<Void> createNewWrapper(final AnActionButton button) {
return new ChooseRunConfigurationPopup.ItemWrapper<Void>(null) {
@Override
public Icon getIcon() {
return IconUtil.getAddIcon();
}
@Override
public String getText() {
return UIUtil.removeMnemonic(ExecutionBundle.message("add.new.run.configuration.acrtion.name"));
}
@Override
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
final ConfigurationType[] factories = runManager.getConfigurationFactories();
final Condition<ConfigurationType> filter = new Condition<ConfigurationType>() {
private final RunnerRegistry myRegistry = RunnerRegistry.getInstance();
@Override
public boolean value(ConfigurationType configurationType) {
ConfigurationFactory factory;
return !UnknownConfigurationType.INSTANCE.equals(configurationType) && ((factory = runManager.getFactory(configurationType.getId(), null)) != null) && myRegistry.getRunner(executor.getId(), runManager.getConfigurationTemplate(factory).getConfiguration()) != null;
}
};
final List<ConfigurationType> factoriesList = ContainerUtil.filter(Arrays.asList(factories), filter);
final ListPopup popup = NewRunConfigurationPopup.createAddPopup(factoriesList, "", factory -> ApplicationManager.getApplication().invokeLater(() -> {
final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project, factory);
if (dialog.showAndGet()) {
ApplicationManager.getApplication().invokeLater(() -> {
RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
if (configuration != null) {
addConfiguration(configuration);
}
}, ModalityState.any(), project.getDisposed());
}
}, ModalityState.any(), project.getDisposed()), null, EmptyRunnable.getInstance(), false);
showPopup(button, popup);
}
@Override
public boolean available(Executor executor) {
return true;
}
};
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class JavaRuntimeConfigurationProducerBase method setupConfigurationModule.
protected boolean setupConfigurationModule(@Nullable ConfigurationContext context, ModuleBasedConfiguration configuration) {
if (context != null) {
final RunnerAndConfigurationSettings template = ((RunManagerImpl) context.getRunManager()).getConfigurationTemplate(getConfigurationFactory());
final Module contextModule = context.getModule();
final Module predefinedModule = ((ModuleBasedConfiguration) template.getConfiguration()).getConfigurationModule().getModule();
if (predefinedModule != null) {
configuration.setModule(predefinedModule);
return true;
}
final Module module = findModule(configuration, contextModule);
if (module != null) {
configuration.setModule(module);
return true;
}
}
return false;
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class AbstractAutoTestManager method loadConfigurations.
public static List<RunConfiguration> loadConfigurations(State state, Project project) {
List<RunConfiguration> configurations = ContainerUtil.newArrayList();
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
List<RunConfigurationDescriptor> descriptors = ContainerUtil.notNullize(state.myEnabledRunConfigurations);
for (RunConfigurationDescriptor descriptor : descriptors) {
if (descriptor.myType != null && descriptor.myName != null) {
RunnerAndConfigurationSettings settings = runManager.findConfigurationByTypeAndName(descriptor.myType, descriptor.myName);
RunConfiguration configuration = settings != null ? settings.getConfiguration() : null;
if (configuration != null) {
configurations.add(configuration);
}
}
}
return configurations;
}
Aggregations