# HG changeset patch # User timkelly # Date 1275923820 18000 # Node ID 8534c28043b90404cb81d3197dca1066a1760b3c # Parent 1a693b01d10752055c7f54c2dce2afa52d8dc1e8 clean up some code as part of displaying configs remvoed from filtering. diff -r 1a693b01d107 -r 8534c28043b9 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Fri Jun 04 16:34:02 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Mon Jun 07 10:17:00 2010 -0500 @@ -229,15 +229,12 @@ sdk = SDKCorePlugin.getSDKManager().getSDK(sdkID, true); // TODO: NEED TO HANDLE MISSING SDK ID if (sdk != null){ - if (displayString == null || !displayString.startsWith(ISBSv2BuildContext.BUILDER_ID)) { - // likely an old config that has used the display name as the config id - displayString = configID; + + if (displayString == null && !configID.startsWith(ISBSv2BuildContext.BUILDER_ID)){ + displayString = configID; // Old config, used unique 'id' and config name interchangably + } else { + displayString = displayString; } - - if (!configID.startsWith(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_BUILD_ALIAS)){ - System.out.println("old config"); - } - displayString = displayString + " [" + sdk.getUniqueId() + "]"; return new BuildContextSBSv2(sdk, platform, target, buidAlias, displayString, configID); } } diff -r 1a693b01d107 -r 8534c28043b9 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Fri Jun 04 16:34:02 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Mon Jun 07 10:17:00 2010 -0500 @@ -272,83 +272,88 @@ } /** - * When displaying build configs there may be configurations in the project that may not be displayed. + * When displaying build configs there may be configurations in the project that may not be displayed * We add those back in so they reside in the checked tree viewer in case the user wants to remove them. * @param sdkConfigTreeNodes */ private void replaceFilteredConfigsFromProject(BuildTargetTreeNode[] sdkConfigTreeNodes) { List bldConfigs = cpi.getBuildConfigurations(); - ///////////// - //////////// TODO TODO TODO - /////////// Refactor me. This is very inefficient code, just used for prototyping of adding in filtered out configs - //////////// - + HashMap> missingConfigMap = new HashMap>(); for (ICarbideBuildConfiguration config : bldConfigs){ boolean foundConfig = false; // Add in configs that are only defined in the project and not the // suggested filtered config cache for (BuildTargetTreeNode sdkConfigNode : sdkConfigTreeNodes){ - TreeNode[] configNodes = sdkConfigNode.getChildren(); - for (TreeNode childConfig : configNodes){ - if (childConfig == null){ - continue; + ISymbianSDK sdk = sdkConfigNode.getSymbianSDK(); + if (!sdk.getUniqueId().equals(config.getSDK().getUniqueId())){ + continue; // not in this SDK, don't bother looking at all configs + } 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 (childConfig.getValue() instanceof ISymbianBuildContext){ - ISymbianBuildContext context = (ISymbianBuildContext)(childConfig.getValue()); - if (config.getBuildContext().equals(context)){ - foundConfig = true; - break; + if (!foundConfig){ + // save config off, we'll add it back in later + List contextsToAdd = new ArrayList(); + if (null == missingConfigMap.get(sdkConfigNode)){ + contextsToAdd.add(config.getBuildContext()); + } else { + contextsToAdd = missingConfigMap.get(sdkConfigNode); + contextsToAdd.add(config.getBuildContext()); } - } else { - System.out.println("Huh? Not an ISymbiabBuildContext : " + childConfig.getValue()); + missingConfigMap.put(sdkConfigNode, contextsToAdd); + } } - if (foundConfig) break; + } + } + + for (BuildTargetTreeNode sdkNode : missingConfigMap.keySet()){ + List configsToAdd = missingConfigMap.get(sdkNode); + TreeNode[] oldConfigNodes = sdkNode.getChildren(); + TreeNode[] newConfigNodes = new TreeNode[oldConfigNodes.length + configsToAdd.size()]; + int index = 0; + // build up the old list.... + for (TreeNode newConfigNode : oldConfigNodes){ + if (newConfigNode == null){ + continue; + } + if (newConfigNode.getValue() instanceof ISymbianBuildContext){ + ISymbianBuildContext context = (ISymbianBuildContext)(newConfigNode.getValue()); + newConfigNodes[index++] = new TreeNode(context) { + @Override + public String toString() { + ISymbianBuildContext context = (ISymbianBuildContext)getValue(); + return context.getDisplayString(); + } + }; + } } - if (!foundConfig){ - for (BuildTargetTreeNode sdkConfigNode : sdkConfigTreeNodes){ - ISymbianSDK sdk = sdkConfigNode.getSymbianSDK(); - if (sdk.getUniqueId().equals(config.getSDK().getUniqueId())){ - // add the config - TreeNode[] oldConfigNodes = sdkConfigNode.getChildren(); - TreeNode[] newConfigNodes = new TreeNode[oldConfigNodes.length + 1]; - int index = 0; - for (TreeNode newConfigNode : oldConfigNodes){ - if (newConfigNode == null){ - continue; - } - if (newConfigNode.getValue() instanceof ISymbianBuildContext){ - ISymbianBuildContext context = (ISymbianBuildContext)(newConfigNode.getValue()); - newConfigNodes[index++] = new TreeNode(context) { - @Override - public String toString() { - ISymbianBuildContext context = (ISymbianBuildContext)getValue(); - return context.getDisplayString(); - } - }; - } - } - - // add the missing config - newConfigNodes[index++] = new TreeNode(config.getBuildContext()) { - @Override - public String toString() { - ISymbianBuildContext context = (ISymbianBuildContext)getValue(); - return context.getDisplayString(); - } - }; - - sdkConfigNode.setChildren(newConfigNodes); - - } else { - continue; // not the SDK we're looking for + // ... then add the project specific items... + for (ISymbianBuildContext newContext : configsToAdd){ + newConfigNodes[index++] = new TreeNode(newContext) { + @Override + public String toString() { + ISymbianBuildContext context = (ISymbianBuildContext)getValue(); + return context.getDisplayString(); } - } - + }; } + sdkNode.setChildren(newConfigNodes); + } } diff -r 1a693b01d107 -r 8534c28043b9 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Fri Jun 04 16:34:02 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Mon Jun 07 10:17:00 2010 -0500 @@ -59,7 +59,7 @@ // TODO: Still need to decide on how to set display string // and how it's used for legacy SBSv2 configs - if (displayString != null && !displayString.equals(configID)){ + if (displayString != null){ return displayString; }