HEAD - Fix issues with results dimensions and milestones preferences
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
index d182a69..21f8322 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/DB_Results.java
@@ -367,6 +367,7 @@
             BUILDS = null;
             LAST_BASELINE_BUILD = null;
             LAST_CURRENT_BUILD = null;
+            DIMENSIONS = null;
             CONFIGS = null;
             COMPONENTS = null;
             SCENARII = null;
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/SQL_Results.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/SQL_Results.java
index 9b0cac4..a4e1aff 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/SQL_Results.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/SQL_Results.java
@@ -17,6 +17,7 @@
 import java.sql.Timestamp;
 
 import org.eclipse.test.internal.performance.InternalDimensions;
+import org.eclipse.test.internal.performance.data.Dim;
 import org.eclipse.test.internal.performance.db.SQL;
 
 /**
@@ -140,10 +141,21 @@
  */
 ResultSet queryDimScalars(int datapointId) throws SQLException {
 	if (this.queryDimScalars == null) {
-		this.queryDimScalars = this.fConnection.prepareStatement("select DIM_ID, VALUE from SCALAR where " + //$NON-NLS-1$
-			"DATAPOINT_ID = ? and " + //$NON-NLS-1$
-			"(DIM_ID = "+InternalDimensions.CPU_TIME.getId()+" or DIM_ID = "+InternalDimensions.ELAPSED_PROCESS.getId()+") " +   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-			"order by DIM_ID");  //$NON-NLS-1$
+		StringBuffer buffer = new StringBuffer("select DIM_ID, VALUE from SCALAR where "); //$NON-NLS-1$
+		buffer.append("DATAPOINT_ID = ? and "); //$NON-NLS-1$
+		Dim[] dimensions = DB_Results.getResultsDimensions();
+		int length = dimensions.length;
+		for (int i=0; i<length; i++) {
+			if (i==0) {
+				buffer.append("(");
+			} else {
+				buffer.append(" or ");
+			}
+			buffer.append("DIM_ID = ");
+			buffer.append(dimensions[i].getId());
+		}
+		buffer.append(") order by DIM_ID");
+		this.queryDimScalars = this.fConnection.prepareStatement(buffer.toString());
 	}
 	this.queryDimScalars.setInt(1, datapointId);
 	return this.queryDimScalars.executeQuery();
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
index 6c0cf10..f71a336 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferenceInitializer.java
@@ -67,14 +67,16 @@
 
 	// Milestones
 	String[] milestones = IPerformancesConstants.V35_MILESTONES;
+	String prefix = PRE_MILESTONE_BUILDS + "." + ECLIPSE_MAINTENANCE_VERSION;
 	length = milestones.length;
 	for (int i = 0; i < length; i++) {
-		defaultPreferences.put(PRE_MILESTONE_BUILDS + ".v35." + i, milestones[i]);
+		defaultPreferences.put(prefix + i, milestones[i]);
 	}
 	milestones = IPerformancesConstants.V36_MILESTONES;
+	prefix = PRE_MILESTONE_BUILDS + "." + ECLIPSE_DEVELOPMENT_VERSION;
 	length = milestones.length;
 	for (int i = 0; i < length; i++) {
-		defaultPreferences.put(PRE_MILESTONE_BUILDS + ".v36." + i, milestones[i]);
+		defaultPreferences.put(prefix + i, milestones[i]);
 	}
 }
 
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
index ce6df13..89978e9 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformanceResultsPreferencePage.java
@@ -443,11 +443,12 @@
 
 	// Milestones
 	this.milestonesCombo.removeAll();
-	String milestone = store.getDefaultString(PRE_MILESTONE_BUILDS + version + "0");
+	String prefix = PRE_MILESTONE_BUILDS + "." + version;
+	String milestone = store.getDefaultString(prefix + "0");
 	int index = 0;
 	while (milestone != null && milestone.length() > 0) {
 		this.milestonesCombo.add(milestone);
-		milestone = store.getDefaultString(PRE_MILESTONE_BUILDS + version + index);
+		milestone = store.getDefaultString(prefix + index);
 	}
 
 	// Init default default dimension
@@ -495,11 +496,13 @@
     updateBrowseButtonToolTip(version);
 
 	// Milestones
-	String milestone = store.getString(PRE_MILESTONE_BUILDS + version + "0");
+	String prefix = PRE_MILESTONE_BUILDS + "." + version;
 	int index = 0;
+	String milestone = store.getString(prefix + index);
 	while (milestone != null && milestone.length() > 0) {
 		this.milestonesCombo.add(milestone);
-		milestone = store.getString(PRE_MILESTONE_BUILDS + version + ++index);
+		index++;
+		milestone = store.getString(prefix + index);
 	}
 
 	// Init composite lists