Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2011-02-21 13:12:50 -0500
committerChris Goldthorpe2011-02-21 13:12:50 -0500
commit06b7e13e8ea2c9097d4f20eebd55417e5e865fa5 (patch)
tree7c60540773b21a842cbd5ca0446ebca69e55e7e2
parent07b42a5cea281c2b3c92562693a43e594d9b5d32 (diff)
downloadeclipse.platform.ua-06b7e13e8ea2c9097d4f20eebd55417e5e865fa5.tar.gz
eclipse.platform.ua-06b7e13e8ea2c9097d4f20eebd55417e5e865fa5.tar.xz
eclipse.platform.ua-06b7e13e8ea2c9097d4f20eebd55417e5e865fa5.zip
Bug 316830 - Eclipse auto test: testSortMultipleCategory expected:<a[1]> but was:<a[3]> in solaris10 with jdk7-b96v20110221
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java34
1 files changed, 16 insertions, 18 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
index 27285877c..02941308e 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -26,36 +26,34 @@ public class ContextHelpSorter extends ViewerComparator {
list = new LinkedList();
this.context = context;
}
+
+ public void sort(Viewer viewer, Object[] elements) {
+ for (int i = 0; i < elements.length; i++) {
+ IHelpResource r1 = (IHelpResource) elements[i];
+ String c1 = context.getCategory(r1);
+ if (!list.contains(c1)) {
+ list.add(c1);
+ }
+ }
+ super.sort(viewer, elements);
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e2 instanceof IHelpResource))
+ if (!(e2 instanceof IHelpResource)) {
return -1;
- if (!(e1 instanceof IHelpResource))
+ }
+ if (!(e1 instanceof IHelpResource)) {
return 1;
+ }
IHelpResource r1 = (IHelpResource) e1;
IHelpResource r2 = (IHelpResource) e2;
String c1 = context.getCategory(r1);
String c2 = context.getCategory(r2);
int i1 = list.indexOf(c1);
int i2 = list.indexOf(c2);
- if (i1 == -1 && i2 == -1) {
- list.add(c1);
- i1 = list.indexOf(c1);
- if (i1 != i2)
- list.add(c2);
- i2 = list.indexOf(c2);
- }
- if (i1 == -1) {
- list.add(c1);
- return 1;
- }
- if (i2 == -1) {
- list.add(c2);
- return -1;
- }
return i1 - i2;
}
}

Back to the top