Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled.
authorEd Swartz <ed.swartz@nokia.com>
Fri, 04 Dec 2009 08:30:12 -0600
changeset 628 149f2223eff0
parent 627 6b50d727138b
child 629 c24c517fe8c2
Make sure that SBSv2 platform filtering preferences are used when SBSv1 is not enabled. Note, there is probably a bug exposed here: SBSv2 platform filtering is not used in ISymbianSDK#getFilteredBuildConfigurations() if SBSv1 is enabled.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Thu Dec 03 14:46:29 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Fri Dec 04 08:30:12 2009 -0600
@@ -14,6 +14,7 @@
 
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.*;
 import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
+import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
 import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext;
 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType;
 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType;
@@ -236,7 +237,7 @@
 		List <String>buildPlats =  getAvailablePlatforms();
 		
 		if (buildPlats.size() == 0){
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 		
 		buildTargets.add(new SymbianBuildContext(this, ISymbianBuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.DEBUG_TARGET));
@@ -313,15 +314,30 @@
 	}
  	
 	public List<ISymbianBuildContext> getFilteredBuildConfigurations() {
-		
-		 List<ISymbianBuildContext> buildContexts =  getUnfilteredBuildConfigurations();
+		// This is probably a bug, but the filtering only uses SBSv1 preferences if SBSv1 is enabled...
+		List<ISymbianBuildContext> filteredContexts;
+		if (SBSv2Utils.enableSBSv1Support()) {
+			filteredContexts = getSBSv1FilteredBuildConfigurations();
+		} else {
+			if (SBSv2Utils.enableSBSv2Support()) {
+				filteredContexts = SBSv2Utils.getFilteredSBSv2BuildContexts(this);
+			} else {
+				// be optimistic in this case... SBSv3? ;)
+				filteredContexts = getUnfilteredBuildConfigurations();
+			}
+		}
+		return filteredContexts;
+	}
+
+	protected List<ISymbianBuildContext> getSBSv1FilteredBuildConfigurations() {
+		List<ISymbianBuildContext> buildContexts =  getUnfilteredBuildConfigurations();
 		
 		if (buildContexts.size() == 0){
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 		
 		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
-		 List<BuildPlat> platFilterList = sdkMgr.getPlatformList();
+		List<BuildPlat> platFilterList = sdkMgr.getPlatformList();
 		
 		Iterator<ISymbianBuildContext> li = buildContexts.iterator();
 
@@ -343,9 +359,8 @@
 				
 			}
 		}
-
+		
 		return buildContexts;
-		
 	}
 
 	public IPath getIncludePath() {
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java	Thu Dec 03 14:46:29 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java	Fri Dec 04 08:30:12 2009 -0600
@@ -53,14 +53,16 @@
 		GridData tabFolderGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
 		tabFolder.setLayoutData(tabFolderGridData);
 		
-		TabItem sbsv1TabItem = new TabItem(tabFolder, SWT.NONE);
-		sbsv1TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv1TabText")); //$NON-NLS-1$
-		sbsv1TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv1TabToolTip")); //$NON-NLS-1$
-
-		sbsv1Tab = new SBSv1PlatformFilterComposite(tabFolder);
-		sbsv1Tab.createControls();
-		sbsv1TabItem.setControl(sbsv1Tab);
-
+		if (SBSv2Utils.enableSBSv1Support()) {
+			TabItem sbsv1TabItem = new TabItem(tabFolder, SWT.NONE);
+			sbsv1TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv1TabText")); //$NON-NLS-1$
+			sbsv1TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv1TabToolTip")); //$NON-NLS-1$
+	
+			sbsv1Tab = new SBSv1PlatformFilterComposite(tabFolder);
+			sbsv1Tab.createControls();
+			sbsv1TabItem.setControl(sbsv1Tab);
+		}
+		
 		if (SBSv2Utils.enableSBSv2Support()) {
 			TabItem sbsv2TabItem = new TabItem(tabFolder, SWT.NONE);
 			sbsv2TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv2TabText")); //$NON-NLS-1$
@@ -81,7 +83,9 @@
 	}
 	
 	public boolean performOk() {
-		sbsv1Tab.performOk();
+		if (sbsv1Tab != null) {
+			sbsv1Tab.performOk();
+		}
 		
 		if (sbsv2Tab != null) {
 			sbsv2Tab.performOk();
@@ -98,8 +102,12 @@
 
 	@Override
 	protected void performDefaults() {
-		sbsv1Tab.setDefaults();
-		sbsv2Tab.setDefaults();
+		if (sbsv1Tab != null) {
+			sbsv1Tab.setDefaults();
+		}
+		if (sbsv2Tab != null) {
+			sbsv2Tab.setDefaults();
+		}
 		super.performDefaults();
 	}
 	
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties	Thu Dec 03 14:46:29 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties	Fri Dec 04 08:30:12 2009 -0600
@@ -118,8 +118,8 @@
 BuildTargetsPage.BuildConfigsLabel=SDKs and Build Configurations
 BuildTargetsPage.BuildConfigsToolTip=Select the build configurations to create for this project.  You can add and remove these once the project has been created.
 BuildTargetsPage.FilterText=Filter SDKs based on selected template
-BuildTargetsPage.NoMatchingSDKsError=There are no matching Symbian OS SDKs installed and enabled.
-BuildTargetsPage.NoSDKsError=There are no Symbian OS SDKs installed and enabled.
+BuildTargetsPage.NoMatchingSDKsError=There are no matching Symbian OS SDKs installed or enabled (check SDK Preferences and Platform Filtering preferences).
+BuildTargetsPage.NoSDKsError=There are no Symbian OS SDKs installed or enabled (check SDK Preferences and Platform Filtering preferences).
 BuildTargetsPage.NoBuildConfigsSelectedError=Please select at least one build configuration.
 BuildTargetsPage.DifferentDrivesError=There are known build problems when the bld.inf file and SDK are on different drives ({0})
 BuildTargetsPage.NoDriveSpecWarning=You have chosen an SDK EPOCROOT without a drive specification. Building will work but other features such as the indexer and MMP editor may not fully function.