fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs. C3_BUILDER_WORK
authortimkelly
Wed, 21 Jul 2010 17:12:21 -0500
branchC3_BUILDER_WORK
changeset 1664 65c3d72a8793
parent 1663 21ded3449e77
child 1666 5243d04d3917
fix some config refresh issues with SDK/Config tree management. Fixed some issues with showing proper configs re: SBSv2 config filtering prefs.
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Wed Jul 21 16:13:43 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Wed Jul 21 17:12:21 2010 -0500
@@ -359,7 +359,7 @@
 						@Override
 						public String toString() {
 							ISymbianBuildContext context = (ISymbianBuildContext)getValue();
-							return context.getDisplayString();
+							return stripSDKIDFromConfigName(context.getDisplayString(), context.getSDK().getUniqueId());
 						}
 					};
 				}
@@ -371,7 +371,7 @@
 					@Override
 					public String toString() {
 						ISymbianBuildContext context = (ISymbianBuildContext)getValue();
-						return context.getDisplayString();
+						return stripSDKIDFromConfigName(context.getDisplayString(), context.getSDK().getUniqueId());
 					}
 				};
 			}
@@ -526,5 +526,10 @@
 		// now apply any changes
 		cpm.saveChanges();
 	}
+	
+	private static String stripSDKIDFromConfigName(String configName, String sdkID){
+		return configName.replace("[" + sdkID + "]", "");
+	}
 
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Wed Jul 21 16:13:43 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Wed Jul 21 17:12:21 2010 -0500
@@ -139,6 +139,9 @@
 			contextExists = false;
 		}
 		
+		// Get the list of configs that have already been queried. If they have not been queried
+		// we'll save them off in a list to run an actual query.
+		// TODO: If a config has an error condition should we try to scan it again?
 		List<String> processedAliasList = new ArrayList<String>();
 		for (String alias : newContextsToQuery) {
 			SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
@@ -150,12 +153,13 @@
 		}
 
 		if (!processedAliasList.isEmpty()) {
-			newContextsToQuery.removeAll(processedAliasList);
+			newContextsToQuery.removeAll(processedAliasList);  // No need to qeury anything
 		}
 
+		// Query any contextst that don't have configQueryData and add them to the filtered list
+		// We do this separately b/c it can be a slow operation so we don't want to do it often
 		if (!newContextsToQuery.isEmpty()) {
 			String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, newContextsToQuery);
-
 			for (String alias : newContextsToQuery){
 				// TODO: Need to test for variants. Right now variants are not added
 				if (aliasToMeaningMap.get(alias) == null){
@@ -166,6 +170,21 @@
 				sbsv2FilteredConetxts.add(sbsv2Context);
 			}
 		}		
+		
+		// Now remove any contexts that don't fit
+		List<ISymbianBuildContext> contextListCopy = new ArrayList<ISymbianBuildContext>(sbsv2FilteredConetxts);
+		for (ISymbianBuildContext currentContext : contextListCopy){
+			boolean match = false;
+			for (String allowedAlias : allowedConfigs){
+				if (allowedAlias.equals(((ISBSv2BuildContext)currentContext).getSBSv2Alias())){
+					match = true;
+					break;
+				}
+			}
+			if (!match)
+				sbsv2FilteredConetxts.remove(currentContext);
+		}
+		
 	}
 
 	private void initSBSv2BuildContextList(List<String> allowedConfigs) throws SBSv2MinimumVersionException {
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Wed Jul 21 16:13:43 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Wed Jul 21 17:12:21 2010 -0500
@@ -72,7 +72,7 @@
 				public String toString() {
 					ISymbianBuildContext context = (ISymbianBuildContext)getValue();
 					String sdkId = context.getSDK().getUniqueId();
-					String newDisplayString = context.getDisplayString().replace("[" + sdkId + "]", "");
+					String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId);
 					if (context instanceof ISBSv2BuildContext){
 						ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context;
 						if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && 
@@ -167,5 +167,10 @@
 		}
 		return realInput;
 	}
+	
+	private static String stripSDKIDFromConfigName(String configName, String sdkID){
+		return configName.replace("[" + sdkID + "]", "");
+	}
+
 
 }