use of com.intellij.execution.configurations.ConfigurationType 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);
}
}
}
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class AbstractRunConfigurationTypeUsagesCollector method getProjectUsages.
@NotNull
@Override
public final Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) {
final Set<String> runConfigurationTypes = new HashSet<>();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (project.isDisposed())
return;
final RunManager runManager = RunManager.getInstance(project);
for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
RunConfiguration runConfiguration = settings.getConfiguration();
if (runConfiguration != null && isApplicable(runManager, settings)) {
final ConfigurationFactory configurationFactory = runConfiguration.getFactory();
final ConfigurationType configurationType = configurationFactory.getType();
final StringBuilder keyBuilder = new StringBuilder();
keyBuilder.append(configurationType.getId());
if (configurationType.getConfigurationFactories().length > 1) {
keyBuilder.append(".").append(configurationFactory.getName());
}
runConfigurationTypes.add(keyBuilder.toString());
}
}
}
});
return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1));
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class ConfigurationTypeDashboardGroupingRule method getGroup.
@Nullable
@Override
public DashboardGroup getGroup(AbstractTreeNode<?> node) {
if (node instanceof DashboardRunConfigurationNode) {
RunnerAndConfigurationSettings configurationSettings = ((DashboardRunConfigurationNode) node).getConfigurationSettings();
ConfigurationType type = configurationSettings.getType();
if (type != null) {
return new DashboardGroupImpl<>(type, type.getDisplayName(), type.getIcon());
}
}
return null;
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class PluginProjectWizardTest method testPluginProject.
public void testPluginProject() throws Exception {
createSdk("devkit", IdeaJdk.getInstance());
Project project = createProjectFromTemplate(PluginModuleType.getInstance().getName(), null, null);
VirtualFile virtualFile = project.getBaseDir().findFileByRelativePath("resources/META-INF/plugin.xml");
assertNotNull(virtualFile);
RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
assertNotNull(configuration);
ConfigurationType type = configuration.getType();
assertNotNull(type);
assertEquals(DevKitBundle.message("run.configuration.title"), type.getDisplayName());
VirtualFile[] files = FileEditorManager.getInstance(project).getOpenFiles();
assertEquals(1, files.length);
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class RecentTestsListProvider method initRunConfigurationsMap.
private void initRunConfigurationsMap() {
RunManagerEx manager = RunManagerEx.getInstanceEx(myProject);
ConfigurationType[] types = manager.getConfigurationFactories();
for (ConfigurationType type : types) {
Map<String, List<RunnerAndConfigurationSettings>> structure = manager.getStructure(type);
for (Map.Entry<String, List<RunnerAndConfigurationSettings>> e : structure.entrySet()) {
for (RunnerAndConfigurationSettings settings : e.getValue()) {
myConfigurationsMap.put(settings.getName().hashCode(), settings);
}
}
}
}
Aggregations