From d2c19fcd47de828faef36593bce200b1226eb8af Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Fri, 4 May 2012 18:33:09 -0400 Subject: [PATCH] bug 376592: [sd90] Extend BuildDefinitions to allow defining language settings providers --- .../AllLanguageSettingsProvidersMBSTests.java | 1 + .../LanguageSettingsProvidersMBSTest.java | 189 ++++++++ .../plugin.xml | 11 +- .../schema/buildDefinitions.exsd | 44 +- .../scannerconfig/CfgScannerConfigUtil.java | 60 +-- .../managedbuilder/core/IConfiguration.java | 420 +++++++++--------- .../cdt/managedbuilder/core/IToolChain.java | 206 +++++---- .../internal/core/Configuration.java | 66 ++- .../internal/core/InputType.java | 58 ++- .../internal/core/MultiConfiguration.java | 76 ++-- .../internal/core/ToolChain.java | 79 +++- .../ConfigurationDataProvider.java | 53 +++ .../plugin.xml | 73 +-- .../ui/tests/util/TestConfiguration.java | 6 + .../ui/tests/util/TestToolchain.java | 8 +- .../plugin.xml | 9 +- .../managedbuilder/internal/ui/Messages.java | 1 + .../internal/ui/Messages.properties | 3 +- .../ui/preferences/PropertyPageDefsTab.java | 160 +++---- .../ui/wizards/MBSWizardHandler.java | 265 +++++------ .../ui/wizards/NewMakeProjFromExisting.java | 7 +- .../ui/wizards/STDWizardHandler.java | 97 ++-- .../ScannerDiscoveryLegacySupport.java | 52 ++- core/org.eclipse.cdt.ui/plugin.properties | 1 + core/org.eclipse.cdt.ui/plugin.xml | 4 +- .../providers/LanguageSettingsEntriesTab.java | 6 +- .../LanguageSettingsProviderTab.java | 4 +- .../LanguageSettingsProvidersPage.java | 5 - .../org/eclipse/cdt/ui/newui/CDTPrefUtil.java | 147 +++--- .../plugin.xml | 101 +++-- 30 files changed, 1383 insertions(+), 829 deletions(-) create mode 100644 build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/LanguageSettingsProvidersMBSTest.java diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/AllLanguageSettingsProvidersMBSTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/AllLanguageSettingsProvidersMBSTests.java index 4ab865896ad..6937c34379a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/AllLanguageSettingsProvidersMBSTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/AllLanguageSettingsProvidersMBSTests.java @@ -25,6 +25,7 @@ public class AllLanguageSettingsProvidersMBSTests extends TestSuite { public AllLanguageSettingsProvidersMBSTests() { super(AllLanguageSettingsProvidersMBSTests.class.getName()); + addTestSuite(LanguageSettingsProvidersMBSTest.class); addTestSuite(GCCBuildCommandParserTest.class); addTestSuite(BuiltinSpecsDetectorTest.class); addTestSuite(GCCBuiltinSpecsDetectorTest.class); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/LanguageSettingsProvidersMBSTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/LanguageSettingsProvidersMBSTest.java new file mode 100644 index 00000000000..82d5eec4ee5 --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/language/settings/providers/tests/LanguageSettingsProvidersMBSTest.java @@ -0,0 +1,189 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 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.managedbuilder.language.settings.providers.tests; + +import java.util.ArrayList; +import java.util.List; + +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.LanguageSettingsPersistenceProjectTests; +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; +import org.eclipse.cdt.core.testplugin.util.BaseTestCase; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; +import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; + +/** + * Test creation of a new project in respect with language settings providers. + */ +public class LanguageSettingsProvidersMBSTest extends BaseTestCase { + private static final String MBS_LANGUAGE_SETTINGS_PROVIDER_ID = ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID; + private static final String USER_LANGUAGE_SETTINGS_PROVIDER_ID = ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID; + private static final String GCC_SPECS_DETECTOR_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"; + private static final String PROJECT_TYPE_EXECUTABLE_GNU = "cdt.managedbuild.target.gnu.exe"; + private static final String LANGUAGE_SETTINGS_PROJECT_XML = LanguageSettingsPersistenceProjectTests.LANGUAGE_SETTINGS_PROJECT_XML; + private static final String LANGUAGE_SETTINGS_WORKSPACE_XML = LanguageSettingsPersistenceProjectTests.LANGUAGE_SETTINGS_WORKSPACE_XML; + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + ManagedBuildTestHelper.removeProject(this.getName()); + super.tearDown(); + } + + /** + * Imitate a new Project Wizard. New Project Wizards really do these things in CDT. + */ + private static IProject imitateNewProjectWizard(String name, String projectTypeId) throws CoreException { + IProject project = ManagedBuildTestHelper.createProject(name, projectTypeId); + ManagedBuildTestHelper.addManagedBuildNature(project); + + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true); + assertNotNull(prjDescription); + ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); + for (ICConfigurationDescription cfgDescription : cfgDescriptions) { + assertNotNull(cfgDescription); + assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper); + + IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDescription); + ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDescription); + + assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() > 0); + } + + CoreModel.getDefault().setProjectDescription(project, prjDescription); + + return project; + } + + /** + * Test new GNU Executable project. + */ + public void testGnuToolchainProviders() throws Exception { + // create a new project imitating wizard + IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU); + + // check that the language settings providers are in place. + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false); + assertNotNull(prjDescription); + ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); + for (ICConfigurationDescription cfgDescription : cfgDescriptions) { + assertNotNull(cfgDescription); + assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper); + + List providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); + { + ILanguageSettingsProvider provider = providers.get(0); + String id = provider.getId(); + assertEquals(USER_LANGUAGE_SETTINGS_PROVIDER_ID, id); + assertEquals(false, LanguageSettingsManager.isPreferShared(id)); + assertEquals(false, LanguageSettingsManager.isWorkspaceProvider(provider)); + } + { + ILanguageSettingsProvider provider = providers.get(1); + String id = provider.getId(); + assertEquals(MBS_LANGUAGE_SETTINGS_PROVIDER_ID, id); + assertEquals(true, LanguageSettingsManager.isPreferShared(id)); + assertEquals(true, LanguageSettingsManager.isWorkspaceProvider(provider)); + } + { + ILanguageSettingsProvider provider = providers.get(2); + String id = provider.getId(); + assertEquals(GCC_SPECS_DETECTOR_ID, id); + assertEquals(true, LanguageSettingsManager.isPreferShared(id)); + assertEquals(true, LanguageSettingsManager.isWorkspaceProvider(provider)); + } + assertEquals(3, providers.size()); + } + } + + /** + * Test that no unnecessary storage file is created for language settings for default set + * of language settings providers. + */ + public void testProjectPersistence_Defaults() throws Exception { + // create a new project imitating wizard + IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU); + + // double-check that the project contains language settings providers + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false); + assertNotNull(prjDescription); + ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); + for (ICConfigurationDescription cfgDescription : cfgDescriptions) { + assertNotNull(cfgDescription); + assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper); + + String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds(); + List providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); + assertEquals(defaultIds.length, providers.size()); + for (int i = 0; i < defaultIds.length; i++) { + assertEquals(providers.get(i).getId(), defaultIds[i]); + } + assertTrue(defaultIds.length > 0); + } + + // no settings file in project area + IFile xmlStorageFile = project.getFile(LANGUAGE_SETTINGS_PROJECT_XML); + assertEquals(false, xmlStorageFile.exists()); + assertEquals(false, xmlStorageFile.getParent().exists()); // .settings folder + + // no settings file in workspace area + String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML); + java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation); + assertEquals(false, xmlStorageFilePrjWsp.exists()); + } + + /** + * Test that storage file is created for language settings for empty set of language settings providers. + */ + public void testProjectPersistence_NoProviders() throws Exception { + // create a new project imitating wizard + IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU); + + // remove language settings providers from the project + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true); + assertNotNull(prjDescription); + ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); + for (ICConfigurationDescription cfgDescription : cfgDescriptions) { + assertNotNull(cfgDescription); + assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper); + + ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(new ArrayList()); + assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() == 0); + } + + CoreModel.getDefault().setProjectDescription(project, prjDescription); + + // settings file appears in project area + IFile xmlStorageFile = project.getFile(LANGUAGE_SETTINGS_PROJECT_XML); + assertEquals(true, xmlStorageFile.exists()); + + // no settings file in workspace area + String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML); + java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation); + assertEquals(false, xmlStorageFilePrjWsp.exists()); + + } + +} diff --git a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core/plugin.xml index ae8c2baf886..14cde1542a5 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.core/plugin.xml @@ -307,14 +307,15 @@ fileVersion="4.0.0"> + id="org.eclipse.cdt.build.core.emptycfg" + languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;${Toolchain}" + name="%cfg1_empty"> + id="org.eclipse.cdt.build.core.prefbase.cfg" + languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;${Toolchain}" + name="%cfg1_base"> - The semi-colon separated list of the default error parsers to be used with this configuration. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. The list of error parsers to be used may be changed by the user on a per-configuration basis. When specified, this overrides the tool-chain errorParsers attribute. + The semi-colon separated list of the default error parsers to be used with this configuration. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. The list of error parsers to be used may be changed by the user on a per-configuration basis. When specified, this overrides the tool-chain errorParsers attribute. + + + + + + + Semicolon-separated list of providers ID implementing ILanguageSettingProvider interface. +This field could be amended with toolchain-level providers list by using ${Toolchain} keyword. Provider ID can be prefixed with "-" which will cause id to be removed from the preceeding list including providers defined with ${Toolchain} keyword. +If this field is not specified, "org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" (MBS Language Settings Provider) is used by default. @@ -405,7 +414,14 @@ Specifying this attribute is fully equivalent to specifying the "org.eclips - The semi-colon separated list of the default error parsers to be used with this tool-chain. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. When specified, this overrides the tool errorParsers attributes of the tool children of the tool-chain and the builder child of the tool-chain. + The semi-colon separated list of the default error parsers to be used with this tool-chain. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. When specified, this overrides the tool errorParsers attributes of the tool children of the tool-chain and the builder child of the tool-chain. + + + + + + + Semicolon-separated list of providers ID implementing ILanguageSettingProvider interface. This list could be adjusted on configuration level in the corresponding attribute. @@ -732,14 +748,14 @@ The pathConverter of a toolchain applies for all tools of the toolchain except i - Specifies whether this Tool represents a user-define custom build step. The default is false. When True, the default value of the commandLinePattern attribute changes to “$(command)”. + Specifies whether this Tool represents a user-define custom build step. The default is false. When True, the default value of the commandLinePattern attribute changes to "$(command)". - Specifies a string that is written to the build output prior to each invocation of the tool. The default value is “Invoking tool-name (tool-id)…” + Specifies a string that is written to the build output prior to each invocation of the tool. The default value is "Invoking tool-name (tool-id)..." @@ -1066,7 +1082,7 @@ Overrides language id specified with the languageId attribute. - The id of the input type that is used in determining the build “rules” for the output type and for the default name of the output file. The default is the input type with primaryInput == true. + The id of the input type that is used in determining the build "rules" for the output type and for the default name of the output file. The default is the input type with primaryInput == true. @@ -1080,7 +1096,7 @@ Overrides language id specified with the languageId attribute. - Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so 'lib' would be the prefix. The default is to use the Tool “outputPrefix” attribute if primaryOutput is True, otherwise the default is an empty string. This attribute supports MBS configuration context macros. + Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so 'lib' would be the prefix. The default is to use the Tool "outputPrefix" attribute if primaryOutput is True, otherwise the default is an empty string. This attribute supports MBS configuration context macros. @@ -2150,11 +2166,11 @@ If the "buildPathResolver" attribute is specified, the "pathDelim Represents the applicability type for this enablement. Can contain the following values: -UI_VISIBILITY – the given enablement expression specifies whether the option is to be visible in UI, -UI_ENABLEMENT – the given enablement expression specifies the enable state of the controls that represent the option in UI, -CMD_USAGE – the given enablement expression specifies whether the option is to be used in command line +UI_VISIBILITY - the given enablement expression specifies whether the option is to be visible in UI, +UI_ENABLEMENT - the given enablement expression specifies the enable state of the controls that represent the option in UI, +CMD_USAGE - the given enablement expression specifies whether the option is to be used in command line CONTAINER_ATTRIBUTE - the given enablement expressions specifies thecontainer attribute value -ALL – this value means the combination of all the above values. +ALL - this value means the combination of all the above values. Several types could be specified simultaneously using the "|" as a delimiter, e.g.: type="UI_VISIBILITY|CMD_USAGE" @@ -2288,7 +2304,7 @@ Default value is true. - Specifies the expected value. If the current option value matches the value specified in this attribute, the checkOption element is treated as true, otherwise – as false. + Specifies the expected value. If the current option value matches the value specified in this attribute, the checkOption element is treated as true, otherwise - as false. The expected value could be specified either as a string that may contain build macros or as a regular expression. During the comparison, the build macros are resolved and the option value is checked to match the resulting string or regular expression. The way the expected value is specified and treated depends on the value of the isRegex attribute @@ -2303,14 +2319,14 @@ The expected value could be specified either as a string that may contain build - The id of the option which is to be compared with the option specified with the “optionId” attribute. The default is the id of the option that holds this expression. If the “value” attribute is specified, both the “otherOptionId” and the “otherHolderId” attributes are ignored. When searching for the option to be checked, MBS will examine all the options the holder contains along with all superclasses of each option to find the option with the specified id. + The id of the option which is to be compared with the option specified with the "optionId" attribute. The default is the id of the option that holds this expression. If the "value" attribute is specified, both the "otherOptionId" and the "otherHolderId" attributes are ignored. When searching for the option to be checked, MBS will examine all the options the holder contains along with all superclasses of each option to find the option with the specified id. - The option holder id that holds the option specified with the “otherOptionId” attribute. The default is the id of the holder that holds the container of this expression. If the “value” attribute is specified, both the “otherOptionId” and the “otherHolderId” attributes are ingnored. When searching for the needed holder, MBS will examine all the holders the current configuration contains along with all superclasses of each holder in order to find the holder with the specified id. + The option holder id that holds the option specified with the "otherOptionId" attribute. The default is the id of the holder that holds the container of this expression. If the "value" attribute is specified, both the "otherOptionId" and the "otherHolderId" attributes are ingnored. When searching for the needed holder, MBS will examine all the holders the current configuration contains along with all superclasses of each holder in order to find the holder with the specified id. @@ -2334,7 +2350,7 @@ The expected value could be specified either as a string that may contain build - Specifies the expected value. If the current string specified in the “string” attribute matches the value specified in this attribute, the checkString element is treated as true, otherwise – as false. + Specifies the expected value. If the current string specified in the "string" attribute matches the value specified in this attribute, the checkString element is treated as true, otherwise - as false. The expected value could be specified either as a string that might contain the build macros or as a regular expression. The way the value is specified and treated depends on the value of the isRegex attribute. diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgScannerConfigUtil.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgScannerConfigUtil.java index 6c27670a7b6..54397ce3905 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgScannerConfigUtil.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgScannerConfigUtil.java @@ -38,7 +38,7 @@ public class CfgScannerConfigUtil { IInputType inType = context.getInputType(); boolean adjust = false; CfgInfoContext newContext = context; - + if(tool != null){ if(inType != null){ if(!tool.hasScannerConfigSettings(inType)){ @@ -59,10 +59,10 @@ public class CfgScannerConfigUtil { inType = null; adjust = true; } - + if(rcInfo != null){ ToolChain tc = getToolChain(rcInfo); - + if(tc != null){ if(!tc.hasScannerConfigSettings()){ adjust = true; @@ -85,23 +85,23 @@ public class CfgScannerConfigUtil { // adjust = true; // } // } - + if(adjust){ if(rcInfo == null) newContext = new CfgInfoContext(context.getConfiguration()); else newContext = new CfgInfoContext(rcInfo, tool, inType); } - + return newContext; } - + private static ToolChain getToolChain(IResourceInfo rcInfo){ - return rcInfo instanceof FolderInfo ? + return rcInfo instanceof FolderInfo ? (ToolChain)((FolderInfo)rcInfo).getToolChain() : (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain(); } - + public static String getDefaultProfileId(CfgInfoContext context, boolean searchFirstIfNone){ String id = null; if(context.getInputType() != null) @@ -116,19 +116,19 @@ public class CfgScannerConfigUtil { if(id == null){ id = ((Configuration)context.getConfiguration()).getDiscoveryProfileId(); } - + if(id == null && searchFirstIfNone){ id = getFirstProfileId(context.getConfiguration().getFilteredTools()); } return id; } - + public static String getFirstProfileId(ITool[] tools){ String id = null; for(int i = 0; i < tools.length; i++){ ITool tool = tools[i]; IInputType[] types = tool.getInputTypes(); - + if(types.length != 0){ for(int k = 0; k < types.length; k++){ id = types[k].getDiscoveryProfileId(tool); @@ -142,24 +142,30 @@ public class CfgScannerConfigUtil { if(id != null) break; } - + return id; } /** * Search for toolchain's discovery profiles. Discovery profiles could be * specified on toolchain level, input types level or in their super-classes. - * + * * @param toolchain - toolchain to search for scanner discovery profiles. * @return all available discovery profiles in given toolchain */ public static Set getAllScannerDiscoveryProfileIds(IToolChain toolchain) { Assert.isNotNull(toolchain); - + Set profiles = new TreeSet(); - + if (toolchain!=null) { - String toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId(); + String toolchainProfileId = null; + if (toolchain instanceof ToolChain) { + // still allow a user a choice to select any legacy profiles + toolchainProfileId = ((ToolChain) toolchain).getLegacyScannerConfigDiscoveryProfileId(); + } else { + toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId(); + } if (toolchainProfileId!=null && toolchainProfileId.length()>0) { profiles.add(toolchainProfileId); } @@ -172,15 +178,15 @@ public class CfgScannerConfigUtil { profiles.addAll(getAllScannerDiscoveryProfileIds(superClass)); } } - + return profiles; } - + /** * Search for tool's discovery profiles. Discovery profiles could be retrieved * from tool/input type super-class. Input type could hold list of profiles * separated by pipe character '|'. - * + * * @param tool - tool to search for scanner discovery profiles * @return all available discovery profiles in given configuration */ @@ -192,42 +198,42 @@ public class CfgScannerConfigUtil { new Object[] { Tool.class.getName() }); throw new UnsupportedOperationException(msg); } - + Set profiles = new TreeSet(); - + for (IInputType inputType : ((Tool) tool).getAllInputTypes()) { for (String profileId : getAllScannerDiscoveryProfileIds(inputType)) { profiles.add(profileId); } } - + ITool superClass = tool.getSuperClass(); if (superClass!=null) { profiles.addAll(getAllScannerDiscoveryProfileIds(superClass)); } return profiles; } - + /** * Search for input type's discovery profiles. Discovery profiles could be specified * on input type super-class. Input type could hold list of profiles * separated by pipe character '|'. - * + * * @param inputType - input type to search for scanner discovery profiles * @return all available discovery profiles in given configuration */ private static Set getAllScannerDiscoveryProfileIds(IInputType inputType) { Assert.isNotNull(inputType); - + if ( ! (inputType instanceof InputType) ) { String msg = MessageFormat.format(ManagedMakeMessages.getString("CfgScannerConfigUtil_ErrorNotSupported"), //$NON-NLS-1$ new Object[] { InputType.class.getName() }); throw new UnsupportedOperationException(msg); } - + Set profiles = new TreeSet(); - String attribute = ((InputType) inputType).getDiscoveryProfileIdAttribute(); + String attribute = ((InputType) inputType).getLegacyDiscoveryProfileIdAttribute(); if (attribute!=null) { // FIXME: temporary; we should add new method to IInputType instead of that for (String profileId : attribute.split("\\|")) { //$NON-NLS-1$ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java index 8b7f0499dce..87db9d380d4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java @@ -24,14 +24,14 @@ import org.eclipse.core.runtime.IPath; /** * A tool-integrator defines default configurations as children of the project type. - * These provide a template for the configurations added to the user's project, - * which are stored in the project's .cproject file. + * These provide a template for the configurations added to the user's project, + * which are stored in the project's .cproject file. *

- * The configuration contains one child of type tool-chain. This describes how the + * The configuration contains one child of type tool-chain. This describes how the * project's resources are transformed into the build artifact. The configuration can * contain one or more children of type resourceConfiguration. These describe build * settings of individual resources that are different from the configuration as a whole. - * + * * @since 2.1 * @noextend This class is not intended to be subclassed by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -39,33 +39,35 @@ import org.eclipse.core.runtime.IPath; public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesContainer { public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$ public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$ - public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$ - public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$ - public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$ - public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$ + public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$ + public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$ + public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$ + public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$ // Schema element names public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$ public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$ + /** @since 8.1 */ + public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$ public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$ public static final String PARENT = "parent"; //$NON-NLS-1$ - + public static final String DESCRIPTION = "description"; //$NON-NLS-1$ - + public static final String BUILD_PROPERTIES = "buildProperties"; //$NON-NLS-1$ public static final String BUILD_ARTEFACT_TYPE = "buildArtefactType"; //$NON-NLS-1$ public static final String IS_SYSTEM = "isSystem"; //$NON-NLS-1$ public static final String SOURCE_ENTRIES = "sourceEntries"; //$NON-NLS-1$ - - + + /** * Returns the description of the configuration. - * + * * @return String */ public String getDescription(); - + /** * Sets the description of the receiver to the value specified in the argument */ @@ -84,204 +86,212 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont * @param name - The name for the new tool chain * @param isExtensionElement - set {@code true} if the toolchain being created * represents extension point toolchain - * + * * @return IToolChain */ public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement); - + /** - * Returns the extension that should be applied to build artifacts created by + * Returns the extension that should be applied to build artifacts created by * this configuration. - * + * * @return String */ - public String getArtifactExtension(); + public String getArtifactExtension(); /** * Returns the name of the final build artifact. - * + * * @return String */ public String getArtifactName(); /** - * Returns the build arguments from this configuration's builder - * + * Returns the build arguments from this configuration's builder + * * @return String */ public String getBuildArguments(); /** - * Returns the build command from this configuration's builder - * + * Returns the build command from this configuration's builder + * * @return String */ public String getBuildCommand(); - + /** * Returns the prebuild step command - * - * @return String - */ - public String getPrebuildStep(); - - /** - * Returns the postbuild step command - * - * @return String - */ - public String getPostbuildStep(); - - /** - * Returns the display string associated with the prebuild step - * - * @return String - */ - public String getPreannouncebuildStep(); - - /** - * Returns the display string associated with the postbuild step - * - * @return String - */ - public String getPostannouncebuildStep(); - - /** + * + * @return String + */ + public String getPrebuildStep(); + + /** + * Returns the postbuild step command + * + * @return String + */ + public String getPostbuildStep(); + + /** + * Returns the display string associated with the prebuild step + * + * @return String + */ + public String getPreannouncebuildStep(); + + /** + * Returns the display string associated with the postbuild step + * + * @return String + */ + public String getPostannouncebuildStep(); + + /** * Answers the OS-specific command to remove files created by the build * of this configuration. - * + * * @return String */ public String getCleanCommand(); /** - * Answers the semicolon separated list of unique IDs of the error parsers associated + * Answers the semicolon separated list of unique IDs of the error parsers associated * with this configuration. - * + * * @return String */ public String getErrorParserIds(); /** - * Answers the ordered list of unique IDs of the error parsers associated + * Answers the ordered list of unique IDs of the error parsers associated * with this configuration. - * + * * @return String[] */ public String[] getErrorParserList(); - + /** - * Projects have C or CC natures. Tools can specify a filter so they are not - * misapplied to a project. This method allows the caller to retrieve a list - * of tools from a project that are correct for a project's nature. - * - * @return an array of ITools that have compatible filters + * Returns default language settings providers IDs specified for the configuration. + * @return default language settings providers IDs or {@code null}. + * + * @since 8.1 + */ + public String[] getDefaultLanguageSettingsProviderIds(); + + /** + * Projects have C or CC natures. Tools can specify a filter so they are not + * misapplied to a project. This method allows the caller to retrieve a list + * of tools from a project that are correct for a project's nature. + * + * @return an array of ITools that have compatible filters * for this configuration. */ ITool[] getFilteredTools(); - + /** * Returns the managed-project parent of this configuration, if this is a * project configuration. Otherwise, returns null. - * + * * @return IManagedProject */ public IManagedProject getManagedProject(); - + /** * Returns the Eclipse project that owns the configuration. - * + * * @return IResource */ public IResource getOwner(); - + /** - * Returns the configuration that this configuration is based on. - * + * Returns the configuration that this configuration is based on. + * * @return IConfiguration */ public IConfiguration getParent(); - + /** * Returns the project-type parent of this configuration, if this is an * extension configuration. Otherwise, returns null. - * + * * @return IProjectType */ public IProjectType getProjectType(); - + /** * @param path - path of the resource - * + * * @return the resource configuration child of this configuration * that is associated with the project resource, or null if none. */ public IResourceConfiguration getResourceConfiguration(String path); - + /** * Returns the resource configuration children of this configuration. - * + * * @return IResourceConfigurations[] */ public IResourceConfiguration[] getResourceConfigurations(); - + /** * Returns the ITool in this configuration's tool-chain with - * the same id as the argument, or null. - * + * the same id as the argument, or null. + * * @param id unique identifier to search for * @return ITool */ public ITool getTool(String id); /** - * Returns the ITool in this configuration's tool-chain with - * the specified ID, or the tool(s) with a superclass with this id. - * - *

If the tool-chain does not have a tool with that ID, the method - * returns an empty array. It is the responsibility of the caller to - * verify the return value. - * + * Returns the ITool in this configuration's tool-chain with + * the specified ID, or the tool(s) with a superclass with this id. + * + *

If the tool-chain does not have a tool with that ID, the method + * returns an empty array. It is the responsibility of the caller to + * verify the return value. + * * @param id unique identifier of the tool to search for * @return ITool[] * @since 3.0.2 */ public ITool[] getToolsBySuperClassId(String id); - + /** * Returns the IToolChain child of this configuration. - * + * * @return IToolChain */ public IToolChain getToolChain(); - + /** * Returns the command-line invocation command for the specified tool. - * + * * @param tool The tool that will have its command retrieved. * @return String The command */ public String getToolCommand(ITool tool); - + /** * Returns the tools that are used in this configuration's tool-chain. - * + * * @return ITool[] */ public ITool[] getTools(); /** - * Returns the tool in this configuration specified with + * Returns the tool in this configuration specified with * the toolChain#targetTool attribute that creates the build artifact - * - * NOTE: This method returns null in case the toolChain definition + * + * NOTE: This method returns null in case the toolChain definition * does not have the targetTool attribute or if the attribute does not * refer to the appropriate tool. * For the target tool calculation the IConfiguration#calculateTargetTool() * method should be used - * + * * @see IConfiguration#calculateTargetTool() - * + * * @return ITool */ public ITool getTargetTool(); @@ -289,42 +299,42 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont /** * Returns true if this configuration has overridden the default build * build command in this configuration, otherwise false. - * - * @return boolean + * + * @return boolean */ public boolean hasOverriddenBuildCommand(); - + /** - * Returns true if the extension matches one of the special - * file extensions the tools for the configuration consider to be a header file. - * + * Returns true if the extension matches one of the special + * file extensions the tools for the configuration consider to be a header file. + * * @param ext the file extension of the resource * @return boolean */ public boolean isHeaderFile(String ext); - + /** - * Returns true if this configuration has changes that need to - * be saved in the project file, else false. + * Returns true if this configuration has changes that need to + * be saved in the project file, else false. * Should not be called for an extension configuration. - * - * @return boolean + * + * @return boolean */ public boolean isDirty(); - + /** * Returns true if this configuration was loaded from a manifest file, * and false if it was loaded from a project (.cdtbuild) file. - * - * @return boolean + * + * @return boolean */ public boolean isExtensionElement(); /** - * Returns whether this configuration has been changed and requires the + * Returns whether this configuration has been changed and requires the * project to be rebuilt. - * - * @return true if the configuration contains a change + * + * @return true if the configuration contains a change * that needs the project to be rebuilt. * Should not be called for an extension configuration. */ @@ -332,13 +342,13 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont /** * Removes a resource configuration from the configuration's list. - * + * * @param resConfig - resource configuration to remove */ public void removeResourceConfiguration(IResourceInfo resConfig); - + public void removeResourceInfo(IPath path); - + /** * Set (override) the extension that should be appended to the build artifact * for the receiver. @@ -352,7 +362,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont public void setArtifactName(String name); /** - * Sets the arguments to be passed to the build utility used by the + * Sets the arguments to be passed to the build utility used by the * receiver to produce a build goal. */ public void setBuildArguments(String makeArgs); @@ -363,26 +373,26 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont public void setBuildCommand(String command); /** - * Sets the prebuild step for the receiver to the value in the argument. - */ - public void setPrebuildStep(String step); - - /** - * Sets the postbuild step for the receiver to the value in the argument. - */ - public void setPostbuildStep(String step); - - /** - * Sets the prebuild step display string for the receiver to the value in the argument. - */ - public void setPreannouncebuildStep(String announceStep); - - /** - * Sets the postbuild step display string for the receiver to the value in the argument. - */ - public void setPostannouncebuildStep(String announceStep); - - /** + * Sets the prebuild step for the receiver to the value in the argument. + */ + public void setPrebuildStep(String step); + + /** + * Sets the postbuild step for the receiver to the value in the argument. + */ + public void setPostbuildStep(String step); + + /** + * Sets the prebuild step display string for the receiver to the value in the argument. + */ + public void setPreannouncebuildStep(String announceStep); + + /** + * Sets the postbuild step display string for the receiver to the value in the argument. + */ + public void setPostannouncebuildStep(String announceStep); + + /** * Sets the command used to clean the outputs of this configuration. * @param command - the command to clean outputs */ @@ -404,46 +414,46 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont * Sets the name of the receiver to the value specified in the argument */ public void setName(String name); - + /** * Sets the value of a boolean option for this configuration. - * + * * @param parent The holder/parent of the option. * @param option The option to change. * @param value The value to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ - public IOption setOption(IHoldsOptions parent, IOption option, boolean value) - throws BuildException; + public IOption setOption(IHoldsOptions parent, IOption option, boolean value) + throws BuildException; /** * Sets the value of a string option for this configuration. - * + * * @param parent The holder/parent of the option. * @param option The option that will be effected by change. * @param value The value to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ public IOption setOption(IHoldsOptions parent, IOption option, String value) throws BuildException; - + /** * Sets the value of a list option for this configuration. - * + * * @param parent The holder/parent of the option. * @param option The option to change. * @param value The values to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ @@ -452,7 +462,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont /** * Sets the rebuild state in this configuration. - * + * * @param rebuild true will force a rebuild the next time the project builds * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean) */ @@ -460,93 +470,93 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont /** * Overrides the tool command for a tool defined in this configuration's tool-chain. - * + * * @param tool The tool that will have its command modified. * @param command The command */ public void setToolCommand(ITool tool, String command); - + /** * Returns true if the configuration's tool-chain is supported on the system * otherwise returns false - * - * @return boolean - */ + * + * @return boolean + */ public boolean isSupported(); - + /** * Returns the implementation of the IConfigurationEnvironmentVariableSupplier provided * by the tool-integrator or null if none. - * - * @return IConfigurationEnvironmentVariableSupplier - */ + * + * @return IConfigurationEnvironmentVariableSupplier + */ public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier(); - + /** * Returns the tool-integrator provided implementation of the configuration build macro supplier - * or null if none. - * + * or null if none. + * * @return IConfigurationBuildMacroSupplier */ public IConfigurationBuildMacroSupplier getBuildMacroSupplier(); - + /** * answers true if the configuration is temporary, otherwise - false * @return boolean */ public boolean isTemporary(); - + /** * Returns whether this configuration requires a full rebuild - * + * * @return boolean */ public boolean needsFullRebuild(); /** * Calculates the configuration target tool. - * + * * @return ITool or null if not found - * + * * @since 3.1 */ public ITool calculateTargetTool(); - + /** - * Returns a ITool for the tool associated with the + * Returns a ITool for the tool associated with the * output extension. - * + * * @param extension the file extension of the output file * @return ITool - * + * * @since 3.1 */ public ITool getToolFromOutputExtension(String extension); - + /** - * Returns a ITool for the tool associated with the + * Returns a ITool for the tool associated with the * input extension. - * + * * @param sourceExtension the file extension of the input file * @return ITool - * + * * @since 3.1 */ public ITool getToolFromInputExtension(String sourceExtension); - + IResourceInfo getResourceInfo(IPath path, boolean exactPath); - + IResourceInfo[] getResourceInfos(); - + IResourceInfo getResourceInfoById(String id); - - IFolderInfo getRootFolderInfo(); - + + IFolderInfo getRootFolderInfo(); + IFileInfo createFileInfo(IPath path); IFileInfo createFileInfo(IPath path, String id, String name); - + IFileInfo createFileInfo(IPath path, IFolderInfo base, ITool baseTool, String id, String name); IFileInfo createFileInfo(IPath path, IFileInfo base, String id, String name); @@ -554,49 +564,49 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont IFolderInfo createFolderInfo(IPath path); IFolderInfo createFolderInfo(IPath path, String id, String name); - + IFolderInfo createFolderInfo(IPath path, IFolderInfo base, String id, String name); - + CConfigurationData getConfigurationData(); - + ICSourceEntry[] getSourceEntries(); void setSourceEntries(ICSourceEntry[] entries); - + CBuildData getBuildData(); - + IBuilder getBuilder(); - + IBuilder getEditableBuilder(); - + String getOutputPrefix(String outputExtension); - + boolean isSystemObject(); - + String getOutputExtension(String resourceExtension); - + String getOutputFlag(String outputExt); - - IManagedCommandLineInfo generateToolCommandLineInfo( String sourceExtension, String[] flags, + + IManagedCommandLineInfo generateToolCommandLineInfo( String sourceExtension, String[] flags, String outputFlag, String outputPrefix, String outputName, String[] inputResources, IPath inputLocation, IPath outputLocation ); - + String[] getUserObjects(String extension); - + String[] getLibs(String extension); - + boolean buildsFileType(String srcExt); - + boolean supportsBuild(boolean managed); - + boolean isManagedBuildOn(); void setManagedBuildOn(boolean on) throws BuildException; - + boolean isBuilderCompatible(IBuilder builder); - + void changeBuilder(IBuilder newBuilder, String id, String name); - + IBuildPropertyValue getBuildArtefactType(); - + void setBuildArtefactType(String id) throws BuildException; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java index 57cba447fca..c41dba208ac 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java @@ -16,19 +16,19 @@ import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier; /** - * This interface represents a tool-integrator-defined, ordered set of tools - * that transform the project's input into the project's outputs. A - * tool-chain can be defined as part of a configuration, or as an + * This interface represents a tool-integrator-defined, ordered set of tools + * that transform the project's input into the project's outputs. A + * tool-chain can be defined as part of a configuration, or as an * independent specification that is referenced in a separate configuration * via the toolChain superclass attribute. *

* The toolChain contains one or more children of type tool. These define - * the tools used in the tool-chain. The toolChain contains one child of + * the tools used in the tool-chain. The toolChain contains one child of * type targetPlatform. This defines the architecture/os combination where - * the outputs of the project can be deployed. The toolChain contains one + * the outputs of the project can be deployed. The toolChain contains one * child of type builder. This defines the "build" or "make" utility that * is used to drive the transformation of the inputs into outputs. - * + * * @since 2.1 * @noextend This class is not intended to be subclassed by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -49,13 +49,16 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { public static final String IS_SYSTEM= "isSystem"; //$NON-NLS-1$ public static final String NON_INTERNAL_BUILDER_ID = "nonInternalBuilderId"; //$NON-NLS-1$ public static final String RESOURCE_TYPE_BASED_DISCOVERY = "resourceTypeBasedDiscovery"; //$NON-NLS-1$ - + // The attribute name for the scanner info collector public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$ + /** @since 8.1 */ + public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$ + /** * Returns the configuration that is the parent of this tool-chain. - * + * * @return IConfiguration */ public IConfiguration getParent(); @@ -67,14 +70,14 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { * @param Id The id for the new tool chain * @param name The name for the new tool chain * @param isExtensionElement Indicates whether this is an extension element or a managed project element - * + * * @return ITargetPlatform */ public ITargetPlatform createTargetPlatform(ITargetPlatform superClass, String Id, String name, boolean isExtensionElement); /** * Returns the target-platform child of this tool-chain - * + * * @return ITargetPlatform */ public ITargetPlatform getTargetPlatform(); @@ -87,30 +90,30 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { /** * Returns the 'versionsSupported' of this tool-chain - * + * * @return String */ public String getVersionsSupported(); /** * Returns the 'convertToId' of this tool-chain - * + * * @return String */ public String getConvertToId(); - + /** - * Sets the 'versionsSupported' attribute of the tool-chain. + * Sets the 'versionsSupported' attribute of the tool-chain. */ - + public void setVersionsSupported(String versionsSupported); - + /** - * Sets the 'convertToId' attribute of the tool-chain. + * Sets the 'convertToId' attribute of the tool-chain. */ public void setConvertToId(String convertToId); - + /** * Creates the Builder child of this tool-chain. * @@ -118,7 +121,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { * @param Id The id for the new tool chain * @param name The name for the new tool chain * @param isExtensionElement Indicates whether this is an extension element or a managed project element - * + * * @return IBuilder */ public IBuilder createBuilder(IBuilder superClass, String Id, String name, boolean isExtensionElement); @@ -131,7 +134,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { /** * Returns the builder child of this tool-chain. - * + * * @return IBuilder */ public IBuilder getBuilder(); @@ -143,35 +146,35 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { * @param Id The id for the new tool chain * @param name The name for the new tool chain * @param isExtensionElement Indicates whether this is an extension element or a managed project element - * + * * @return ITool */ public ITool createTool(ITool superClass, String Id, String name, boolean isExtensionElement); /** * Returns an array of tool children of this tool-chain - * + * * @return ITool[] */ public ITool[] getTools(); /** - * Returns the tool in this tool-chain with the ID specified in the argument, - * or null - * + * Returns the tool in this tool-chain with the ID specified in the argument, + * or null + * * @param id The ID of the requested tool * @return ITool */ public ITool getTool(String id); /** - * Returns the ITool in the tool-chain with the specified - * ID, or the tool(s) with a superclass with this id. - * - *

If the tool-chain does not have a tool with that ID, the method - * returns an empty array. It is the responsibility of the caller to - * verify the return value. - * + * Returns the ITool in the tool-chain with the specified + * ID, or the tool(s) with a superclass with this id. + * + *

If the tool-chain does not have a tool with that ID, the method + * returns an empty array. It is the responsibility of the caller to + * verify the return value. + * * @param id unique identifier of the tool to search for * @return ITool[] * @since 3.0.2 @@ -181,55 +184,55 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { /** * Returns the IToolChain that is the superclass of this * tool-chain, or null if the attribute was not specified. - * + * * @return IToolChain */ public IToolChain getSuperClass(); - + /** * Returns whether this element is abstract. Returns false * if the attribute was not specified. - * @return boolean + * @return boolean */ public boolean isAbstract(); /** - * Sets the isAbstract attribute of the tool-chain. + * Sets the isAbstract attribute of the tool-chain. */ public void setIsAbstract(boolean b); - + /** * Returns a semi-colon delimited list of child Ids of the superclass' * children that should not be automatically inherited by this element. - * Returns an empty string if the attribute was not specified. - * @return String + * Returns an empty string if the attribute was not specified. + * @return String */ public String getUnusedChildren(); - + /** * Returns an array of operating systems the tool-chain outputs can run on. - * + * * @return String[] */ public String[] getOSList(); /** * Sets the OS list. - * + * * @param OSs The list of OS names */ public void setOSList(String[] OSs); - + /** * Returns an array of architectures the tool-chain outputs can run on. - * + * * @return String[] */ public String[] getArchList(); - + /** * Sets the architecture list. - * + * * @param archs The list of architecture names */ public void setArchList(String[] archs); @@ -237,7 +240,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { /** * Returns the semicolon separated list of unique IDs of the error parsers associated * with the tool-chain. - * + * * @return String */ public String getErrorParserIds(); @@ -249,9 +252,9 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { public String getErrorParserIds(IConfiguration config); /** - * Returns the ordered list of unique IDs of the error parsers associated with the + * Returns the ordered list of unique IDs of the error parsers associated with the * tool-chain. - * + * * @return String[] */ public String[] getErrorParserList(); @@ -262,8 +265,17 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { public void setErrorParserIds(String ids); /** - * Returns the scanner config discovery profile id or null if none. - * + * Returns the default language settings providers IDs. + * + * @return the default language settings providers IDs separated by semicolon or {@code null} if none. + * + * @since 8.1 + */ + public String getDefaultLanguageSettingsProviderIds(); + + /** + * Returns the scanner config discovery profile id or null if none. + * * @return String */ public String getScannerConfigDiscoveryProfileId(); @@ -274,93 +286,93 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { public void setScannerConfigDiscoveryProfileId(String profileId); /** - * Returns the sem-colon separated list of Tool ids containing each - * tool that can create the final build artifact (the end target of - * the build). MBS will use the first ID in the list that matches - * a Tool in the ToolChain. One reason for specifying a list, is - * that different versions of a tool can be selected based upon the + * Returns the sem-colon separated list of Tool ids containing each + * tool that can create the final build artifact (the end target of + * the build). MBS will use the first ID in the list that matches + * a Tool in the ToolChain. One reason for specifying a list, is + * that different versions of a tool can be selected based upon the * project nature (e.g. different tool definitions for a linker for C vs. C++). - * + * * @return String */ public String getTargetToolIds(); /** - * Sets the sem-colon separated list of Tool ids containing each - * tool that can create the final build artifact (the end target of - * the build). + * Sets the sem-colon separated list of Tool ids containing each + * tool that can create the final build artifact (the end target of + * the build). */ public void setTargetToolIds(String targetToolIds); /** - * Returns the list of Tool ids containing each - * tool that can create the final build artifact (the end target of - * the build). MBS will use the first ID in the list that matches - * a Tool in the ToolChain. One reason for specifying a list, is - * that different versions of a tool can be selected based upon the + * Returns the list of Tool ids containing each + * tool that can create the final build artifact (the end target of + * the build). MBS will use the first ID in the list that matches + * a Tool in the ToolChain. One reason for specifying a list, is + * that different versions of a tool can be selected based upon the * project nature (e.g. different tool definitions for a linker for C vs. C++). - * + * * @return String[] */ public String[] getTargetToolList(); - + /** - * Returns the OutputTypes in this tool-chain, besides the primary - * output of the targetTool, that are also considered to be build - * artifacts. - * + * Returns the OutputTypes in this tool-chain, besides the primary + * output of the targetTool, that are also considered to be build + * artifacts. + * * @return IOutputType[] */ public IOutputType[] getSecondaryOutputs(); - + /** - * Sets the semicolon separated list of OutputType identifiers in + * Sets the semicolon separated list of OutputType identifiers in * this tool-chain, besides the primary output of the targetTool, - * that are also considered to be build artifacts. + * that are also considered to be build artifacts. */ public void setSecondaryOutputs(String ids); /** - * Returns true if this tool-chain has changes that need to + * Returns true if this tool-chain has changes that need to * be saved in the project file, else false. - * - * @return boolean + * + * @return boolean */ public boolean isDirty(); - + /** * Sets the element's "dirty" (have I been modified?) flag. */ public void setDirty(boolean isDirty); - + /** * Returns true if this tool-chain was loaded from a manifest file, * and false if it was loaded from a project (.cdtbuild) file. - * - * @return boolean + * + * @return boolean */ public boolean isExtensionElement(); - + /** * Returns true if the tool-chain support is installed on the system * otherwise returns false - * - * @return boolean - */ + * + * @return boolean + */ public boolean isSupported(); - + /** * Returns the tool-integrator provided implementation of the configuration environment variable supplier - * or null if none. - * + * or null if none. + * * @return IConfigurationEnvironmentVariableSupplier */ public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier(); - + /** * Returns the tool-integrator provided implementation of the configuration build macro supplier - * or null if none. - * + * or null if none. + * * @return IConfigurationBuildMacroSupplier */ public IConfigurationBuildMacroSupplier getBuildMacroSupplier(); @@ -370,16 +382,16 @@ public interface IToolChain extends IBuildObject, IHoldsOptions { * or null, if no conversion is required */ public IOptionPathConverter getOptionPathConverter() ; - + IFolderInfo getParentFolderInfo(); - + CTargetPlatformData getTargetPlatformData(); - + boolean supportsBuild(boolean managed); - + boolean isSystemObject(); - + boolean matches(IToolChain tc); - + String getUniqueRealName(); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java index 8a55afcaead..c6202bbb744 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2011 IBM Corporation and others. + * Copyright (c) 2003, 2012 IBM Corporation 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 @@ -92,6 +92,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild private static final String EMPTY_STRING = ""; //$NON-NLS-1$ private static final String EMPTY_CFG_ID = "org.eclipse.cdt.build.core.emptycfg"; //$NON-NLS-1$ + private static final String LANGUAGE_SETTINGS_PROVIDER_DELIMITER = ";"; //$NON-NLS-1$ + private static final String LANGUAGE_SETTINGS_PROVIDER_NEGATION_SIGN = "-"; //$NON-NLS-1$ + private static final String $TOOLCHAIN = "${Toolchain}"; //$NON-NLS-1$ // Parent and children private String parentId; @@ -102,6 +105,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild private String cleanCommand; private String artifactExtension; private String errorParserIds; + private String defaultLanguageSettingsProvidersAttribute; + private String[] defaultLanguageSettingsProviderIds; private String prebuildStep; private String postbuildStep; private String preannouncebuildStep; @@ -781,6 +786,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild // Get the semicolon separated list of IDs of the error parsers errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS)); + // Get the initial/default language settings providers IDs + defaultLanguageSettingsProvidersAttribute = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS)); + // Get the artifact extension artifactExtension = SafeStringInterner.safeIntern(element.getAttribute(EXTENSION)); @@ -1453,6 +1461,62 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild return set; } + /** + * Get value of attribute {@link IConfiguration#LANGUAGE_SETTINGS_PROVIDERS} + * It not defined, it will try to pull the attribute from the parent configuration. + */ + private String getDefaultLanguageSettingsProvidersAttribute() { + if (defaultLanguageSettingsProvidersAttribute == null && parent instanceof Configuration) { + defaultLanguageSettingsProvidersAttribute = ((Configuration) parent).getDefaultLanguageSettingsProvidersAttribute(); + } + + return defaultLanguageSettingsProvidersAttribute; + } + + /** + * {@inheritDoc} + * + * This function will try to find default provider Ids specified in this instance. + * It none defined, it will try to pull Ids from the parent configuration. + */ + @Override + public String[] getDefaultLanguageSettingsProviderIds() { + defaultLanguageSettingsProviderIds = null; + if (defaultLanguageSettingsProviderIds == null) { + defaultLanguageSettingsProvidersAttribute = getDefaultLanguageSettingsProvidersAttribute(); + if (defaultLanguageSettingsProvidersAttribute != null) { + List ids = new ArrayList(); + String[] defaultIds = defaultLanguageSettingsProvidersAttribute.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER); + for (String id : defaultIds) { + if (id != null && !id.isEmpty()) { + if (id.startsWith(LANGUAGE_SETTINGS_PROVIDER_NEGATION_SIGN)) { + id = id.substring(1); + ids.remove(id); + } else if (!ids.contains(id)) { + if (id.contains($TOOLCHAIN)) { + IToolChain toolchain = getToolChain(); + if (toolchain != null) { + String toolchainProvidersIds = toolchain.getDefaultLanguageSettingsProviderIds(); + if (toolchainProvidersIds != null) { + ids.addAll(Arrays.asList(toolchainProvidersIds.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER))); + } + } + } else { + ids.add(id); + } + } + } + + } + defaultLanguageSettingsProviderIds = ids.toArray(new String[ids.size()]); + } else if (parent != null) { + defaultLanguageSettingsProviderIds = parent.getDefaultLanguageSettingsProviderIds(); + } + } + + return defaultLanguageSettingsProviderIds; + } + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String) */ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java index 7932e7b2f39..63953098db2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.StringTokenizer; import java.util.Vector; +import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport; import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.LanguageManager; import org.eclipse.cdt.core.settings.model.ICStorageElement; @@ -24,6 +25,7 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil; import org.eclipse.cdt.internal.core.SafeStringInterner; import org.eclipse.cdt.managedbuilder.core.IAdditionalInput; import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IFileInfo; import org.eclipse.cdt.managedbuilder.core.IInputOrder; import org.eclipse.cdt.managedbuilder.core.IInputType; @@ -37,6 +39,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression; import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; @@ -1838,9 +1841,58 @@ public class InputType extends BuildObject implements IInputType { return id; } - public String getDiscoveryProfileIdAttribute(){ - if(buildInfoDicsoveryProfileId == null && superClass != null) - return ((InputType)superClass).getDiscoveryProfileIdAttribute(); + /** + * Check if legacy scanner discovery method should be used. + */ + private boolean isLegacyScannerDiscovery() { + boolean isLanguageSettingsProvidersEnabled = false; + ITool tool = getParent(); + if (tool!=null) { + IBuildObject bo = tool.getParent(); + if (bo instanceof IToolChain) { + IConfiguration cfg = ((IToolChain) bo).getParent(); + if (cfg!=null) { + IResource rc = cfg.getOwner(); + if (rc!=null) { + IProject project = rc.getProject(); + isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project); + } + } + } + } + return !isLanguageSettingsProvidersEnabled; + } + + /** + * Temporary method to support compatibility during SD transition. + * @noreference This method is not intended to be referenced by clients. + */ + public String getLegacyDiscoveryProfileIdAttribute() { + String profileId = buildInfoDicsoveryProfileId; + if (profileId == null) { + profileId = ScannerDiscoveryLegacySupport.getDeprecatedLegacyProfiles(id); + if (profileId == null && superClass instanceof InputType) { + profileId = ((InputType)superClass).getLegacyDiscoveryProfileIdAttribute(); + } + } + return profileId; + } + + public String getDiscoveryProfileIdAttribute() { + if (isLegacyScannerDiscovery()) { + return getLegacyDiscoveryProfileIdAttribute(); + } + + return getDiscoveryProfileIdAttributeInternal(); + } + + /** + * Do not inline! This method needs to call itself recursively. + */ + private String getDiscoveryProfileIdAttributeInternal() { + if (buildInfoDicsoveryProfileId == null && superClass instanceof InputType) { + return ((InputType)superClass).getDiscoveryProfileIdAttributeInternal(); + } return buildInfoDicsoveryProfileId; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java index 0b1f6c233e5..3c5b5531772 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java @@ -50,16 +50,16 @@ import org.eclipse.core.runtime.IPath; import org.osgi.framework.Version; /** - * This class represents a set of configurations + * This class represents a set of configurations * to be edited simultaneously on property pages. */ public class MultiConfiguration extends MultiItemsHolder implements IMultiConfiguration { private static final String[] EMPTY_STR_ARRAY = new String[0]; - + protected IConfiguration[] fCfgs = null; private int curr = 0; - + public MultiConfiguration(IConfiguration[] cfs) { fCfgs = cfs; for (int i=0; i getDefaultLanguageSettingsProviders(IConfiguration cfg) { + List providers = new ArrayList(); + String[] ids = cfg.getDefaultLanguageSettingsProviderIds(); + if (ids != null) { + for (String id : ids) { + ILanguageSettingsProvider provider = null; + if (!LanguageSettingsManager.isPreferShared(id)) { + provider = LanguageSettingsManager.getExtensionProviderCopy(id, false); + } + if (provider == null) { + provider = LanguageSettingsManager.getWorkspaceProvider(id); + } + providers.add(provider); + } + } + + if (providers.isEmpty()) { + providers = ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy(); + } + + return providers; + } + + private static void setDefaultLanguageSettingsProvidersIds(IConfiguration cfg, ICConfigurationDescription cfgDescription) { + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { + List providers = getDefaultLanguageSettingsProviders(cfg); + String[] ids = new String[providers.size()]; + for (int i = 0; i < ids.length; i++) { + ILanguageSettingsProvider provider = providers.get(i); + ids[i] = provider.getId(); + } + ((ILanguageSettingsProvidersKeeper) cfgDescription).setDefaultLanguageSettingsProvidersIds(ids); + } + + } + + public static void setDefaultLanguageSettingsProviders(IProject project, IConfiguration cfg, ICConfigurationDescription cfgDescription) { + // propagate the preference to project properties + boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null); + ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled); + + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { + ConfigurationDataProvider.setDefaultLanguageSettingsProvidersIds(cfg, cfgDescription); + List providers = ConfigurationDataProvider.getDefaultLanguageSettingsProviders(cfg); + ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers); + } + } + private boolean isPersistedCfg(ICConfigurationDescription cfgDescription){ return cfgDescription.getSessionProperty(CFG_PERSISTED_PROPERTY) != null; } diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml index 146c331769c..db5faa8aa54 100644 --- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml @@ -1269,7 +1269,6 @@ dependencyExtensions="h" dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2" id="cdt.managedbuild.tool.gnu.c.compiler.input" - scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile" languageId="org.eclipse.cdt.core.gcc"> + /> + /> + archList="all" + id="cdt.managedbuild.toolchain.gnu.base" + languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" + name="%ToolChainName.Linux" + osList="linux,hpux,aix,qnx" + targetTool="cdt.managedbuild.tool.gnu.c.linker;cdt.managedbuild.tool.gnu.cpp.linker;cdt.managedbuild.tool.gnu.archiver"> @@ -1842,6 +1842,7 @@ configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier" id="cdt.managedbuild.toolchain.gnu.mingw.base" isToolChainSupported="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwIsToolChainSupported" + languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" name="%ToolChainName.MinGW" osList="win32" targetTool="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base;cdt.managedbuild.tool.gnu.c.linker.mingw.base;cdt.managedbuild.tool.gnu.archiver"> @@ -2083,9 +2084,9 @@ + id="cdt.managedbuild.config.gnu.base" + languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"> - - - - - - - + artifactExtension="exe" + cleanCommand="rm -rf" + id="cdt.managedbuild.config.gnu.cygwin.base" + languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"> + + + + + + + + artifactExtension="exe" + cleanCommand="rm -rf" + id="cdt.managedbuild.config.gnu.mingw.base" + languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"> - + + + + + + + diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java index 5986337af0e..69436a7ed94 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java @@ -223,6 +223,7 @@ public class Messages extends NLS { public static String PropertyPageDefsTab_9; public static String PropertyPageDefsTab_showIncludeFileTab; public static String PropertyPageDefsTab_showProvidersTab; + public static String PropertyPageDefsTab_showScannerDiscoveryTab; public static String RefreshPolicyExceptionDialog_addDialogLabel; public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message; public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title; diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties index a39e5245364..59bc380dca0 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties @@ -274,7 +274,8 @@ PropertyPageDefsTab_7=Show disc. page names if they are unique. Else show profil PropertyPageDefsTab_8=Always show names + profile IDs PropertyPageDefsTab_9=Always show profile IDs only PropertyPageDefsTab_showIncludeFileTab=Display "Include Files" tab -PropertyPageDefsTab_showProvidersTab=Display "Preprocessor Include Paths" tabs +PropertyPageDefsTab_showProvidersTab=Display "Preprocessor Include Paths" tab and enable language settings providers +PropertyPageDefsTab_showScannerDiscoveryTab=Display "Scanner Discovery" tab ProjectConvert_convertersList=Converters List AbstractPrefPage_0=\ Preference settings will be applied to new projects \n only when there were no toolchains selected. diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PropertyPageDefsTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PropertyPageDefsTab.java index 9c6bb0af7ee..c54c02609fd 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PropertyPageDefsTab.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PropertyPageDefsTab.java @@ -11,8 +11,8 @@ *******************************************************************************/ package org.eclipse.cdt.managedbuilder.ui.preferences; +import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport; import org.eclipse.cdt.core.settings.model.ICResourceDescription; -import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage; import org.eclipse.cdt.managedbuilder.internal.ui.Messages; import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; import org.eclipse.cdt.ui.newui.CDTPrefUtil; @@ -34,109 +34,116 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab { private static final int SPACING = 5; // for radio buttons layout - private Button show_tree; - private Button show_inc_files; - private Button show_mng; - private Button show_tool; - private Button show_exp; - private Button show_providers_tab; // temporary checkbox for scanner discovery Providers tab - private Button show_tipbox; + private Button show_tree; + private Button show_inc_files; + private Button show_mng; + private Button show_tool; + private Button show_exp; + private Button show_sd; + private Button show_providers_tab; // temporary checkbox for scanner discovery Providers tab + private Button show_tipbox; - private Button b_0; - private Button b_1; - private Button b_2; - private Button b_3; + private Button b_0; + private Button b_1; + private Button b_2; + private Button b_3; - private Button s_0; - private Button s_1; - private Button s_2; + private Button s_0; + private Button s_1; + private Button s_2; @Override public void createControls(Composite parent) { super.createControls(parent); usercomp.setLayout(new GridLayout(1, false)); - show_mng = new Button(usercomp, SWT.CHECK); - show_mng.setText(Messages.PropertyPageDefsTab_0); - show_mng.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_mng = new Button(usercomp, SWT.CHECK); + show_mng.setText(Messages.PropertyPageDefsTab_0); + show_mng.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - show_inc_files = new Button(usercomp, SWT.CHECK); - show_inc_files.setText(Messages.PropertyPageDefsTab_showIncludeFileTab); - show_inc_files.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_inc_files = new Button(usercomp, SWT.CHECK); + show_inc_files.setText(Messages.PropertyPageDefsTab_showIncludeFileTab); + show_inc_files.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); show_tree = new Button(usercomp, SWT.CHECK); - show_tree.setText(Messages.PropertyPageDefsTab_1); - show_tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_tree.setText(Messages.PropertyPageDefsTab_1); + show_tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); show_tool = new Button(usercomp, SWT.CHECK); - show_tool.setText(Messages.PropertyPageDefsTab_4); - show_tool.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_tool.setText(Messages.PropertyPageDefsTab_4); + show_tool.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); show_exp = new Button(usercomp, SWT.CHECK); - show_exp.setText(Messages.PropertyPageDefsTab_10); - show_exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_exp.setText(Messages.PropertyPageDefsTab_10); + show_exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - show_providers_tab = new Button(usercomp, SWT.CHECK); - show_providers_tab.setText(Messages.PropertyPageDefsTab_showProvidersTab); - show_providers_tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_sd = new Button(usercomp, SWT.CHECK); + show_sd.setText(Messages.PropertyPageDefsTab_showScannerDiscoveryTab); + show_sd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - show_tipbox = new Button(usercomp, SWT.CHECK); - show_tipbox.setText(Messages.PropertyPageDefsTab_16); - show_tipbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + show_providers_tab = new Button(usercomp, SWT.CHECK); + show_providers_tab.setText(Messages.PropertyPageDefsTab_showProvidersTab); + show_providers_tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Group saveGrp = new Group(usercomp, SWT.NONE); - saveGrp.setText(Messages.PropertyPageDefsTab_11); - saveGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - FillLayout fl = new FillLayout(SWT.VERTICAL); - fl.spacing = SPACING; - fl.marginHeight = SPACING; - fl.marginWidth = SPACING; - saveGrp.setLayout(fl); + show_tipbox = new Button(usercomp, SWT.CHECK); + show_tipbox.setText(Messages.PropertyPageDefsTab_16); + show_tipbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - s_0 = new Button(saveGrp, SWT.RADIO); - s_0.setText(Messages.PropertyPageDefsTab_13); - s_1 = new Button(saveGrp, SWT.RADIO); - s_1.setText(Messages.PropertyPageDefsTab_12); - s_2 = new Button(saveGrp, SWT.RADIO); - s_2.setText(Messages.PropertyPageDefsTab_14); + Group saveGrp = new Group(usercomp, SWT.NONE); + saveGrp.setText(Messages.PropertyPageDefsTab_11); + saveGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + FillLayout fl = new FillLayout(SWT.VERTICAL); + fl.spacing = SPACING; + fl.marginHeight = SPACING; + fl.marginWidth = SPACING; + saveGrp.setLayout(fl); - Group discGrp = new Group(usercomp, SWT.NONE); - discGrp.setText(Messages.PropertyPageDefsTab_5); - discGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fl = new FillLayout(SWT.VERTICAL); - fl.spacing = SPACING; - fl.marginHeight = SPACING; - fl.marginWidth = SPACING; - discGrp.setLayout(fl); + s_0 = new Button(saveGrp, SWT.RADIO); + s_0.setText(Messages.PropertyPageDefsTab_13); + s_1 = new Button(saveGrp, SWT.RADIO); + s_1.setText(Messages.PropertyPageDefsTab_12); + s_2 = new Button(saveGrp, SWT.RADIO); + s_2.setText(Messages.PropertyPageDefsTab_14); - b_0 = new Button(discGrp, SWT.RADIO); - b_0.setText(Messages.PropertyPageDefsTab_6); - b_1 = new Button(discGrp, SWT.RADIO); - b_1.setText(Messages.PropertyPageDefsTab_7); - b_2 = new Button(discGrp, SWT.RADIO); - b_2.setText(Messages.PropertyPageDefsTab_8); - b_3 = new Button(discGrp, SWT.RADIO); - b_3.setText(Messages.PropertyPageDefsTab_9); + Group discGrp = new Group(usercomp, SWT.NONE); + discGrp.setText(Messages.PropertyPageDefsTab_5); + discGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + fl = new FillLayout(SWT.VERTICAL); + fl.spacing = SPACING; + fl.marginHeight = SPACING; + fl.marginWidth = SPACING; + discGrp.setLayout(fl); - show_inc_files.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_SHOW_INC_FILES)); - show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE)); + b_0 = new Button(discGrp, SWT.RADIO); + b_0.setText(Messages.PropertyPageDefsTab_6); + b_1 = new Button(discGrp, SWT.RADIO); + b_1.setText(Messages.PropertyPageDefsTab_7); + b_2 = new Button(discGrp, SWT.RADIO); + b_2.setText(Messages.PropertyPageDefsTab_8); + b_3 = new Button(discGrp, SWT.RADIO); + b_3.setText(Messages.PropertyPageDefsTab_9); + + show_inc_files.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_SHOW_INC_FILES)); + show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE)); show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG)); show_tool.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOTOOLM)); show_exp.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT)); - show_providers_tab.setSelection(!CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NO_SHOW_PROVIDERS)); + // ensure default is "true" for scanner discovery tab + show_sd.setSelection(!CDTPrefUtil.getStr(CDTPrefUtil.KEY_SHOW_SD).equals(Boolean.FALSE.toString())); + show_providers_tab.setSelection(ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null)); show_tipbox.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_TIPBOX)); switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES)) { - case CDTPrefUtil.DISC_NAMING_UNIQUE_OR_BOTH: b_0.setSelection(true); break; - case CDTPrefUtil.DISC_NAMING_UNIQUE_OR_IDS: b_1.setSelection(true); break; - case CDTPrefUtil.DISC_NAMING_ALWAYS_BOTH: b_2.setSelection(true); break; - case CDTPrefUtil.DISC_NAMING_ALWAYS_IDS: b_3.setSelection(true); break; + case CDTPrefUtil.DISC_NAMING_UNIQUE_OR_BOTH: b_0.setSelection(true); break; + case CDTPrefUtil.DISC_NAMING_UNIQUE_OR_IDS: b_1.setSelection(true); break; + case CDTPrefUtil.DISC_NAMING_ALWAYS_BOTH: b_2.setSelection(true); break; + case CDTPrefUtil.DISC_NAMING_ALWAYS_IDS: b_3.setSelection(true); break; } switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_POSSAVE)) { - case CDTPrefUtil.POSITION_SAVE_BOTH: s_1.setSelection(true); break; - case CDTPrefUtil.POSITION_SAVE_NONE: s_2.setSelection(true); break; - default: s_0.setSelection(true); break; + case CDTPrefUtil.POSITION_SAVE_BOTH: s_1.setSelection(true); break; + case CDTPrefUtil.POSITION_SAVE_NONE: s_2.setSelection(true); break; + default: s_0.setSelection(true); break; } } @@ -147,7 +154,9 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab { CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection()); CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOTOOLM, !show_tool.getSelection()); CDTPrefUtil.setBool(CDTPrefUtil.KEY_EXPORT, show_exp.getSelection()); - CDTPrefUtil.setBool(LanguageSettingsProvidersPage.KEY_NO_SHOW_PROVIDERS, !show_providers_tab.getSelection()); + // ensure default is "true" for scanner discovery tab + CDTPrefUtil.setStr(CDTPrefUtil.KEY_SHOW_SD, Boolean.toString(show_sd.getSelection())); + ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(null, show_providers_tab.getSelection()); CDTPrefUtil.setBool(CDTPrefUtil.KEY_TIPBOX, show_tipbox.getSelection()); int x = 0; if (b_1.getSelection()) x = 1; @@ -168,7 +177,8 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab { show_mng.setSelection(true); show_tool.setSelection(true); show_exp.setSelection(false); - show_providers_tab.setSelection(false); + show_sd.setSelection(true); + show_providers_tab.setSelection(true); show_tipbox.setSelection(false); b_0.setSelection(true); b_1.setSelection(false); diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java index 73be50d9ad8..8d204ec1f7f 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java @@ -41,8 +41,9 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; -import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin; +import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; import org.eclipse.cdt.managedbuilder.internal.ui.Messages; +import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin; import org.eclipse.cdt.ui.newui.CDTPrefUtil; import org.eclipse.cdt.ui.templateengine.IWizardDataPage; import org.eclipse.cdt.ui.templateengine.Template; @@ -73,10 +74,10 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; /** * This object is created per each Project type - * + * * It is responsible for: * - corresponding line in left pane of 1st wizard page - * - whole view of right pane, including + * - whole view of right pane, including * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. @@ -84,16 +85,17 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; public class MBSWizardHandler extends CWizardHandler { public static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$ public static final String EMPTY_STR = ""; //$NON-NLS-1$ - + private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$ private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$ - private static final String tooltip = - Messages.CWizardHandler_1 + - Messages.CWizardHandler_2 + - Messages.CWizardHandler_3 + - Messages.CWizardHandler_4 + - Messages.CWizardHandler_5; - + + private static final String tooltip = + Messages.CWizardHandler_1 + + Messages.CWizardHandler_2 + + Messages.CWizardHandler_3 + + Messages.CWizardHandler_4 + + Messages.CWizardHandler_5; + protected SortedMap full_tcs = new TreeMap(); private String propertyId = null; private IProjectType pt = null; @@ -102,16 +104,16 @@ public class MBSWizardHandler extends CWizardHandler { private IToolChain[] savedToolChains = null; private IWizard wizard; private IWizardPage startingPage; -// private EntryDescriptor entryDescriptor = null; + // private EntryDescriptor entryDescriptor = null; private EntryInfo entryInfo; protected CfgHolder[] cfgs = null; protected IWizardPage[] customPages; - + /** * Current list of preferred toolchains */ private List preferredTCs = new ArrayList(); - + protected static final class EntryInfo { private SortedMap tcs; private EntryDescriptor entryDescriptor; @@ -124,12 +126,12 @@ public class MBSWizardHandler extends CWizardHandler { private IWizardPage predatingPage; private IWizardPage followingPage; private IWizard wizard; - + public EntryInfo(EntryDescriptor dr, SortedMap _tcs){ entryDescriptor = dr; tcs = _tcs; } - + /** * @since 5.1 */ @@ -137,7 +139,7 @@ public class MBSWizardHandler extends CWizardHandler { this(dr, _tcs); wizard = w; } - + public boolean isValid(){ initialize(); return isValid; @@ -147,7 +149,7 @@ public class MBSWizardHandler extends CWizardHandler { initialize(); return template; } - + public EntryDescriptor getDescriptor(){ return entryDescriptor; } @@ -155,19 +157,19 @@ public class MBSWizardHandler extends CWizardHandler { private void initialize(){ if(initialized) return; - + do { if(entryDescriptor == null) break; String path[] = entryDescriptor.getPathArray(); if(path == null || path.length == 0) break; - + projectTypeId = path[0]; - if(!entryDescriptor.isDefaultForCategory() && + if(!entryDescriptor.isDefaultForCategory() && path.length > 1 && (!path[0].equals(ManagedBuildWizard.OTHERS_LABEL))){ - templateId = path[path.length - 1]; - Template templates[] = null; + templateId = path[path.length - 1]; + Template templates[] = null; if(wizard instanceof ICDTCommonProjectWizard) { ICDTCommonProjectWizard wz = (ICDTCommonProjectWizard)wizard; String[] langIDs = wz.getLanguageIDs(); @@ -175,42 +177,42 @@ public class MBSWizardHandler extends CWizardHandler { List