# HG changeset patch # User timkelly # Date 1272040589 18000 # Node ID 75a3be8a048004105a14ce6a06c7350ab782e172 # Parent f47181a17fe4519c28bc595c6429023bac8b206c fix a sbsv2 config sorting problem diff -r f47181a17fe4 -r 75a3be8a0480 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Thu Apr 22 15:43:41 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Fri Apr 23 11:36:29 2010 -0500 @@ -31,6 +31,8 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; import org.osgi.framework.Version; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -233,8 +235,8 @@ * Filter out those that are less commonly used on new workspace creation. */ public static void initDefaultConfigsToFilter() { - Preferences prefs = SDKCorePlugin.getDefault().getPluginPreferences(); - String inited = prefs.getString(SBSV2_FILTERED_CONFIGS_STORE_INITED); + IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId()); + String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED, ""); if (inited == null || inited.length() == 0){ Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); List defaultConfigsToFilter = new ArrayList(); @@ -247,7 +249,7 @@ defaultConfigsToFilter.add(buildAlias); } } - prefs.setValue(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true"); + prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true"); setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()])); } @@ -363,7 +365,7 @@ private static List sortContexts(List contexts){ - // 3 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel) + // 2 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel) Collections.sort(contexts, new Comparator() { @@ -373,10 +375,23 @@ String sbsAlias2 = o2.getSBSv2Alias(); if (o1.getPlatformString().equals(o2.getPlatformString())) { - if (o1.getSBSv2Alias().split("_").length == 2 && o2.getSBSv2Alias().split("_").length == 2) + if (o1.getSBSv2Alias().split("_").length != o2.getSBSv2Alias().split("_").length) return o1.getTargetString().compareTo(o2.getTargetString()); - else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3) - return 1; + else if (sbsAlias1.split("_").length >= 3){ + String temp1[] = sbsAlias1.split("_"); + String temp2[] = sbsAlias2.split("_"); + String suffix1 = ""; + String suffix2 = ""; + for (int i = 2; i < temp1.length; i++){ + suffix1 += temp1[i] + "_"; + } + + for (int i = 2; i < temp2.length; i++){ + suffix2 += temp2[i] + "_"; + } + + return suffix1.compareTo(suffix2); + } } else { if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { return -1; @@ -396,7 +411,10 @@ String sbsAlias1 = o1.getSBSv2Alias(); String sbsAlias2 = o2.getSBSv2Alias(); - if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){ + if (o1.getSBSv2Alias().split("_").length == 3 && o2.getSBSv2Alias().split("_").length == 3 && + o1.getPlatformString().equals(o2.getPlatformString())) + return o1.getTargetString().compareTo(o2.getTargetString()); + else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){ String temp1[] = sbsAlias1.split("_"); String temp2[] = sbsAlias2.split("_"); String suffix1 = "";