HEAD - Fix minor issue with Results Performance preference + NPE
diff --git a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
index bf5230c..7c22519 100644
--- a/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
+++ b/bundles/org.eclipse.test.performance.ui/src/org/eclipse/test/internal/performance/results/ui/ConfigTab.java
@@ -272,13 +272,27 @@
* Dispose all SWT resources.
*/
public void dispose() {
- this.boldFont.dispose();
- this.italicFont.dispose();
- this.boldItalicFont.dispose();
- this.darkyellow.dispose();
- this.lightyellow.dispose();
- this.lightred.dispose();
- this.blueref.dispose();
+ if (this.boldFont != null) {
+ this.boldFont.dispose();
+ }
+ if (this.italicFont != null) {
+ this.italicFont.dispose();
+ }
+ if (this.boldItalicFont != null) {
+ this.boldItalicFont.dispose();
+ }
+ if (this.darkyellow != null) {
+ this.darkyellow.dispose();
+ }
+ if (this.lightyellow != null) {
+ this.lightyellow.dispose();
+ }
+ if (this.lightred != null) {
+ this.lightred.dispose();
+ }
+ if (this.blueref != null) {
+ this.blueref.dispose();
+ }
disposeTable();
}
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 89978e9..25cfd04 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
@@ -517,10 +517,11 @@
int count = this.resultsDimensionsList.getItemCount();
int[] indices = new int[count];
int n = 0;
- String resultsDimension = store.getString(PRE_RESULTS_DIMENSION + "." + i++);
+ String resultsDimension = store.getString(PRE_RESULTS_DIMENSION + "." + i);
while (resultsDimension.length() > 0) {
indices[n++] = this.resultsDimensionsList.indexOf(resultsDimension);
- resultsDimension = store.getString(PRE_RESULTS_DIMENSION + "." + i++);
+ i++;
+ resultsDimension = store.getString(PRE_RESULTS_DIMENSION + "." + i);
}
if (n < count) {
System.arraycopy(indices, 0, indices = new int[n], 0, n);
@@ -779,6 +780,12 @@
store.putValue(PRE_RESULTS_DIMENSION + "." + i, dimensions[i]);
}
}
+ int currentLength = DB_Results.getResultsDimensions().length;
+ if (currentLength > length) {
+ for (i = currentLength - 1; i >= length; i--) {
+ store.putValue(PRE_RESULTS_DIMENSION + "." + i, ""); // reset extra dimensions
+ }
+ }
DB_Results.setResultsDimensions(dimensions);
// Set config descriptors