# HG changeset patch # User timkelly # Date 1281991604 18000 # Node ID dbcd41027a63f6518fbb75cf1dc64f2b80d551a3 # Parent 04886bcd351942456c84e00fc1ae8ab3e4bbf262 more API cleanup on ICarbidePrefsModifier diff -r 04886bcd3519 -r dbcd41027a63 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java Mon Aug 16 12:24:24 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java Mon Aug 16 15:46:44 2010 -0500 @@ -68,26 +68,27 @@ // get ICarbidePrefsModifier extProvider = CarbideBuilderPlugin.getBuildManager().getPrefsModifier(); + // this will be false once abld is deprecated + assertTrue(extProvider.isSupportedConfigurationPrefId(cpi.getDefaultConfiguration(), ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)); + + assertFalse(extProvider.isSupportedConfigurationPrefId(cpi.getDefaultConfiguration(), "bad_id")); + assertNotNull(extProvider); // will be null when SBSv1 support is removed - String original = extProvider.getValue(cpi.getDefaultConfiguration().getBuildContext(), ABLD_BUILD_ARG_SETTING); + String original = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); assertTrue(original.equals("")); - extProvider.setValue(cpi.getDefaultConfiguration() - .getBuildContext(), "FOO", ABLD_BUILD_ARG_SETTING); + extProvider.setConfigurationValue(cpi.getDefaultConfiguration(), "FOO", ABLD_BUILD_ARG_SETTING); cpi.getDefaultConfiguration().saveConfiguration(false); - String test = extProvider.getValue(cpi.getDefaultConfiguration() - .getBuildContext(), ABLD_BUILD_ARG_SETTING); + String test = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); assertTrue(test.equals("FOO")); - extProvider.setValue(cpi.getDefaultConfiguration() - .getBuildContext(), original, ABLD_BUILD_ARG_SETTING); + extProvider.setConfigurationValue(cpi.getDefaultConfiguration(), original, ABLD_BUILD_ARG_SETTING); cpi.getDefaultConfiguration().saveConfiguration(false); - test = extProvider.getValue(cpi.getDefaultConfiguration() - .getBuildContext(), ABLD_BUILD_ARG_SETTING); + test = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); assertTrue(original.equals(test)); } diff -r 04886bcd3519 -r dbcd41027a63 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java Mon Aug 16 12:24:24 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java Mon Aug 16 15:46:44 2010 -0500 @@ -16,7 +16,7 @@ */ package com.nokia.carbide.cdt.builder.extension; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; /** * Allows those using the Carbide Preferences Modifier extension point to to read @@ -43,7 +43,7 @@ * @return The String value. Or null if the the pref id is unknown or no longer in use. * @since 3.0 */ - String getValue(ISymbianBuildContext newParam, String prefID); + String getConfigurationValue(ICarbideBuildConfiguration newParam, String prefID); /** * Set the project configuration setting by ID. @@ -52,5 +52,15 @@ * @param prefID * @since 3.0 */ - void setValue(ISymbianBuildContext context, String arg, String prefID); + void setConfigurationValue(ICarbideBuildConfiguration context, String arg, String prefID); + + /** + * Test whether or not a particular prefID is supported for read/write. + * The ID tests support first by the ID, then, if configuration specific, by the ISymbianBuildContext + * @param config + * @param prefID + * @return true if the prefID is supported, false otherwise. + */ + boolean isSupportedConfigurationPrefId(ICarbideBuildConfiguration config, String prefID); + } diff -r 04886bcd3519 -r dbcd41027a63 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java Mon Aug 16 12:24:24 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java Mon Aug 16 15:46:44 2010 -0500 @@ -17,17 +17,19 @@ package com.nokia.carbide.cdt.internal.api.builder.ui; import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cpp.internal.api.sdk.BuildArgumentsInfo; import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; public class CarbidePrefsModifier implements ICarbidePrefsModifier { - public String getValue(ISymbianBuildContext context, String prefID) { + @SuppressWarnings("deprecation") + public String getConfigurationValue(ICarbideBuildConfiguration config, String prefID) { if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ - if (context instanceof ISBSv1BuildContext){ - BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy(); + if (config.getBuildContext() instanceof ISBSv1BuildContext){ + BuildArgumentsInfo info = ((ISBSv1BuildContext)config.getBuildContext()).getBuildArgumentsInfoCopy(); return info.getAbldBuildArgs(); } } @@ -35,15 +37,30 @@ return null; } - public void setValue(ISymbianBuildContext context, String arg, String prefID) { + @SuppressWarnings("deprecation") + public void setConfigurationValue(ICarbideBuildConfiguration config, String arg, String prefID) { if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ - if (context instanceof ISBSv1BuildContext){ - BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy(); + if (config.getBuildContext() instanceof ISBSv1BuildContext){ + BuildArgumentsInfo info = ((ISBSv1BuildContext)config.getBuildContext()).getBuildArgumentsInfoCopy(); info.abldBuildArgs = arg; - ((ISBSv1BuildContext)context).setBuildArgumentsInfo(info); + ((ISBSv1BuildContext)config.getBuildContext()).setBuildArgumentsInfo(info); } } } + @SuppressWarnings("deprecation") + public boolean isSupportedConfigurationPrefId( + ICarbideBuildConfiguration config, String prefID) { + + if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ + if (config.getBuildContext() instanceof ISBSv2BuildContext){ + return false; // SBSv1 only + } + return true; + } + + return false; + } + }