Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2013-04-22 17:20:09 -0400
committerAndrew Gvozdev2013-04-23 18:08:02 -0400
commit29c5392beea9a8dff7faefebdbc713aef23c265d (patch)
tree83d0832e812d77729860b06eb13754b79c55afd8 /build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder
parent9002a13eb1593dcd236afe93b7015518b768798c (diff)
downloadorg.eclipse.cdt-29c5392beea9a8dff7faefebdbc713aef23c265d.tar.gz
org.eclipse.cdt-29c5392beea9a8dff7faefebdbc713aef23c265d.tar.xz
org.eclipse.cdt-29c5392beea9a8dff7faefebdbc713aef23c265d.zip
bug 395545: Import of predefined configuration misses language settings providers
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewCfgDialog.java49
1 files changed, 32 insertions, 17 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewCfgDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewCfgDialog.java
index 2a2e3768d6..1ea96c042a 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewCfgDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewCfgDialog.java
@@ -15,9 +15,14 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
+import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
@@ -545,12 +550,12 @@ public class NewCfgDialog implements INewCfgDialog {
if (imp == null || !(imp instanceof ManagedProject)) return;
ManagedProject mp = (ManagedProject) imp;
try {
- ICConfigurationDescription cfgDes = null;
- Configuration config = new Configuration(mp, (Configuration)parentConfig, id, false, true);
+ ICConfigurationDescription cfgDescription = null;
+ Configuration cfg = new Configuration(mp, (Configuration)parentConfig, id, false, true);
if (b_cloneFromProject.getSelection()) {
ICConfigurationDescription base = ManagedBuildManager.getDescriptionForConfiguration(parentConfig);
- cfgDes = des.createConfiguration(id, newName, base);
- cfgDes.setDescription(newDescription);
+ cfgDescription = des.createConfiguration(id, newName, base);
+ cfgDescription.setDescription(newDescription);
} else if (b_importFromOtherProject.getSelection()) {
IResource owner = parentConfig.getOwner();
if (owner!=null) {
@@ -558,29 +563,39 @@ public class NewCfgDialog implements INewCfgDialog {
ICProjectDescription prjDesOther = CCorePlugin.getDefault().getProjectDescription(owner.getProject(), true);
ICConfigurationDescription base = prjDesOther.getConfigurationByName(parentConfig.getName());
if (base != null) {
- cfgDes = des.createConfiguration(id, newName, base);
- cfgDes.setDescription(newDescription);
+ cfgDescription = des.createConfiguration(id, newName, base);
+ cfgDescription.setDescription(newDescription);
}
}
}
- if (cfgDes == null) {
+ if (cfgDescription == null) {
// when "Default" or "Predefined" selected or import from other project failed
- CConfigurationData data = config.getConfigurationData();
- cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+ CConfigurationData data = cfg.getConfigurationData();
+ cfgDescription = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+
+ if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
+ String[] defaultIds = cfg.getDefaultLanguageSettingsProviderIds();
+ if (defaultIds == null) {
+ defaultIds = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(cfgDescription);
+ }
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setDefaultLanguageSettingsProvidersIds(defaultIds);
+ List<ILanguageSettingsProvider> providers = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+ }
}
- if (cfgDes != null) {
- config.setConfigurationDescription(cfgDes);
- config.setName(newName);
- config.setDescription(newDescription);
+ if (cfgDescription != null) {
+ cfg.setConfigurationDescription(cfgDescription);
+ cfg.setName(newName);
+ cfg.setDescription(newDescription);
- String target = config.getArtifactName();
+ String target = cfg.getArtifactName();
if (target == null || target.length() == 0)
- config.setArtifactName(mp.getDefaultArtifactName());
+ cfg.setArtifactName(mp.getDefaultArtifactName());
// Export artifact info as needed by project references
- config.exportArtifactInfo();
+ cfg.exportArtifactInfo();
}
- if (cfgDes == null) {
+ if (cfgDescription == null) {
throw new CoreException(new Status(IStatus.ERROR,
"org.eclipse.cdt.managedbuilder.ui", -1, //$NON-NLS-1$
Messages.NewCfgDialog_2, null));

Back to the top