HEAD - Add the ability of writing comparison between two selected builds in the Build view
diff --git a/bundles/org.eclipse.test.performance.ui/performanceui.jar b/bundles/org.eclipse.test.performance.ui/performanceui.jar
index 106ea2a..82efe4f 100644
--- a/bundles/org.eclipse.test.performance.ui/performanceui.jar
+++ b/bundles/org.eclipse.test.performance.ui/performanceui.jar
Binary files differ
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
index 275555d..46225a0 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/ConfigResults.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -239,7 +239,7 @@
  * 		<li>{@link AbstractResults#BASELINE_ERROR_INDEX}: the error made while measuring the baseline value</li>
  * 	</ul>
  */
-double[] getNumbers(BuildResults buildResults, BuildResults baselineResults) {
+public double[] getNumbers(BuildResults buildResults, BuildResults baselineResults) {
 	if (baselineResults == null) {
 		return null;
 	}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
index 726438b..74bcb21 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/db/PerformanceResults.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -719,6 +719,16 @@
  */
 public void setBaselineName(String buildName) {
 	this.baselineName = buildName;
+	if (this.baselinePrefix == null || !this.baselineName.startsWith(this.baselinePrefix)) {
+		// Usually hat baseline name format is *always* x.y_yyyyMMddhhmm_yyyyMMddhhmm
+		int index = this.baselineName.lastIndexOf('_');
+		if (index > 0) {
+			this.baselinePrefix = this.baselineName.substring(0, index);
+		} else {
+//				this.baselinePrefix = DB_Results.getDbBaselinePrefix();
+			this.baselinePrefix = this.baselineName;
+		}
+	}
 }
 
 private void setDefaults() {
@@ -763,13 +773,16 @@
 	}
 
 	// Init baseline prefix if not set
-	if (this.baselinePrefix == null && this.baselineName != null) {
-		// Assume that baseline name format is *always* x.y_yyyyMMddhhmm_yyyyMMddhhmm
-		int index = this.baselineName.lastIndexOf('_');
-		if (index > 0) {
-			this.baselinePrefix = this.baselineName.substring(0, index);
-		} else {
-			this.baselinePrefix = DB_Results.getDbBaselinePrefix();
+	if (this.baselineName != null) {
+		if (this.baselinePrefix == null || !this.baselineName.startsWith(this.baselinePrefix)) {
+			// Usually hat baseline name format is *always* x.y_yyyyMMddhhmm_yyyyMMddhhmm
+			int index = this.baselineName.lastIndexOf('_');
+			if (index > 0) {
+				this.baselinePrefix = this.baselineName.substring(0, index);
+			} else {
+//				this.baselinePrefix = DB_Results.getDbBaselinePrefix();
+				this.baselinePrefix = this.baselineName;
+			}
 		}
 	}
 
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java
index 82c1766..4fb226d 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/BuildResultsElement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -162,7 +162,7 @@
 	return null;
 }
 
-private BuildResults getBuildResults() {
+BuildResults getBuildResults() {
 	return (BuildResults) this.results;
 }
 
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
index a7073a5..e8bb640 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/model/PerformanceResultsElement.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -16,11 +16,14 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.PrintStream;
 import java.util.Arrays;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.test.internal.performance.results.db.*;
+import org.eclipse.test.internal.performance.results.ui.ScenariosComparisonTable;
 import org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
 import org.eclipse.test.internal.performance.results.utils.Util;
+import org.eclipse.test.performance.ui.Utils;
 
 public class PerformanceResultsElement extends ResultsElement {
 
@@ -58,7 +61,7 @@
 	return baselines;
 }
 
-String[] getBuildNames() {
+public String[] getBuildNames() {
 	if (this.buildNames == null) {
 		this.buildNames = DB_Results.DB_CONNECTION
 			? DB_Results.getBuilds()
@@ -324,4 +327,53 @@
 	return excluded;
 }
 
+/*
+ * Write the comparison between two builds in the given file
+ */
+public void writeComparison(File resultsFile, String build, String reference) {
+	if (this.results == null) {
+		return;
+	}
+	try {
+		// Create the stream
+		PrintStream stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(resultsFile)));
+
+		// Print main title
+		stream.print("<link href=\""+Utils.TOOLTIP_STYLE+"\" rel=\"stylesheet\" type=\"text/css\">\n");
+		stream.print("<script src=\""+Utils.TOOLTIP_SCRIPT+"\"></script>\n");
+		stream.print("<script src=\""+Utils.FINGERPRINT_SCRIPT+"\"></script>\n");
+		stream.print(Utils.HTML_DEFAULT_CSS);
+		stream.print("<body>");
+		stream.print("<h2>Performance comparison of ");
+		stream.print(build);
+		stream.print(" relative to ");
+		int index = reference.indexOf('_');
+		if (index > 0) {
+			stream.print(reference.substring(0, index));
+			stream.print(" (");
+			index = reference.lastIndexOf('_');
+			stream.print(reference.substring(index+1, reference.length()));
+			stream.print(')');
+		} else {
+			stream.print(reference);
+		}
+		stream.print("</h2>\n");
+
+		// Print a comparison table for each component
+		try {
+			int length = this.children.length;
+			for (int i=0; i<length; i++) {
+				ScenariosComparisonTable table = new ScenariosComparisonTable(this.children[i].getName(), stream, build, reference);
+				table.print(getPerformanceResults());
+			}
+		}
+		finally {
+			stream.print("</body>");
+			stream.close();
+		}
+	} catch (FileNotFoundException e) {
+		System.err.println("Can't create output file"+resultsFile); //$NON-NLS-1$
+	}
+}
+
 }
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
index 3dabb41..d703105 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/BuildsView.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -278,13 +278,14 @@
 	// Results model
 	BuildResultsElement[] buildsResults;
 
-	// Generation info
+	// Directories
 	File outputDir;
 
 	// Actions
 	Action generate;
 	UpdateBuildAction updateBuild, updateAllBuilds;
 //	UpdateBuildAction forceUpdateBuild, forceUpdateAllBuilds;
+	Action writeComparison;
 
 	// SWT resources
 	Font italicFont;
@@ -405,6 +406,8 @@
 	manager.add(this.generate);
 	manager.add(this.updateBuild);
 //	manager.add(this.forceUpdateBuild);
+	manager.add(new Separator());
+	manager.add(this.writeComparison);
 }
 
 /*
@@ -473,6 +476,21 @@
 //	this.forceUpdateAllBuilds = new UpdateAllBuildsAction(true);
 //	this.forceUpdateAllBuilds.setText("Force Update all");
 
+	// Write values
+	this.writeComparison = new Action("Write comparison") {
+		public void run() {
+
+			// Get write directory
+			String filter = (BuildsView.this.resultsDir == null) ? null : BuildsView.this.resultsDir.getPath();
+			final File writeDir = changeDir(filter, "Select a directory to write the comparison between two builds");
+			if (writeDir != null) {
+				writeComparison(writeDir);
+			}
+        }
+	};
+	this.writeComparison.setEnabled(false);
+	this.writeComparison.setToolTipText("Write comparison between two builds");
+
 	// Set filters default
 	this.filterBaselineBuilds.setChecked(false);
 	this.filterNightlyBuilds.setChecked(false);
@@ -585,6 +603,7 @@
 	// Update selected element
 	Object selection = this.viewer.getSelection();
 	int length = 0;
+	this.writeComparison.setEnabled(false);
 	if (selection instanceof IStructuredSelection) {
 		Object[] elements = ((IStructuredSelection)selection).toArray();
 		length = elements == null ? 0 : elements.length;
@@ -596,6 +615,7 @@
 		for (int i=0; i<length; i++) {
 			this.buildsResults[i] = (BuildResultsElement) elements[i];
 		}
+		this.writeComparison.setEnabled(length==2);
 	} else {
 		return;
 	}
@@ -656,4 +676,35 @@
 	this.results.updateBuilds(builds, force, this.dataDir, monitor);
 }
 
+protected void writeComparison(File writeDir) {
+	this.resultsDir = writeDir;
+	writeDir = new File(writeDir, "values");
+	if (this.preferences.getBoolean(IPerformancesConstants.PRE_FILTER_ADVANCED_SCENARIOS, false)) {
+		writeDir = new File(writeDir, "fingerprints");
+	} else {
+		writeDir = new File(writeDir, "all");
+	}
+	writeDir.mkdirs();
+	final String buildName = this.buildsResults[0].getName();
+	String buildDate = buildName.substring(1);
+	String buildPrefix = "Comparison" + buildDate + "_" + buildName.charAt(0);
+	File resultsFile = new File(writeDir, buildPrefix+".html");
+	if (resultsFile.exists()) {
+		int i=0;
+		File saveDir = new File(writeDir, "save");
+		saveDir.mkdir();
+		while (true) {
+			String newFileName = buildPrefix+"_";
+			if (i<10) newFileName += "0";
+			newFileName += i;
+			File renamedFile = new File(saveDir, newFileName+".html");
+			if (resultsFile.renameTo(renamedFile)) {
+				break;
+			}
+			i++;
+		}
+	}
+	this.results.writeComparison(resultsFile, buildName, this.buildsResults[1].getName());
+}
+
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
index 11d9728..bd617aa 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ComponentsView.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -101,7 +101,6 @@
 
 	// Internal
 	Set expandedComponents = new HashSet();
-	File resultsDir = null;
 
 	// Actions
 	Action filterAdvancedScenarios;
@@ -382,11 +381,6 @@
 	if (this.viewState == null) {
 		this.filterBaselineBuilds.setChecked(true);
 		this.viewFilters.add(FILTER_BASELINE_BUILDS);
-	} else {
-		String dir = this.viewState.getString(IPerformancesConstants.PRE_WRITE_RESULTS_DIR);
-		if (dir != null) {
-			this.resultsDir = new File(dir);
-		}
 	}
 
 	// Filter non fingerprints action state
@@ -398,9 +392,6 @@
 }
 
 public void saveState(IMemento memento) {
-	if (this.resultsDir != null) {
-		memento.putString(IPerformancesConstants.PRE_WRITE_RESULTS_DIR, this.resultsDir.getPath());
-	}
 	super.saveState(memento);
 }
 
@@ -451,65 +442,65 @@
 }
 
 protected void writeStatus(File writeDir) {
-		this.resultsDir = writeDir;
-		if (this.filterAdvancedScenarios.isChecked()) {
-			writeDir = new File(writeDir, "fingerprints");
-		} else {
-			writeDir = new File(writeDir, "all");
-		}
-		writeDir.mkdir();
-		if ((WRITE_STATUS & IPerformancesConstants.STATUS_VALUES) != 0) {
-			writeDir = new File(writeDir, "values");
-		}
-		int buildsNumber = WRITE_STATUS & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
-		if (buildsNumber > 1) {
-			writeDir = new File(writeDir, Integer.toString(buildsNumber));
-		}
-		writeDir.mkdirs();
-		final String buildName = this.results.getName();
-		String buildDate = buildName.substring(1);
-		String buildPrefix = buildDate + "_" + buildName.charAt(0);
-		File resultsFile = new File(writeDir, buildPrefix+".log");
-		File exclusionDir = new File(writeDir, "excluded");
-		exclusionDir.mkdir();
-		File exclusionFile = new File(exclusionDir, buildPrefix+".log");
-		if (resultsFile.exists()) {
-			int i=0;
-			File saveDir = new File(writeDir, "save");
-			saveDir.mkdir();
-			while (true) {
-				String newFileName = buildPrefix+"_";
-				if (i<10) newFileName += "0";
-				newFileName += i;
-				File renamedFile = new File(saveDir, newFileName+".log");
-				if (resultsFile.renameTo(renamedFile)) {
-					File renamedExclusionFile = new File(exclusionDir, newFileName+".log");
-					exclusionFile.renameTo(renamedExclusionFile);
-					break;
-				}
-				i++;
+	this.resultsDir = writeDir;
+	if (this.filterAdvancedScenarios.isChecked()) {
+		writeDir = new File(writeDir, "fingerprints");
+	} else {
+		writeDir = new File(writeDir, "all");
+	}
+	writeDir.mkdir();
+	if ((WRITE_STATUS & IPerformancesConstants.STATUS_VALUES) != 0) {
+		writeDir = new File(writeDir, "values");
+	}
+	int buildsNumber = WRITE_STATUS & IPerformancesConstants.STATUS_BUILDS_NUMBER_MASK;
+	if (buildsNumber > 1) {
+		writeDir = new File(writeDir, Integer.toString(buildsNumber));
+	}
+	writeDir.mkdirs();
+	final String buildName = this.results.getName();
+	String buildDate = buildName.substring(1);
+	String buildPrefix = buildDate + "_" + buildName.charAt(0);
+	File resultsFile = new File(writeDir, buildPrefix+".log");
+	File exclusionDir = new File(writeDir, "excluded");
+	exclusionDir.mkdir();
+	File exclusionFile = new File(exclusionDir, buildPrefix+".log");
+	if (resultsFile.exists()) {
+		int i=0;
+		File saveDir = new File(writeDir, "save");
+		saveDir.mkdir();
+		while (true) {
+			String newFileName = buildPrefix+"_";
+			if (i<10) newFileName += "0";
+			newFileName += i;
+			File renamedFile = new File(saveDir, newFileName+".log");
+			if (resultsFile.renameTo(renamedFile)) {
+				File renamedExclusionFile = new File(exclusionDir, newFileName+".log");
+				exclusionFile.renameTo(renamedExclusionFile);
+				break;
 			}
+			i++;
 		}
+	}
 
-		// Write status
-		StringBuffer excluded = this.results.writeStatus(resultsFile, WRITE_STATUS);
-		if (excluded == null) {
-			MessageDialog.openWarning(this.shell, getTitleToolTip(), "The component is not read, hence no results can be written!");
-		}
+	// Write status
+	StringBuffer excluded = this.results.writeStatus(resultsFile, WRITE_STATUS);
+	if (excluded == null) {
+		MessageDialog.openWarning(this.shell, getTitleToolTip(), "The component is not read, hence no results can be written!");
+	}
 
-		// Write exclusion file
+	// Write exclusion file
+	try {
+		DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(exclusionFile)));
 		try {
-			DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(exclusionFile)));
-			try {
-				stream.write(excluded.toString().getBytes());
-			}
-			finally {
-				stream.close();
-			}
-		} catch (FileNotFoundException e) {
-			System.err.println("Can't create exclusion file"+exclusionFile); //$NON-NLS-1$
-		} catch (IOException e) {
-			e.printStackTrace();
+			stream.write(excluded.toString().getBytes());
 		}
+		finally {
+			stream.close();
+		}
+	} catch (FileNotFoundException e) {
+		System.err.println("Can't create exclusion file"+exclusionFile); //$NON-NLS-1$
+	} catch (IOException e) {
+		e.printStackTrace();
+	}
 }
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
index 470ab35..b1e3a56 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/PerformancesView.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -133,8 +133,9 @@
 	TreeViewer viewer;
 	IPropertySheetPage propertyPage;
 
-	// Data info
+	// Directories
 	File dataDir;
+	File resultsDir = null;
 
 	// Views
 	IMemento viewState;
@@ -607,6 +608,10 @@
 		if (filterBaselinesValue) {
 			this.viewFilters.add(FILTER_BASELINE_BUILDS);
 		}
+		String dir = this.viewState.getString(IPerformancesConstants.PRE_WRITE_RESULTS_DIR);
+		if (dir != null) {
+			this.resultsDir = new File(dir);
+		}
 	}
 
 	// Filter nightly builds action
@@ -639,6 +644,9 @@
 	} catch (BackingStoreException e) {
 		// ignore
 	}
+	if (this.resultsDir != null) {
+		memento.putString(IPerformancesConstants.PRE_WRITE_RESULTS_DIR, this.resultsDir.getPath());
+	}
 }
 
 /*
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ScenariosComparisonTable.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ScenariosComparisonTable.java
new file mode 100644
index 0000000..fcfb69c
--- /dev/null
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ScenariosComparisonTable.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.test.internal.performance.results.ui;
+
+import java.io.PrintStream;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.test.internal.performance.results.db.AbstractResults;
+import org.eclipse.test.internal.performance.results.db.BuildResults;
+import org.eclipse.test.internal.performance.results.db.ConfigResults;
+import org.eclipse.test.internal.performance.results.db.PerformanceResults;
+import org.eclipse.test.internal.performance.results.db.ScenarioResults;
+import org.eclipse.test.performance.ui.Utils;
+
+/**
+ * This class is responsible to print html table with the difference between two
+ * builds for all the scenarios and the configuration of a specific component.
+ */
+public class ScenariosComparisonTable {
+
+	private static final double DEFAULT_FAILURE_THRESHOLD = PerformanceResults.DEFAULT_FAILURE_THRESHOLD / 100.0 / 2;
+	private String component;
+	private PrintStream stream;
+	String buildName, referenceName;
+
+public ScenariosComparisonTable(String name, PrintStream stream, String build, String reference) {
+    this.component = name;
+    this.stream = stream;
+    this.buildName = build;
+    this.referenceName = reference;
+}
+
+/**
+ * Prints the HTML representation of scenario status table into the given stream.
+ */
+public void print(PerformanceResults performanceResults) {
+
+	List scenarios = performanceResults.getComponentScenarios(this.component);
+	int size = scenarios.size();
+
+	// Print titles
+	printTitle();
+	this.stream.print("<table border=\"1\">\n");
+	this.stream.print("<tr>\n");
+	this.stream.print("<td><h4>All ");
+	this.stream.print(computeSize(scenarios));
+	this.stream.print(" scenarios</h4></td>\n");
+	printColumnsTitle(size, performanceResults);
+
+	// Print one line per scenario results
+	for (int i=0; i<size; i++) {
+		ScenarioResults scenarioResults = (ScenarioResults) scenarios.get(i);
+		if (!scenarioResults.isValid()) continue;
+		this.stream.print("<tr>\n");
+		this.stream.print("<td>");
+		boolean hasSummary = scenarioResults.hasSummary();
+		if (hasSummary) this.stream.print("<b>");
+		this.stream.print(scenarioResults.getShortName());
+		if (hasSummary) this.stream.print("</b>");
+		this.stream.print("\n");
+		String[] configs = performanceResults.getConfigNames(true/*sort*/);
+		int length = configs.length;
+		for (int j=0; j<length; j++) {
+			printConfigStats(scenarioResults, configs[j]);
+		}
+	}
+	this.stream.print("</table>\n");
+}
+
+private int computeSize(List scenarios) {
+	int size = scenarios.size();
+	int n = 0;
+	for (int i=0; i<size; i++) {
+		ScenarioResults scenarioResults = (ScenarioResults) scenarios.get(i);
+		if (scenarioResults.isValid()) n++;
+	}
+	return n;
+}
+
+/*
+ * Print the table columns title.
+ */
+private void printColumnsTitle(int size, PerformanceResults performanceResults) {
+	String[] configNames = performanceResults.getConfigNames(true/*sort*/);
+	String[] configBoxes = performanceResults.getConfigBoxes(true/*sort*/);
+	int length = configNames.length;
+	for (int i=0; i<length; i++) {
+		String columnTitle = configNames[i];
+		String boxName = configBoxes[i];
+		int idx = boxName.indexOf('(');
+		if (idx < 0) {
+			columnTitle = boxName;
+		} else {
+			// first line
+			StringTokenizer tokenizer = new StringTokenizer(boxName.substring(0, idx).trim(), " ");
+			StringBuffer buffer = new StringBuffer(tokenizer.nextToken());
+			while (tokenizer.hasMoreTokens()) {
+				buffer.append("&nbsp;");
+				buffer.append(tokenizer.nextToken());
+			}
+			buffer.append(' ');
+			// second line
+			tokenizer = new StringTokenizer(boxName.substring(idx).trim(), " ");
+			buffer.append(tokenizer.nextToken());
+			while (tokenizer.hasMoreTokens()) {
+				buffer.append("&nbsp;");
+				buffer.append(tokenizer.nextToken());
+			}
+			columnTitle = buffer.toString();
+		}
+		this.stream.print("<td><h5>");
+		this.stream.print(columnTitle);
+		this.stream.print("</h5>\n");
+	}
+}
+
+/*
+ * Print the scenario statistics value for the given configuration.
+ */
+private void printConfigStats(ScenarioResults scenarioResults, String config) {
+	ConfigResults configResults = scenarioResults.getConfigResults(config);
+	if (configResults == null || !configResults.isValid()) {
+		this.stream.print("<td>n/a</td>");
+		return;
+	}
+	final BuildResults buildResults = configResults.getBuildResults(this.buildName);
+	if (buildResults == null) {
+		this.stream.print("<td>no results</td>");
+		return;
+	}
+	final BuildResults referenceResults = configResults.getBuildResults(this.referenceName);
+	if (referenceResults == null) {
+		this.stream.print("<td>no reference</td>");
+		return;
+	}
+	double[] numbers = configResults.getNumbers(buildResults, referenceResults);
+	final double delta = numbers[AbstractResults.DELTA_VALUE_INDEX];
+	final double[] deviation = new double[] { -delta, numbers[AbstractResults.DELTA_ERROR_INDEX] };
+	boolean hasFailure = delta < -DEFAULT_FAILURE_THRESHOLD;
+	String comment = buildResults.getComment();
+	String image = Utils.getImage(0, hasFailure, comment != null);
+	this.stream.print("<td><a ");
+
+	// write deviation with error in table
+	this.stream.print("href=\"http://fullmoon.ottawa.ibm.com/downloads/drops/I20100817-0800/performance/");
+	this.stream.print(configResults.getName());
+	this.stream.print('/');
+	this.stream.print(scenarioResults.getFileName());
+	this.stream.print(".html\">\n");
+	this.stream.print("<img hspace=\"10\" border=\"0\" src=\"");
+	this.stream.print(image);
+	this.stream.print("\"/></a>\n");
+	String result = Utils.failureMessage(deviation, false);
+	this.stream.print(result);
+	this.stream.print("\n");
+}
+
+/*
+ * Print the comparison table title.
+ */
+private void printTitle() {
+	this.stream.print("<br><h3>Component ");
+	this.stream.print(this.component);
+	this.stream.print("</h3>\n");
+}
+
+}
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
index 0a283c6..4f7e61a 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/performance/ui/GenerateResults.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -29,7 +29,6 @@
 import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.test.internal.performance.results.db.ConfigResults;
-import org.eclipse.test.internal.performance.results.db.DB_Results;
 import org.eclipse.test.internal.performance.results.db.PerformanceResults;
 import org.eclipse.test.internal.performance.results.db.ScenarioResults;
 import org.eclipse.test.internal.performance.results.utils.Util;
@@ -1012,7 +1011,8 @@
 		if (index > 0) {
 			this.baselinePrefix = baseline.substring(0, index);
 		} else {
-			this.baselinePrefix = DB_Results.getDbBaselinePrefix();
+//			this.baselinePrefix = DB_Results.getDbBaselinePrefix();
+			this.baselinePrefix = baseline;
 		}
 	}