diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index 3c02054c2da..e836c0d0e41 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -545,12 +545,14 @@
+ page="org.eclipse.cdt.make.internal.ui.preferences.GCCBuildCommandParserOptionPage"
+ shared="false">
+ page="org.eclipse.cdt.make.internal.ui.scannerconfig.BuiltinSpecsDetectorOptionPage"
+ shared="true">
+ icon="icons/obj16/mbs.gif"
+ shared="true">
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 4cbf7d648df..82eb6ddbfff 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -3805,7 +3805,8 @@
+ icon="icons/obj16/person-me.gif"
+ shared="false">
diff --git a/core/org.eclipse.cdt.ui/schema/LanguageSettingsProviderAssociation.exsd b/core/org.eclipse.cdt.ui/schema/LanguageSettingsProviderAssociation.exsd
index 2c14696be15..fbb578b8b20 100644
--- a/core/org.eclipse.cdt.ui/schema/LanguageSettingsProviderAssociation.exsd
+++ b/core/org.eclipse.cdt.ui/schema/LanguageSettingsProviderAssociation.exsd
@@ -77,6 +77,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -112,6 +133,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java
index d936509f9c9..b21baff9ce4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java
@@ -29,12 +29,18 @@ public class LanguageSettingsProviderAssociationManager {
private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
private static final String ATTR_ICON = "icon"; //$NON-NLS-1$
private static final String ATTR_PAGE = "page"; //$NON-NLS-1$
+ private static final String ATTR_SHARED = "shared"; //$NON-NLS-1$
+ private static final String ATTR_UI_CLEAR_ENTRIES = "ui-clear-entries"; //$NON-NLS-1$
+ private static final String ATTR_UI_EDIT_ENTRIES = "ui-edit-entries"; //$NON-NLS-1$
- static private List loadedIcons = null;
- static private Map fImagesUrlById = null;
- static private Map fImagesUrlByClass = null;
- static private List fRegirestedIds = null;
- static private List fRegisteredClasses = null;
+ private static List loadedIcons = null;
+ private static Map fImagesUrlById = null;
+ private static Map fImagesUrlByClass = null;
+ private static List fRegirestedIds = null;
+ private static List fRegisteredClasses = null;
+
+ private static Map> fAssociationsById = null;
+ private static Map> fAssociationsByClass = null;
private static void loadExtensions() {
if (loadedIcons!=null) {
@@ -46,6 +52,9 @@ public class LanguageSettingsProviderAssociationManager {
if (fRegirestedIds==null) fRegirestedIds = new ArrayList();
if (fRegisteredClasses==null) fRegisteredClasses = new ArrayList();
+ if (fAssociationsById==null) fAssociationsById = new HashMap>();
+ if (fAssociationsByClass==null) fAssociationsByClass = new HashMap>();
+
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, LANGUAGE_SETTINGS_PROVIDER_UI);
if (extension != null) {
@@ -59,14 +68,28 @@ public class LanguageSettingsProviderAssociationManager {
URL url = getIconUrl(cfgEl);
fImagesUrlById.put(id, url);
fRegirestedIds.add(id);
+
+ Map properties = new HashMap();
+ sensiblePut(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE));
+ sensiblePut(properties, ATTR_SHARED, cfgEl.getAttribute(ATTR_SHARED));
+ sensiblePut(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES));
+ sensiblePut(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES));
+ fAssociationsById.put(id, properties);
} else if (cfgEl.getName().equals(ELEM_CLASS_ASSOCIATION)) {
String className = cfgEl.getAttribute(ATTR_CLASS);
URL url = getIconUrl(cfgEl);
fImagesUrlByClass.put(className, url);
String pageClass = cfgEl.getAttribute(ATTR_PAGE);
- if (pageClass!=null && pageClass.trim().length()>0) {
+ if (pageClass!=null && pageClass.length()>0) {
fRegisteredClasses.add(className);
}
+
+ Map properties = new HashMap();
+ sensiblePut(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE));
+ sensiblePut(properties, ATTR_SHARED, cfgEl.getAttribute(ATTR_SHARED));
+ sensiblePut(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES));
+ sensiblePut(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES));
+ fAssociationsByClass.put(className, properties);
}
}
}
@@ -74,6 +97,11 @@ public class LanguageSettingsProviderAssociationManager {
}
+ private static void sensiblePut(Map properties, String key, String value) {
+ if (value != null)
+ properties.put(key, value);
+ }
+
private static URL getIconUrl(IConfigurationElement config) {
URL url = null;
try {
@@ -242,5 +270,66 @@ public class LanguageSettingsProviderAssociationManager {
return optionsPage;
}
+ /**
+ * Returns TODO for id or closest superclass.
+ * @param provider TODO
+ * @return TODO
+ */
+ private static boolean getBooleanAttribute(ILanguageSettingsProvider provider, String attr) {
+ loadExtensions();
+
+ String id = provider.getId();
+
+ Map properties = fAssociationsById.get(id);
+ if (properties != null) {
+ return Boolean.parseBoolean(properties.get(attr));
+ }
+
+ for (Class> clazz=provider.getClass();clazz!=null;clazz=clazz.getSuperclass()) {
+ String className = clazz.getCanonicalName();
+ properties = fAssociationsByClass.get(className);
+ if (properties != null) {
+ return Boolean.parseBoolean(properties.get(attr));
+ }
+
+ // this does not check for superinterfaces, feel free to implement as needed
+ for (Class> iface : clazz.getInterfaces()) {
+ String interfaceName = iface.getCanonicalName();
+ properties = fAssociationsByClass.get(interfaceName);
+ if (properties != null) {
+ return Boolean.parseBoolean(properties.get(attr));
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Returns TODO for id or closest superclass.
+ * @param provider TODO
+ * @return TODO
+ */
+ public static boolean shouldBeShared(ILanguageSettingsProvider provider) {
+ return getBooleanAttribute(provider, ATTR_SHARED);
+ }
+
+ /**
+ * Returns TODO for id or closest superclass.
+ * @param provider TODO
+ * @return TODO
+ */
+ public static boolean isToClear(ILanguageSettingsProvider provider) {
+ return getBooleanAttribute(provider, ATTR_UI_CLEAR_ENTRIES);
+ }
+
+ /**
+ * Returns TODO for id or closest superclass.
+ * @param provider TODO
+ * @return TODO
+ */
+ public static boolean isToEditEntries(ILanguageSettingsProvider provider) {
+ return getBooleanAttribute(provider, ATTR_UI_EDIT_ENTRIES);
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java
index 7bb4f148bf7..186e4b4553b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java
@@ -118,7 +118,6 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
private Button enableProvidersCheckBox;
private StatusMessageLine fStatusLine;
- private Button globalProviderCheckBox = null;
private Link linkWorkspacePreferences = null;
private Button projectStorageCheckBox = null;
@@ -303,9 +302,35 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
tableProvidersViewer.addCheckStateListener(new ICheckStateListener() {
@Override
- public void checkStateChanged(CheckStateChangedEvent e) {
- saveCheckedProviders(e.getElement());
- tableProvidersViewer.update(e.getElement(), null);
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ // TODO: clean-up - too many manipulations in this method
+
+ ILanguageSettingsProvider provider = (ILanguageSettingsProvider) event.getElement();
+ saveCheckedProviders(provider);
+
+ int pos = presentedProviders.indexOf(provider);
+ tableProviders.setSelection(pos);
+
+ if (event.getChecked() && LanguageSettingsManager.isWorkspaceProvider(provider)) {
+ ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider);
+ if (!LanguageSettingsProviderAssociationManager.shouldBeShared(rawProvider)) {
+ // Switch to local provider instance
+ try {
+ if (rawProvider instanceof ILanguageSettingsEditableProvider) {
+ provider = ((ILanguageSettingsEditableProvider) rawProvider).cloneShallow();
+ }
+ } catch (CloneNotSupportedException e) {
+ CUIPlugin.log("Error cloning provider " + provider.getId(), e);
+ }
+
+ replaceSelectedProvider(provider);
+ ICConfigurationDescription cfgDescription = getConfigurationDescription();
+ initializeOptionsPage(provider, cfgDescription);
+ displaySelectedOptionPage();
+ }
+ }
+
+ tableProvidersViewer.update(provider, null);
}});
createOptionsControl();
@@ -331,37 +356,6 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
return link;
}
- // Called from globalProviderCheckBox listener
- private ILanguageSettingsProvider toggleGlobalProvider(ILanguageSettingsProvider oldProvider, boolean toGlobal) {
- ILanguageSettingsProvider newProvider = null;
-
- String id = oldProvider.getId();
- if (toGlobal) {
- newProvider = LanguageSettingsManager.getWorkspaceProvider(id);
- } else {
- // Local provider instance chosen
- try {
- ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(oldProvider);
- if (rawProvider instanceof ILanguageSettingsEditableProvider) {
- newProvider = ((ILanguageSettingsEditableProvider) rawProvider).cloneShallow();
- }
- } catch (CloneNotSupportedException e) {
- CUIPlugin.log("Error cloning provider " + oldProvider.getId(), e);
- }
- }
- if (newProvider!=null) {
- replaceSelectedProvider(newProvider);
-
- ICConfigurationDescription cfgDescription = getConfigurationDescription();
- initializeOptionsPage(newProvider, cfgDescription);
- displaySelectedOptionPage();
- } else {
- newProvider = oldProvider;
- }
-
- return newProvider;
- }
-
private void replaceSelectedProvider(ILanguageSettingsProvider newProvider) {
int pos = tableProviders.getSelectionIndex();
presentedProviders.set(pos, newProvider);
@@ -394,28 +388,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
groupOptionsPage.setLayout(new GridLayout(2, false));
if (!page.isForPrefs()) {
- if (globalProviderCheckBox==null) {
- globalProviderCheckBox = new Button(groupOptionsPage, SWT.CHECK);
- globalProviderCheckBox.setText("Share setting entries between projects (global provider)");
- globalProviderCheckBox.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isGlobal = globalProviderCheckBox.getSelection();
- ILanguageSettingsProvider provider = getSelectedProvider();
- if (isGlobal != LanguageSettingsManager.isWorkspaceProvider(provider)) {
- provider = toggleGlobalProvider(provider, isGlobal);
- }
- projectStorageCheckBox.setSelection(provider instanceof LanguageSettingsSerializableProvider
- && LanguageSettingsManager.isStoringEntriesInProjectArea((LanguageSettingsSerializableProvider) provider));
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
-
+ if (projectStorageCheckBox == null) {
projectStorageCheckBox = new Button(groupOptionsPage, SWT.CHECK);
projectStorageCheckBox.setText("Store entries in project settings folder (supporting project miration)");
projectStorageCheckBox.addSelectionListener(new SelectionAdapter() {
@@ -603,11 +576,6 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
boolean isChecked = tableProvidersViewer.getChecked(provider);
if (!page.isForPrefs()) {
- boolean isRawProviderEditable = rawProvider instanceof ILanguageSettingsEditableProvider;
- globalProviderCheckBox.setSelection(isGlobal);
- globalProviderCheckBox.setEnabled(isChecked && isRawProviderEditable);
- globalProviderCheckBox.setVisible(provider!=null);
-
projectStorageCheckBox.setEnabled(!isGlobal);
projectStorageCheckBox.setVisible(rawProvider instanceof LanguageSettingsSerializableProvider);
projectStorageCheckBox.setSelection(provider instanceof LanguageSettingsSerializableProvider