# HG changeset patch
# User timkelly
# Date 1281979464 18000
# Node ID 04886bcd351942456c84e00fc1ae8ab3e4bbf262
# Parent 5f8982384793821abe3fc32bf728ca3212e0eb21
update API (remove extension point) for ICarbidePrefsModifier. Updated test.
diff -r 5f8982384793 -r 04886bcd3519 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java Mon Aug 16 12:24:24 2010 -0500
@@ -36,6 +36,7 @@
suite.addTestSuite(TestProjectExportsGatherer.class);
suite.addTestSuite(BuilderPrefConstantsTest.class);
suite.addTestSuite(TestEnvironmentModifier.class);
+ suite.addTestSuite(TestCarbideProjectSettingsModifier.class);
suite.addTestSuite(TestEpocEngineHelper.class);
suite.addTestSuite(SBSv2QueryTests.class);
diff -r 5f8982384793 -r 04886bcd3519 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 Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java Mon Aug 16 12:24:24 2010 -0500
@@ -17,29 +17,19 @@
package com.nokia.carbide.cdt.builder.test;
import java.util.ArrayList;
-import java.util.List;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
-import com.nokia.cpp.internal.api.utils.core.Check;
-import com.nokia.cpp.internal.api.utils.core.Logging;
public class TestCarbideProjectSettingsModifier extends TestCase {
@@ -48,7 +38,7 @@
protected static final String PROJECT_NAME = "test-prj-modifier-project";
-
+ private static final String ABLD_BUILD_ARG_SETTING = "ABLD_BUILD_ARG_SETTING";
// First thing we have to do is actually create a project in a workspace...
protected void setUp() throws Exception {
@@ -75,70 +65,31 @@
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
assertNotNull(cpi);
- // get registry
-
- ICarbidePrefsModifier extProvider = checkForFeatureExtension();
+ // get
+ ICarbidePrefsModifier extProvider = CarbideBuilderPlugin.getBuildManager().getPrefsModifier();
assertNotNull(extProvider); // will be null when SBSv1 support is removed
- String original = extProvider.getAbdlBuildArg(cpi
- .getDefaultConfiguration().getBuildContext());
+ String original = extProvider.getValue(cpi.getDefaultConfiguration().getBuildContext(), ABLD_BUILD_ARG_SETTING);
assertTrue(original.equals(""));
- extProvider.setAbldBuildArg(cpi.getDefaultConfiguration()
- .getBuildContext(), "FOO");
+ extProvider.setValue(cpi.getDefaultConfiguration()
+ .getBuildContext(), "FOO", ABLD_BUILD_ARG_SETTING);
cpi.getDefaultConfiguration().saveConfiguration(false);
- String test = extProvider.getAbdlBuildArg(cpi.getDefaultConfiguration()
- .getBuildContext());
+ String test = extProvider.getValue(cpi.getDefaultConfiguration()
+ .getBuildContext(), ABLD_BUILD_ARG_SETTING);
assertTrue(test.equals("FOO"));
- extProvider.setAbldBuildArg(cpi.getDefaultConfiguration()
- .getBuildContext(), original);
+ extProvider.setValue(cpi.getDefaultConfiguration()
+ .getBuildContext(), original, ABLD_BUILD_ARG_SETTING);
cpi.getDefaultConfiguration().saveConfiguration(false);
- test = extProvider.getAbdlBuildArg(cpi.getDefaultConfiguration()
- .getBuildContext());
+ test = extProvider.getValue(cpi.getDefaultConfiguration()
+ .getBuildContext(), ABLD_BUILD_ARG_SETTING);
assertTrue(original.equals(test));
}
- @SuppressWarnings("deprecation")
- public static ICarbidePrefsModifier checkForFeatureExtension() {
-
- ICarbidePrefsModifier testExt = null;
- IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("com.nokia.carbide.cdt.builder.carbideProjectPrefModifier"); //$NON-NLS-1$
- IExtension[] extensions = extensionPoint.getExtensions();
-
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- IConfigurationElement[] elements = extension.getConfigurationElements();
- Check.checkContract(elements.length == 1);
- IConfigurationElement element = elements[0];
-
- boolean failed = false;
- try {
- Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
- if (extObject instanceof ICarbidePrefsModifier) {
- testExt = (ICarbidePrefsModifier)extObject;
- break;
- } else {
- failed = true;
- }
- }
- catch (CoreException e) {
- failed = true;
- }
-
- if (failed) {
- CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(),
- IStatus.ERROR,
- "Unable to load com.nokia.carbide.cdt.builder.carbideProjectPrefModifier extension from " + extension.getContributor().getName()));
- }
- }
-
- return testExt;
- }
}
diff -r 5f8982384793 -r 04886bcd3519 builder/com.nokia.carbide.cdt.builder/plugin.xml
--- a/builder/com.nokia.carbide.cdt.builder/plugin.xml Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/plugin.xml Mon Aug 16 12:24:24 2010 -0500
@@ -322,6 +322,5 @@
-
diff -r 5f8982384793 -r 04886bcd3519 builder/com.nokia.carbide.cdt.builder/schema/carbideProjectPrefModifier.exsd
--- a/builder/com.nokia.carbide.cdt.builder/schema/carbideProjectPrefModifier.exsd Fri Aug 13 17:35:50 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
- Allow read/write access to some Carbide project preferences.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [Enter the first release in which this extension point appears.]
-
-
-
-
-
-
-
-
- [Enter extension point usage example here.]
-
-
-
-
-
-
-
-
- [Enter API information here.]
-
-
-
-
-
-
-
-
- [Enter information about supplied implementation of this extension point.]
-
-
-
-
-
diff -r 5f8982384793 -r 04886bcd3519 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java Mon Aug 16 12:24:24 2010 -0500
@@ -22,6 +22,7 @@
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.core.resources.IProject;
+import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier;
@@ -83,4 +84,12 @@
*/
public void setProjectInfo(ICarbideProjectInfo newInfo);
+ /**
+ * Retrieve the ICarbidePrefsModifier interface to allow getting and setting
+ * of certain preferences by ID. This only sets values in memory, does not write
+ * to disk.
+ * @return ICarbidePrefsModifier
+ */
+ ICarbidePrefsModifier getPrefsModifier();
+
}
diff -r 5f8982384793 -r 04886bcd3519 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 Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java Mon Aug 16 12:24:24 2010 -0500
@@ -24,26 +24,33 @@
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
- * @deprecated - abld support is deprecated
+ * since 3.0
*
*/
public interface ICarbidePrefsModifier {
/**
- * Get the abld build setting from the Carbide build config arguments preference.
- * This only works with the SBSv1 buider and has no effect on other builders.
- * @param newParam
- * @return The String value. Or null if the the pref is not supported under the current context.
- * @deprecated- abld support is deprecated
+ * @deprecated - limited support for abld, String will be removed in the future so reference
+ * with your own local String.
+ * @since 3.0
*/
- String getAbdlBuildArg(ISymbianBuildContext newParam);
+ final String ABLD_BUILD_ARG_SETTING = "ABLD_BUILD_ARG_SETTING";
/**
- * Set the abld build setting from the Carbide build config arguments preference.
- * This only works with the SBSv1 buider and has no effect on other builders.
- * @param context
- * @param arg
- * @deprecated - abld support is deprecated
+ * Get the project configuration setting by ID.
+ * @param ISymbianBuildContext
+ * @param prefID
+ * @return The String value. Or null if the the pref id is unknown or no longer in use.
+ * @since 3.0
*/
- void setAbldBuildArg(ISymbianBuildContext context, String arg);
+ String getValue(ISymbianBuildContext newParam, String prefID);
+
+ /**
+ * Set the project configuration setting by ID.
+ * @param ISymbianBuildContext
+ * @param String - the argument value
+ * @param prefID
+ * @since 3.0
+ */
+ void setValue(ISymbianBuildContext context, String arg, String prefID);
}
diff -r 5f8982384793 -r 04886bcd3519 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 Fri Aug 13 17:35:50 2010 -0500
+++ b/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
@@ -23,27 +23,26 @@
public class CarbidePrefsModifier implements ICarbidePrefsModifier {
- /**
- * @deprecated
- */
- public String getAbdlBuildArg(ISymbianBuildContext context) {
+ public String getValue(ISymbianBuildContext context, String prefID) {
- if (context instanceof ISBSv1BuildContext){
- BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
- return info.getAbldBuildArgs();
+ if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){
+ if (context instanceof ISBSv1BuildContext){
+ BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
+ return info.getAbldBuildArgs();
+ }
}
return null;
}
- /**
- * @deprecated
- */
- public void setAbldBuildArg(ISymbianBuildContext context, String arg) {
- if (context instanceof ISBSv1BuildContext){
- BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
- info.abldBuildArgs = arg;
- ((ISBSv1BuildContext)context).setBuildArgumentsInfo(info);
+ public void setValue(ISymbianBuildContext context, String arg, String prefID) {
+
+ if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){
+ if (context instanceof ISBSv1BuildContext){
+ BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
+ info.abldBuildArgs = arg;
+ ((ISBSv1BuildContext)context).setBuildArgumentsInfo(info);
+ }
}
}
diff -r 5f8982384793 -r 04886bcd3519 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Fri Aug 13 17:35:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Mon Aug 16 12:24:24 2010 -0500
@@ -46,9 +46,11 @@
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
import com.nokia.carbide.cdt.builder.EpocEngineHelper;
import com.nokia.carbide.cdt.builder.ICarbideBuildManager;
+import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier;
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier;
+import com.nokia.carbide.cdt.internal.api.builder.ui.CarbidePrefsModifier;
import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
import com.nokia.cpp.internal.api.utils.core.FileUtils;
@@ -70,9 +72,15 @@
private Map projectInfoMap = new HashMap();
private MultiResourceChangeListenerDispatcher resourceChangedListener = new MultiResourceChangeListenerDispatcher();
+ ICarbidePrefsModifier clientPrefsModifier;
+
public CarbideBuildManager() {
SDKCorePlugin.getSDKManager().addInstalledSdkChangeListener(this);
+
+ if (clientPrefsModifier == null){
+ clientPrefsModifier = new CarbidePrefsModifier();
+ }
}
public boolean isCarbideProject(IProject project) {
@@ -407,5 +415,9 @@
// }
}
}
+
+ public ICarbidePrefsModifier getPrefsModifier(){
+ return clientPrefsModifier;
+ }
}