make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree. C3_BUILDER_WORK
authortimkelly
Wed, 21 Jul 2010 11:37:56 -0500
branchC3_BUILDER_WORK
changeset 1656 d1edeecb12af
parent 1644 2db4594b310f
child 1657 03f5f8bf29b4
make sure to alaways create configs even if even epoc root is bad. Also, make sure to display broken SDKs in the config tree.
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/api/sdk/sbsv2/SBSv2QueryUtils.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	Tue Jul 20 13:38:47 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Wed Jul 21 11:37:56 2010 -0500
@@ -72,7 +72,6 @@
 public class ManageConfigurationsDialog extends TrayDialog {
 	
 	protected ContainerCheckedTreeViewer properSdkViewer;
-	protected ContainerCheckedTreeViewer missingSdkViewer;
 	private FilteringContentProviderWrapper filteringContentProviderWrapper;
 	private final ICarbideProjectInfo cpi;
 	
@@ -229,25 +228,6 @@
 			final Label uninstalledSdkConfigLabel = new Label(container, SWT.NONE);
 			uninstalledSdkConfigLabel.setToolTipText(Messages.getString("ManageConfigurationsDialog.Unavailable_Config_Label_ToolTip")); //$NON-NLS-1$
 			uninstalledSdkConfigLabel.setText(Messages.getString("ManageConfigurationsDialog.Unavailable_SDks_and_Configs")); //$NON-NLS-1$
-			missingSdkViewer = new ContainerCheckedTreeViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-			missingSdkViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-			missingSdkViewer.setLabelProvider(new LabelProvider());
-			filteringContentProviderWrapper = 
-				new FilteringContentProviderWrapper(treeNodeContentProvider);
-			missingSdkViewer.setContentProvider(filteringContentProviderWrapper);
-			missingSdkViewer.setInput(brokenTreeInput);
-			propagateMissingSdkTree();
-			missingSdkViewer.addCheckStateListener(new ICheckStateListener() {
-				public void checkStateChanged(CheckStateChangedEvent event) {
-					// Disclose the tree if the user selected the parent node
-					Object obj = event.getElement();
-					if (obj instanceof BrokenConfigurationInProjectTreeNode){
-						BrokenConfigurationInProjectTreeNode bttn = (BrokenConfigurationInProjectTreeNode)obj;
-						missingSdkViewer.setExpandedState(bttn, true);
-					}
-					validatePage();
-				}
-			});			
 		}
 
 		final Label sdkStaticHelp = new Label(parent, SWT.WRAP);
@@ -330,15 +310,17 @@
 				} else {
 					// Found the right SDK, now check and see if the config exists
 					TreeNode[] configNodes = sdkConfigNode.getChildren();
-					for (TreeNode childConfig : configNodes){
-						if (childConfig == null){
-							continue;
-						}
-						if (childConfig.getValue() instanceof ISymbianBuildContext){
-							ISymbianBuildContext context = (ISymbianBuildContext)(childConfig.getValue());
-							if (config.getBuildContext().equals(context)){
-								foundConfig = true;
-								break;
+					if (configNodes != null){
+						for (TreeNode childConfig : configNodes){
+							if (childConfig == null){
+								continue;
+							}
+							if (childConfig.getValue() instanceof ISymbianBuildContext){
+								ISymbianBuildContext context = (ISymbianBuildContext)(childConfig.getValue());
+								if (config.getBuildContext().equals(context)){
+									foundConfig = true;
+									break;
+								}
 							}
 						}
 					}
@@ -361,6 +343,9 @@
 		for (BuildTargetTreeNode sdkNode : missingConfigMap.keySet()){
 			List<ISymbianBuildContext> configsToAdd = missingConfigMap.get(sdkNode);
 			TreeNode[] oldConfigNodes = sdkNode.getChildren();
+			if (oldConfigNodes == null || oldConfigNodes.length == 0){
+				continue;
+			}
 			TreeNode[] newConfigNodes = new TreeNode[oldConfigNodes.length + configsToAdd.size()];
 			int index = 0;
 			// build up the old list....
@@ -470,19 +455,6 @@
 		properSdkViewer.refresh();
 	}
 	
-	private void propagateMissingSdkTree() {
-		TreeItem[] items = missingSdkViewer.getTree().getItems();
-		// all nodes in this tree are select, as the tree only reflect selected config with bad SDK
-		for (int i=0; i<items.length; i++) {
-			TreeNode sdkNode = (TreeNode)items[i].getData();
-			if (sdkNode.getValue() instanceof ISymbianSDK) {
-				missingSdkViewer.setExpandedState(sdkNode, true);
-				missingSdkViewer.setChecked(sdkNode, true);		
-			}
-		}
-		missingSdkViewer.refresh();		
-	}
-	
 	private void saveConfigurations(){
 		
 		// get the modifier
@@ -524,24 +496,26 @@
 				TreeNode sdkNode = (TreeNode)currTreeItem.getData();
 				if (sdkNode.getValue() instanceof ISymbianSDK) {
 					TreeNode[] configNode = sdkNode.getChildren();
-					for (TreeNode currConfigNode : configNode){
-						if (currConfigNode.getValue() instanceof ISymbianBuildContext){
-							// if the current config is already a config set it to checked.
-							ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
-							if (currExistingConfig.getBuildContext().equals(buildContext)){
-								// The configuration is in both the tree viewer and the .settings
-								// Now find out if it's checked. If it's not checked remove it
-								if (!properSdkViewer.getChecked(currConfigNode)){
-									ICarbideBuildConfiguration config = cpm.getNamedConfiguration(buildContext.getDisplayString());
-									if (config == null){
-										config = cpm.getNamedConfiguration(currExistingConfig.getDisplayString());
-									}
-									if (config != null){
-										cpm.deleteConfiguration(config);
-										break;
-									}
-									
-								} 
+					if (configNode != null){
+						for (TreeNode currConfigNode : configNode){
+							if (currConfigNode.getValue() instanceof ISymbianBuildContext){
+								// if the current config is already a config set it to checked.
+								ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
+								if (currExistingConfig.getBuildContext().equals(buildContext)){
+									// The configuration is in both the tree viewer and the .settings
+									// Now find out if it's checked. If it's not checked remove it
+									if (!properSdkViewer.getChecked(currConfigNode)){
+										ICarbideBuildConfiguration config = cpm.getNamedConfiguration(buildContext.getDisplayString());
+										if (config == null){
+											config = cpm.getNamedConfiguration(currExistingConfig.getDisplayString());
+										}
+										if (config != null){
+											cpm.deleteConfiguration(config);
+											break;
+										}
+										
+									} 
+								}
 							}
 						}
 					}
@@ -549,26 +523,6 @@
 			}
 		}
 		
-		// now look for dead SDK config we removed
-		if (missingSdkViewer != null) {
-			TreeItem[] items = missingSdkViewer.getTree().getItems();
-			for (TreeItem currentTreeItem : items) {
-				TreeNode sdkNode = (TreeNode)currentTreeItem.getData();
-				if (sdkNode.getValue() instanceof ISymbianSDK) {
-					TreeNode[] configNode = sdkNode.getChildren();
-					for (TreeNode currConfigNode : configNode){
-						if (missingSdkViewer.getChecked(currConfigNode) == false) {
-							ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
-							ICarbideBuildConfiguration config = cpm.getNamedConfiguration(buildContext.getDisplayString());	
-							if (config != null) {
-								cpm.deleteConfiguration(config);
-							}
-						}
-					}
-				}
-			}			
-		}
-		
 		// now apply any changes
 		cpm.saveChanges();
 	}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Tue Jul 20 13:38:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Wed Jul 21 11:37:56 2010 -0500
@@ -78,7 +78,7 @@
 				return aliases;
 			}
 		}
-
+		
 		aliases = getAliasesQuery(sdk);
 		aliasesMap.put(key.toString(), aliases);
 		SDKCorePlugin.getCache().putCachedData(ALIAS_CACHE_KEY, (Serializable)aliasesMap, 0);
@@ -205,7 +205,6 @@
 		if (!isEpocRootValid(sdk)) {
 			HashMap<String, String> result = new HashMap<String, String>();
 			result.put(BAD_EPOCROOT, "");
-			return result;
 		}
 		
 		List<String> argListAliasQuery = new ArrayList<String>();
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Tue Jul 20 13:38:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Wed Jul 21 11:37:56 2010 -0500
@@ -152,7 +152,7 @@
 		for (ISymbianSDK sdk : sdkListCopy) {
 			
 			BuildTargetTreeNode treeNode = new BuildTargetTreeNode(sdk, sbsv2Project);
-			if (treeNode.getChildren() != null){
+			if (treeNode.getChildren() != null || sbsv2Project){
 				input[index++] = treeNode;
 			}
 		}