Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor). C3_BUILDER_WORK
authortimkelly
Thu, 17 Jun 2010 14:00:47 -0500
branchC3_BUILDER_WORK
changeset 1491 268b8ede3928
parent 1488 f1eec65aaede
child 1494 d0b573bc9608
Update the SBSv2 filtering pref options from the Raptor alias query (union of all available build configs from Raptor). Update the display message for a broken config only in the tree viewer and not in the display name itself (in case user create a config any ways)
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Thu Jun 17 11:41:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Thu Jun 17 14:00:47 2010 -0500
@@ -63,12 +63,7 @@
 		this.meaning = meaning;
 		this.configID = ISBSv2BuildContext.BUILDER_ID + "." + sbsv2Alias + "." + sdk.getUniqueId();
 		parseQueryConfigResults(contextQueryXML);
-		
-		if (configParseErrorMessage != null && configParseErrorMessage.length() > 0){
-			this.displayString = sbsv2Alias + " ERROR: " +  configParseErrorMessage;
-		} else {
-			this.displayString = sbsv2Alias + " [" + sdk.getUniqueId() + "]"; 
-		}
+		this.displayString = sbsv2Alias + " [" + sdk.getUniqueId() + "]"; 
 	}
 
 	@Override
@@ -84,7 +79,8 @@
 		}
 		
 		if (platform.contains(".")){
-			return platform.split(".")[0];
+			String[] tok = platform.split(".");
+			if (tok.length > 0) return tok[0];
 		}
 		return platform;
 	}
@@ -459,6 +455,7 @@
 	 * Error message, if any.
 	 * @return An error message if a problem occurred while trying to get config info from Raptor. Null if no error.
 	 */
+	@Override
 	public String getConfigurationErrorMessage(){
 		return configParseErrorMessage;
 	}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Thu Jun 17 11:41:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Thu Jun 17 14:00:47 2010 -0500
@@ -352,10 +352,29 @@
 		if (sbsVers.compareTo(SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version()) >= 0)
 			return true;
 		else {
-			String message = "Raptor/SBSv2 minimum version supported in Carbide.c++ is " + SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version() + ". Your sbs version is " + sbsVers + ". Please update your sbs installation.";
+			String message = "Raptor/SBSv2 minimum version supported in Carbide.c++ is " + SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version() + ". Your sbs version is " + sbsVers + ". Please update your sbs installation and Rescan from the Build Configuration Manager preference page .";
 			throw new SBSv2MinimumVersionException(message);
 		}
 	}
+
+	public static HashMap<String, String> getCompleteAliasList() throws SBSv2MinimumVersionException {
+		HashMap<String, String> resultMap = new HashMap<String, String>();
+		//return getAliasesForSDK(null);
+		
+		// iterate all SDKs and build the map up
+		for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
+			if (sdk.isEnabled() && (new File(sdk.getEPOCROOT()).exists())){
+				HashMap<String, String> aliasMap = getAliasesForSDK(sdk);
+				for (String alias : aliasMap.keySet()){
+					if (resultMap.get(alias) == null){
+						resultMap.put(alias, aliasMap.get(alias));
+					}
+				}
+			}
+		}
+		
+		return resultMap;
+	}
 	
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java	Thu Jun 17 11:41:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java	Thu Jun 17 14:00:47 2010 -0500
@@ -27,4 +27,6 @@
 	 */
 	public String getDefaultDefFileDirectoryName();
 	
+	public String getConfigurationErrorMessage();
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Thu Jun 17 11:41:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Thu Jun 17 14:00:47 2010 -0500
@@ -39,12 +39,19 @@
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
 import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 
 /**
  * @since 1.4
  */
+@SuppressWarnings("restriction")
 public class SBSv2PlatformFilterComposite extends Composite {
 
+	// TODO: Temporary map. We need a way to ensure we only get the alias map
+	// when needed and that the data we are getting is properly cached to avoid
+	// having to run Raptor queries too often
+	private static HashMap<String, String> aliasMap = new HashMap<String, String>();
+	
 	private CheckboxTableViewer tableViewer;
 	private Button refreshButton;
 
@@ -104,13 +111,21 @@
 
 		SBSv2Utils.initDefaultConfigsToFilter();
 		
-		// TODO: Aliases need to be the union of all SDKs
-		HashMap<String, String> aliasMap = new HashMap<String, String>();
-		try {
-			aliasMap = SBSv2QueryUtils.getAliasesForSDK(null);
-		} catch (SBSv2MinimumVersionException e) {
-			MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage());
+		if (aliasMap.size() == 0){
+			try {
+				aliasMap = SBSv2QueryUtils.getCompleteAliasList();
+			} catch (SBSv2MinimumVersionException e) {
+				// Force a scan for version in case system was updated
+				SDKCorePlugin.getSDKManager().getSBSv2Version(true);
+				try {
+					// try, try again...
+					aliasMap = SBSv2QueryUtils.getCompleteAliasList();
+				} catch (SBSv2MinimumVersionException e2) {
+					MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage());
+				}
+			} 
 		}
+		
 		List<String> sbsAliases = new ArrayList<String>();
 		for (String key : aliasMap.keySet())
 			sbsAliases.add(key);
@@ -135,12 +150,12 @@
 	public void setDefaults(){
 		initTable(true);
 		for (TableItem item : tableViewer.getTable().getItems()) {
-			if (item.getText().toLowerCase().startsWith("armv5_udeb")  || 
-				item.getText().toLowerCase().startsWith("armv5_urel") ||
-				item.getText().toLowerCase().startsWith("armv5_udeb_gcce")  || 
-				item.getText().toLowerCase().startsWith("armv5_urel_gcce") ||
-				item.getText().toLowerCase().startsWith("winscw_udeb")  ||
-				item.getText().toLowerCase().startsWith("winscw_urel")) {
+			if (item.getText().toLowerCase().equals("armv5_udeb")  || 
+				item.getText().toLowerCase().equals("armv5_urel") ||
+				item.getText().toLowerCase().equals("armv5_udeb_gcce")  || 
+				item.getText().toLowerCase().equals("armv5_urel_gcce") ||
+				item.getText().toLowerCase().equals("winscw_udeb")  ||
+				item.getText().toLowerCase().equals("winscw_urel")) {
 				tableViewer.setChecked(item.getData(), true);
 			} else {
 				tableViewer.setChecked(item.getData(), false);
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Thu Jun 17 11:41:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Thu Jun 17 14:00:47 2010 -0500
@@ -25,6 +25,7 @@
 import org.eclipse.jface.viewers.TreeNode;
 
 import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
 import com.nokia.carbide.cpp.sdk.core.ISDKManager;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
@@ -35,6 +36,7 @@
  * A tree node representing a Symbian OS SDK.  This node's children will be the
  * list of available build configurations.
  */
+@SuppressWarnings("restriction")
 public class BuildTargetTreeNode extends TreeNode {
 
 	public static final String SDK_NODE_ERROR_EPOCROOT_INVALID = " -- SDK location does not exist! Check Symbian SDKs!"; //$NON-NLS
@@ -70,7 +72,14 @@
 				public String toString() {
 					ISymbianBuildContext context = (ISymbianBuildContext)getValue();
 					String sdkId = context.getSDK().getUniqueId();
-					return context.getDisplayString().replace("[" + sdkId + "]", "");
+					String newDisplayString = context.getDisplayString().replace("[" + sdkId + "]", "");
+					if (context instanceof ISBSv2BuildContext){
+						ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context;
+						if (v2Context.getConfigurationErrorMessage() != null && v2Context.getConfigurationErrorMessage().length() > 0){
+							newDisplayString += " ERROR: " + v2Context.getConfigurationErrorMessage();
+						}
+					} 
+					return newDisplayString;
 				}
 			};
 		}