use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class ConfigurationsTest method testExternalizeJUnitConfiguration.
public void testExternalizeJUnitConfiguration() {
Module module = getModule1();
JUnitConfiguration oldRc = createConfiguration(findTestA(module));
oldRc.setWorkingDirectory(module.getModuleFilePath());
RunManagerImpl runManager = new RunManagerImpl(myProject, new AppPropertiesComponentImpl());
Element element = new Element("configuration");
new RunnerAndConfigurationSettingsImpl(runManager, oldRc, false).writeExternal(element);
RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(runManager);
settings.readExternal(element);
JUnitConfiguration newRc = (JUnitConfiguration) settings.getConfiguration();
checkTestObject(oldRc.getPersistentData().TEST_OBJECT, newRc);
assertThat(newRc.getModules()).containsOnly(module);
checkClassName(oldRc.getPersistentData().getMainClassName(), newRc);
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class ProjectStartupTaskManager method getConfigurations.
private Collection<RunnerAndConfigurationSettings> getConfigurations(ProjectStartupConfigurationBase configuration) {
if (configuration.isEmpty())
return Collections.emptyList();
final List<RunnerAndConfigurationSettings> result = new ArrayList<>();
final List<ProjectStartupConfigurationBase.ConfigurationDescriptor> list = configuration.getList();
for (ProjectStartupConfigurationBase.ConfigurationDescriptor descriptor : list) {
final RunnerAndConfigurationSettings settings = ((RunManagerImpl) myRunManager).getConfigurationById(descriptor.getId());
if (settings != null && settings.getName().equals(descriptor.getName())) {
result.add(settings);
} else {
NOTIFICATION_GROUP.createNotification(PREFIX + " Run Configuration '" + descriptor.getName() + "' not found, removed from list.", MessageType.WARNING).notify(myProject);
}
}
return result;
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class ProjectStartupConfigurable method refreshDataUpdateSelection.
private void refreshDataUpdateSelection(RunnerAndConfigurationSettings settings) {
if (myTable.isEmpty())
return;
myModel.reValidateConfigurations(new Processor<RunnerAndConfigurationSettings>() {
private RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
@Override
public boolean process(RunnerAndConfigurationSettings settings) {
return runManager.getConfigurationById(settings.getUniqueID()) != null;
}
});
if (settings != null) {
final List<RunnerAndConfigurationSettings> configurations = myModel.getAllConfigurations();
for (int i = 0; i < configurations.size(); i++) {
final RunnerAndConfigurationSettings configuration = configurations.get(i);
if (configuration == settings) {
TableUtil.selectRows(myTable, new int[] { i });
return;
}
}
}
TableUtil.selectRows(myTable, new int[] { 0 });
myTable.getSelectionModel().setLeadSelectionIndex(0);
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class CompoundRunConfiguration method initIfNeed.
private void initIfNeed() {
if (myInitialized)
return;
mySetToRun.clear();
RunManagerImpl manager = RunManagerImpl.getInstanceImpl(getProject());
for (Pair<String, String> pair : myPairs) {
RunnerAndConfigurationSettings settings = manager.findConfigurationByTypeAndName(pair.first, pair.second);
if (settings != null && settings.getConfiguration() != this) {
mySetToRun.add(settings.getConfiguration());
}
}
myInitialized = true;
}
use of com.intellij.execution.impl.RunManagerImpl in project intellij-community by JetBrains.
the class AntConfigurationImpl method convertToBeforeRunTask.
private static void convertToBeforeRunTask(Project project, String buildFileUrl, String targetName, String configType, String configName) {
if (buildFileUrl == null || targetName == null || configType == null) {
return;
}
final RunManagerImpl runManager = (RunManagerImpl) RunManagerEx.getInstanceEx(project);
final ConfigurationType type = runManager.getConfigurationType(configType);
if (type == null) {
return;
}
if (configName != null) {
for (RunConfiguration configuration : runManager.getConfigurationsList(type)) {
if (configName.equals(configuration.getName())) {
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(configuration, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
} else {
for (ConfigurationFactory factory : type.getConfigurationFactories()) {
final RunConfiguration template = runManager.getConfigurationTemplate(factory).getConfiguration();
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(template, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
}
Aggregations