diff options
9 files changed, 278 insertions, 92 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java index 1df00d08f76..13f87f2dcb1 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.managedbuilder.core.tests; -import java.io.File; -import java.io.IOException; import java.util.Arrays; import java.util.Map; import java.util.Properties; @@ -24,7 +22,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoProvider; -import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; @@ -202,26 +199,6 @@ public class ManagedBuildCoreTests20 extends TestCase { /** - * Convert path to OS specific representation - */ - private String toOSLocation(String path) { - File file = new File(path); - try { - path = file.getCanonicalPath(); - } catch (IOException e) { - } - - return path; - } - - /** - * Convert path to OS specific representation - */ - private String toOSString(String path) { - return new Path(path).toOSString(); - } - - /** * The purpose of this test is to exercise the build path info interface. * To get to that point, a new project/config has to be created in the test * project and the default configuration changed. @@ -241,38 +218,18 @@ public class ManagedBuildCoreTests20 extends TestCase { } //These are the expected path settings - IPath buildCWD = project.getLocation().append("Sub Config"); - - final String[] expectedPaths; - if (new Path("C:\\home\\tester/include").isAbsolute()) { - // Windows - expectedPaths = new String[] { - toOSLocation("/usr/include"), - toOSLocation("/opt/gnome/include"), - toOSLocation("C:\\home\\tester/include"), - // relative paths from MBS will make 3 entries - project.getLocation().append("includes").toOSString(), - buildCWD.append("includes").toOSString(), - toOSString("includes"), - "/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED - }; - } else { - // Unix - expectedPaths = new String[] { - toOSLocation("/usr/include"), - toOSLocation("/opt/gnome/include"), - // on unix "C:\\home\\tester/include" is relative path - // looks like nonsense but has to be this way as MBS converts entry to keep "Sub Config/C:\\home\\tester/include" in its storage - project.getLocation().append("Sub Config/C:\\home\\tester/include").toOSString(), - buildCWD.append("Sub Config/C:\\home\\tester/include").toOSString(), - toOSString("Sub Config/C:\\home\\tester/include"), - // relative paths from MBS will make 3 entries - project.getLocation().append("includes").toOSString(), - buildCWD.append("includes").toOSString(), - toOSString("includes"), - "/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED - }; - } + final String[] expectedPaths = new String[5]; + + // This first path is a built-in, so it will not be manipulated by build manager + expectedPaths[0] = (new Path("/usr/include")).toOSString(); + expectedPaths[1] = (new Path("/opt/gnome/include")).toOSString(); + IPath path = new Path("C:\\home\\tester/include"); + if(path.isAbsolute()) // for win32 path is treated as absolute + expectedPaths[2] = path.toOSString(); + else // for Linux path is relative + expectedPaths[2] = project.getLocation().append("Sub Config").append(path).toOSString(); + expectedPaths[3] = project.getLocation().append( "includes" ).toOSString(); + expectedPaths[4] = (new Path("/usr/gnu/include")).toOSString(); // Create a new managed project based on the sub project type IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub"); @@ -324,7 +281,6 @@ public class ManagedBuildCoreTests20 extends TestCase { // Find the first IScannerInfoProvider that supplies build info for the project IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project); assertNotNull(provider); - assertTrue(provider instanceof LanguageSettingsScannerInfoProvider); // Now subscribe (note that the method will be called after a change provider.subscribe(project, new IScannerInfoChangeListener () { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java index 2ac8defa26c..dfdc1d17ac1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2009, 2011 Andrew Gvozdev and others.
+ * Copyright (c) 2009, 2013 Andrew Gvozdev and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.internal.core.LocalProjectScope;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
+import org.eclipse.cdt.internal.core.language.settings.providers.ScannerInfoExtensionLanguageSettingsProvider;
+import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
@@ -42,6 +44,8 @@ public class ScannerDiscoveryLegacySupport { public static final String USER_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.ui.UserLanguageSettingsProvider"; //$NON-NLS-1$
/** ID of MBS language settings provider (from org.eclipse.cdt.managedbuilder.core) */
public static final String MBS_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"; //$NON-NLS-1$
+ /** ID of ScannerInfo language settings provider wrapping ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point */
+ private static final String SI_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.core.LegacyScannerInfoLanguageSettingsProvider"; //$NON-NLS-1$
private static String DISABLE_LSP_PREFERENCE = "language.settings.providers.disabled"; //$NON-NLS-1$
// the default for project needs to be "disabled" - for legacy projects to be open with old SD enabled for MBS provider
@@ -156,15 +160,60 @@ public class ScannerDiscoveryLegacySupport { }
/**
- * Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility).
+ * Return list containing User provider and one of wrapper providers to support legacy projects (backward compatibility).
+ *
+ * @noreference This is internal helper method to support compatibility with previous versions
+ * which is not intended to be referenced by clients.
+ * @since 5.5
+ */
+ public static String[] getDefaultProviderIdsLegacy(ICConfigurationDescription cfgDescription) {
+ boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null;
+ if (useScannerInfoProviderExtension) {
+ return new String[] {USER_LANGUAGE_SETTINGS_PROVIDER_ID, SI_LANGUAGE_SETTINGS_PROVIDER_ID};
+ }
+ if (CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription)) {
+ return new String[] {USER_LANGUAGE_SETTINGS_PROVIDER_ID, MBS_LANGUAGE_SETTINGS_PROVIDER_ID};
+ }
+ return null;
+
+ }
+
+ /**
+ * Checks if the provider is applicable for configuration from backward compatibility point of view
+ *
+ * @noreference This is internal helper method to support compatibility with previous versions
+ * which is not intended to be referenced by clients.
+ * @since 5.5
+ */
+ public static boolean isProviderCompatible(String providerId, ICConfigurationDescription cfgDescription) {
+ if (cfgDescription != null) {
+ boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null;
+ if (SI_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) {
+ return useScannerInfoProviderExtension;
+ }
+
+ if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) {
+ boolean isNewStyleCfg = CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription);
+ return !useScannerInfoProviderExtension && isNewStyleCfg;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Return list containing User and MBS providers. Used to initialize older MBS tool-chains (backward compatibility).
+ *
+ * @noreference This is internal helper method to support compatibility with previous versions
+ * which is not intended to be referenced by clients.
*/
public static List<ILanguageSettingsProvider> getDefaultProvidersLegacy() {
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(2);
- ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.getExtensionProviderCopy((ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID), false);
+ ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.getExtensionProviderCopy((USER_LANGUAGE_SETTINGS_PROVIDER_ID), false);
if (provider != null) {
providers.add(provider);
}
- providers.add(LanguageSettingsProvidersSerializer.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
+ providers.add(LanguageSettingsProvidersSerializer.getWorkspaceProvider(MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
return providers;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java index b9e6a1bf2b6..04f3d1251fd 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Andrew Gvozdev and others. + * Copyright (c) 2009, 2013 Andrew Gvozdev and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -82,7 +82,7 @@ public class LanguageSettingsProvidersSerializer { public static final String JOB_FAMILY_SERIALIZE_LANGUAGE_SETTINGS_WORKSPACE = "CDT_JOB_FAMILY_SERIALIZE_LANGUAGE_SETTINGS_WORKSPACE"; //$NON-NLS-1$ private static final String PREFERENCE_WORSPACE_PROVIDERS_SET = "language.settings.providers.workspace.prefs.toggle"; //$NON-NLS-1$ - private static final String CPROJECT_STORAGE_MODULE = "org.eclipse.cdt.core.LanguageSettingsProviders"; //$NON-NLS-1$ + private static final String CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS = "org.eclipse.cdt.core.LanguageSettingsProviders"; //$NON-NLS-1$ private static final String STORAGE_WORKSPACE_LANGUAGE_SETTINGS = "language.settings.xml"; //$NON-NLS-1$ private static final String STORAGE_PROJECT_PATH = ".settings/language.settings.xml"; //$NON-NLS-1$ @@ -827,8 +827,13 @@ public class LanguageSettingsProvidersSerializer { public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException { IProject project = prjDescription.getProject(); try { - // Using side effect of adding the module to the storage - prjDescription.getStorage(CPROJECT_STORAGE_MODULE, true); + // Add the storage module to .cpoject and persist on disk as a side effect of adding + prjDescription.getStorage(CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS, true); + if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) { + // set the flag if was not previously set by the user - to the default value + ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, + ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)); + } } catch (CoreException e) { CCorePlugin.log("Internal error while trying to serialize language settings", e); //$NON-NLS-1$ } @@ -1125,7 +1130,9 @@ public class LanguageSettingsProvidersSerializer { public static void loadLanguageSettings(ICProjectDescription prjDescription) { IProject project = prjDescription.getProject(); IFile storeInPrjArea = getStoreInProjectArea(project); - if (storeInPrjArea.exists()) { + boolean isStoreInProjectAreaExist = storeInPrjArea.exists(); + boolean enableLSP = isStoreInProjectAreaExist; + if (isStoreInProjectAreaExist) { Document doc = null; try { doc = XmlUtil.loadXml(storeInPrjArea); @@ -1150,19 +1157,18 @@ public class LanguageSettingsProvidersSerializer { CCorePlugin.log("Can't load preferences from file " + storeInPrjArea.getLocation(), e); //$NON-NLS-1$ } - } else { - // Storage in project area does not exist - ICStorageElement storageElement = null; + } else { // Storage in project area does not exist + ICStorageElement lspStorageModule = null; try { - storageElement = prjDescription.getStorage(CPROJECT_STORAGE_MODULE, false); + lspStorageModule = prjDescription.getStorage(CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS, false); } catch (CoreException e) { String msg = "Internal error while trying to load language settings"; //$NON-NLS-1$ CCorePlugin.log(msg, e); } - if (storageElement != null) { - // set default providers defined in the tool-chain - for (ICConfigurationDescription cfgDescription : prjDescription.getConfigurations()) { + // set default providers defined in the tool-chain + for (ICConfigurationDescription cfgDescription : prjDescription.getConfigurations()) { + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { String[] ids = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds(); if (ids != null) { List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(ids.length); @@ -1176,23 +1182,16 @@ public class LanguageSettingsProvidersSerializer { ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers); } } - - } else { - // Older existing legacy projects unaware of Language Settings Providers and their persistence store - ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); - for (ICConfigurationDescription cfgDescription : cfgDescriptions) { - if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { - ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy()); - } - } - } - - if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) { - // if not yet defined by user - set preference to tell if this is legacy .cproject (i.e. no LSP storageElement) - ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, storageElement != null); } + enableLSP = lspStorageModule != null; } + + if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) { + // set the flag if was not previously set by the user + ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, enableLSP); + } + } /** diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java new file mode 100644 index 00000000000..fb2d1e637bc --- /dev/null +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java @@ -0,0 +1,158 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.language.settings.providers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.cdt.core.AbstractCExtension;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider;
+import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfoProvider;
+import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.core.settings.model.util.CExtensionUtil;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * Wrapper class intended to provide backward compatibility with ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point
+ */
+public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettingsBaseProvider {
+ @Override
+ public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
+ List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
+ IScannerInfoProvider scannerInfoProvider = getScannerInfoProvider(cfgDescription);
+ if (scannerInfoProvider != null) {
+ IScannerInfo si = scannerInfoProvider.getScannerInformation(rc);
+ if (si != null) {
+ if (si instanceof IExtendedScannerInfo) {
+ addLocalIncludePaths(entries, (IExtendedScannerInfo) si);
+ }
+
+ addSystemIncludePaths(entries, si);
+ addDefinedSymbols(entries, si);
+
+ if (si instanceof IExtendedScannerInfo) {
+ addIncludeFiles(entries, (IExtendedScannerInfo) si);
+ addMacroFiles(entries, (IExtendedScannerInfo) si);
+ }
+
+ if (!entries.isEmpty()) {
+ return LanguageSettingsSerializableStorage.getPooledList(entries);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return ScannerInfoProvider defined in configuration metadata in .cproject.
+ *
+ * @param cfgDescription - configuration description.
+ * @return an instance of ScannerInfoProvider or {@code null}.
+ */
+ public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) {
+ if (cfgDescription == null) {
+ return null;
+ }
+
+ IScannerInfoProvider scannerInfoProvider = null;
+ ICConfigExtensionReference[] refs = cfgDescription.get(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
+ if (refs != null && refs.length > 0) {
+ ICConfigExtensionReference ref = refs[0];
+ try {
+ AbstractCExtension cExtension = null;
+ IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", false); //$NON-NLS-1$
+ cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$
+ cExtension.setExtensionReference(ref);
+ cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject());
+ if (cExtension instanceof IScannerInfoProvider) {
+ scannerInfoProvider = (IScannerInfoProvider) cExtension;
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ }
+ }
+ return scannerInfoProvider;
+ }
+
+ /**
+ * Add local include paths to the list of entries.
+ */
+ private void addLocalIncludePaths(List<ICLanguageSettingEntry> entries, IExtendedScannerInfo esi) {
+ String[] localIncludePaths = esi.getLocalIncludePath();
+ if (localIncludePaths != null) {
+ for (String path : localIncludePaths) {
+ entries.add(CDataUtil.createCIncludePathEntry(path, ICSettingEntry.LOCAL));
+ }
+ }
+ }
+
+ /**
+ * Add system include paths to the list of entries.
+ */
+ private void addSystemIncludePaths(List<ICLanguageSettingEntry> entries, IScannerInfo si) {
+ String[] includePaths = si.getIncludePaths();
+ if (includePaths != null) {
+ for (String path : includePaths) {
+ entries.add(CDataUtil.createCIncludePathEntry(path, 0));
+ }
+ }
+ }
+
+ /**
+ * Add defined macros to the list of entries.
+ */
+ private void addDefinedSymbols(List<ICLanguageSettingEntry> entries, IScannerInfo si) {
+ Map<String, String> definedSymbols = si.getDefinedSymbols();
+ if (definedSymbols != null) {
+ for (Entry<String, String> entry : new TreeMap<String, String>(definedSymbols).entrySet()) {
+ String name = entry.getKey();
+ String value = entry.getValue();
+ entries.add(CDataUtil.createCMacroEntry(name, value, 0));
+ }
+ }
+ }
+
+ /**
+ * Add include files to the list of entries.
+ */
+ private void addIncludeFiles(List<ICLanguageSettingEntry> entries, IExtendedScannerInfo esi) {
+ String[] includeFiles = esi.getIncludeFiles();
+ if (includeFiles != null) {
+ for (String path : includeFiles) {
+ entries.add(CDataUtil.createCIncludeFileEntry(path, 0));
+ }
+ }
+ }
+
+ /**
+ * Add macro files to the list of entries.
+ */
+ private void addMacroFiles(List<ICLanguageSettingEntry> entries, IExtendedScannerInfo esi) {
+ String[] macroFiles = esi.getMacroFiles();
+ if (macroFiles != null) {
+ for (String path : macroFiles) {
+ entries.add(CDataUtil.createCMacroFileEntry(path, 0));
+ }
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java index a8a881a4b63..61c95fc315d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java @@ -52,6 +52,7 @@ import javax.xml.transform.stream.StreamResult; 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.ScannerDiscoveryLegacySupport; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElementDelta; @@ -1141,7 +1142,15 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { monitor = new NullProgressMonitor(); CConfigurationDataProvider provider = getProvider(des); - return provider.loadConfiguration(des, monitor); + CConfigurationData data = provider.loadConfiguration(des, monitor); + + if (des instanceof ILanguageSettingsProvidersKeeper && ! des.isPreferenceConfiguration()) { + String[] defaultIds = ((ILanguageSettingsProvidersKeeper) des).getDefaultLanguageSettingsProvidersIds(); + if (defaultIds == null) { + ((ILanguageSettingsProvidersKeeper) des).setDefaultLanguageSettingsProvidersIds(ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(des)); + } + } + return data; } CConfigurationData applyData(CConfigurationDescriptionCache des, ICConfigurationDescription baseDescription, CConfigurationData base, SettingsContext context, IProgressMonitor monitor) throws CoreException { diff --git a/core/org.eclipse.cdt.core/plugin.properties b/core/org.eclipse.cdt.core/plugin.properties index 05f9ed7440a..46e1547c2f1 100644 --- a/core/org.eclipse.cdt.core/plugin.properties +++ b/core/org.eclipse.cdt.core/plugin.properties @@ -132,4 +132,5 @@ CProjectStorageType.separatefile.name = Xml Storage (Separate Files) scannerInfoProvider2.name = Scanner Info Provider efsExtensionProvider.name = EFSExtensionProvider refreshExclusionFactory.name = Refresh Exclusion Factory -uncPathConverter.name = UNC Path Converter
\ No newline at end of file +uncPathConverter.name = UNC Path Converter +ScannerInfoExtensionLanguageSettingsProvider.name=Contributed ScannerInfo Entries diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index f58003a9329..018a7e65fc1 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -2,7 +2,7 @@ <?eclipse version="3.0"?> <plugin> - + <!-- =================================================================================== --> <!-- Obsolete extension point no longer in use, will be remove. --> <!-- =================================================================================== --> @@ -782,5 +782,13 @@ factoryClass="org.eclipse.cdt.internal.core.resources.ResourceExclusionFactory"> </exclusionFactory> </extension> + <extension + point="org.eclipse.cdt.core.LanguageSettingsProvider"> + <provider + class="org.eclipse.cdt.internal.core.language.settings.providers.ScannerInfoExtensionLanguageSettingsProvider" + id="org.eclipse.cdt.core.LegacyScannerInfoLanguageSettingsProvider" + name="%ScannerInfoExtensionLanguageSettingsProvider.name"> + </provider> + </extension> </plugin> 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 58c3a0c42f3..41ada730f5f 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 @@ -926,7 +926,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab { for (ILanguageSettingsProvider provider : allAvailableProvidersSet) { String id = provider.getId(); - if (!idsList.contains(id)) { + if (!idsList.contains(id) && ScannerDiscoveryLegacySupport.isProviderCompatible(id, cfgDescription)) { providers.add(provider); idsList.add(id); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java index 8ed8a840392..ba1cb6126e4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java @@ -276,11 +276,17 @@ public class ManageConfigDialog extends Dialog { for (int i=0; i<cfgds.length; i++ ) { TableItem t = new TableItem(table, 0); t.setText(0, cfgds[i].getName()); - t.setText(1, cfgds[i].getDescription()); + String description = cfgds[i].getDescription(); + if (description == null) { + description = ""; //$NON-NLS-1$ + } + t.setText(1, description); t.setText(2, cfgds[i].isActive() ? Messages.ManageConfigDialog_5 : ""); //$NON-NLS-1$ t.setData(cfgds[i]); } - if (table.getItemCount() > 0) table.select(0); + if (table.getItemCount() > 0) { + table.select(0); + } table.setFocus(); updateButtons(); } |