fix refresh button on SBSv2 to rebuild product and aliases list from scratch C3_BUILDER_WORK
authortimkelly
Mon, 26 Jul 2010 15:17:47 -0500
branchC3_BUILDER_WORK
changeset 1685 5ad5dc631a3d
parent 1683 659fdb7ee701
child 1686 e0b67eb36bac
fix refresh button on SBSv2 to rebuild product and aliases list from scratch
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/internal/sdk/core/model/SBSv2BuildInfo.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Mon Jul 26 14:25:58 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Mon Jul 26 15:17:47 2010 -0500
@@ -294,7 +294,7 @@
 		try {
 			configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
 			if (configQueryData == null) {
-				Map<String, String> aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+				Map<String, String> aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk, false);
 				List<String> aliasList = new ArrayList<String>();
 				aliasList.add(alias);
 				String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, aliasList);
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Mon Jul 26 14:25:58 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Mon Jul 26 15:17:47 2010 -0500
@@ -64,12 +64,12 @@
 	public static final String BAD_EPOCROOT = "BADEPOCROOT";
 
 	@SuppressWarnings("unchecked")
-	public static HashMap<String, String> getAliasesForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException {
+	public static HashMap<String, String> getAliasesForSDK(ISymbianSDK sdk, boolean forceRescan) throws SBSv2MinimumVersionException {
 		HashMap<String, String> aliases;
 		Map<String, HashMap<String, String>> aliasesMap = SDKCorePlugin.getCache().getCachedData(ALIAS_CACHE_KEY, Map.class, 0);
 		SBSv2SDKKey key = new SBSv2SDKKey(sdk);
 
-		if (aliasesMap == null) {
+		if (aliasesMap == null || forceRescan) {
 			aliasesMap = new HashMap<String, HashMap<String, String>>();
 		}
 		else {
@@ -86,12 +86,12 @@
 	}
 
 	@SuppressWarnings("unchecked")
-	public static List<String> getProductVariantsForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException {
+	public static List<String> getProductVariantsForSDK(ISymbianSDK sdk, boolean force) throws SBSv2MinimumVersionException {
 		List<String> products;
 		Map<String, List<String>> productsMap = SDKCorePlugin.getCache().getCachedData(PRODUCT_CACHE_KEY, Map.class, 0);
 		SBSv2SDKKey key = new SBSv2SDKKey(sdk);
 		
-		if (productsMap == null) {
+		if (productsMap == null || force) {
 			productsMap = new HashMap<String, List<String>>();
 		}
 		else {
@@ -420,13 +420,13 @@
 		}
 	}
 
-	public static HashMap<String, String> getCompleteAliasList() throws SBSv2MinimumVersionException {
+	public static HashMap<String, String> getCompleteAliasList(boolean forceRescan) throws SBSv2MinimumVersionException {
 		HashMap<String, String> resultMap = new HashMap<String, String>();
 		
 		// iterate all SDKs and build the map up
 		for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) {
 			if (sdk.isEnabled() && isEpocRootValid(sdk)) {
-				HashMap<String, String> aliasMap = getAliasesForSDK(sdk);
+				HashMap<String, String> aliasMap = getAliasesForSDK(sdk, forceRescan);
 				for (String alias : aliasMap.keySet()) {
 					if (alias.equals(BAD_EPOCROOT)) {
 						continue;
@@ -441,13 +441,13 @@
 		return resultMap;
 	}
 
-	public static List<String> getCompleteProductVariantList() throws SBSv2MinimumVersionException {
+	public static List<String> getCompleteProductVariantList(boolean forceRescan) throws SBSv2MinimumVersionException {
 		List<String> resultList = new ArrayList<String>();
 		
 		// iterate all SDKs and build the map up
 		for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) {
 			if (sdk.isEnabled() && isEpocRootValid(sdk)) {
-				List<String> productList = getProductVariantsForSDK(sdk);
+				List<String> productList = getProductVariantsForSDK(sdk, forceRescan);
 				for (String variant : productList) {
 					if (variant.equals(BAD_EPOCROOT)) {
 						continue;
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Mon Jul 26 14:25:58 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Mon Jul 26 15:17:47 2010 -0500
@@ -70,7 +70,7 @@
 		
 		if (aliasToMeaningMap.size() == 0){
 			try {
-				aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+				aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk, false);
 			} catch (final SBSv2MinimumVersionException e) {
 				if (hasShownDialog == false){
 					
@@ -93,7 +93,7 @@
 			// Not all SDKs will have products, so size of 0 is acceptable
 			productList = new ArrayList<String>();
 			try {
-				productList = SBSv2QueryUtils.getProductVariantsForSDK(sdk);
+				productList = SBSv2QueryUtils.getProductVariantsForSDK(sdk, false);
 			} catch (SBSv2MinimumVersionException e) {
 				// ignore
 			}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Mon Jul 26 14:25:58 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Mon Jul 26 15:17:47 2010 -0500
@@ -118,7 +118,11 @@
 			}
 
 			public void widgetSelected(SelectionEvent e) {
+				refreshButton.setEnabled(false);
+				refreshButton.setText("Please wait....Scanning.");
 				initTable(true);
+				refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
+				refreshButton.setEnabled(true);
 			}
 			
 		});
@@ -215,28 +219,28 @@
 		SBSv2Utils.setSBSv2FilteredConfigs(checkedConfigs.toArray(new String[checkedConfigs.size()]));
 	}
 	
-	private void initTable(boolean refreshList) {
+	private void initTable(boolean forceRescan) {
 
 		SBSv2Utils.initDefaultConfigsToFilter();
 		
-		if (aliasMap.size() == 0){
+		if (aliasMap.size() == 0 || forceRescan){
 			try {
-				aliasMap = SBSv2QueryUtils.getCompleteAliasList();
+				aliasMap = SBSv2QueryUtils.getCompleteAliasList(forceRescan);
 			} catch (SBSv2MinimumVersionException e) {
 				// Force a scan for version in case system was updated
 				SDKCorePlugin.getSDKManager().getSBSv2Version(true);
 				try {
 					// try, try again...
-					aliasMap = SBSv2QueryUtils.getCompleteAliasList();
+					aliasMap = SBSv2QueryUtils.getCompleteAliasList(forceRescan);
 				} catch (SBSv2MinimumVersionException e2) {
 					MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage());
 				}
 			} 
 		}
 		
-		if (productVariantList.size() == 0){
+		if (productVariantList.size() == 0 || forceRescan){
 			try {
-				productVariantList = SBSv2QueryUtils.getCompleteProductVariantList();
+				productVariantList = SBSv2QueryUtils.getCompleteProductVariantList(forceRescan);
 			} catch (SBSv2MinimumVersionException e) {
 				
 			}
@@ -274,7 +278,7 @@
 	}
 	
 	public void setDefaults(){
-		initTable(true);
+		initTable(false);
 		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
 			if (item.getText().toLowerCase().equals("armv5_udeb")  || 
 				item.getText().toLowerCase().equals("armv5_urel") ||