Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-11-25 17:56:47 -0500
committerAndre Weinand2004-11-25 17:56:47 -0500
commit6f8bf3adadae5911b9cb16686d75cef10b16e63d (patch)
tree6333905c657fcb031f466c6b2ba7861f594964b2 /bundles/org.eclipse.compare/compare
parentaaaf86eb4b35483dc6942ccc6b246aef6df9d91f (diff)
downloadeclipse.platform.team-6f8bf3adadae5911b9cb16686d75cef10b16e63d.tar.gz
eclipse.platform.team-6f8bf3adadae5911b9cb16686d75cef10b16e63d.tar.xz
eclipse.platform.team-6f8bf3adadae5911b9cb16686d75cef10b16e63d.zip
fixed #79414: states with same time stamps may appear in the wrong order
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java46
1 files changed, 17 insertions, 29 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index b2154ad92..229101703 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.compare;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.ResourceBundle;
import java.util.Date;
@@ -18,6 +19,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.HashSet;
import java.util.Calendar;
+import java.util.Comparator;
import java.text.*;
import org.eclipse.swt.SWT;
@@ -265,7 +267,7 @@ public class EditionSelectionDialog extends ResizableDialog {
for (int i= 0; i < count; i++)
editions[i]= (IModificationDate) inputEditions[i];
if (count > 1)
- internalSort(editions, 0, count-1);
+ internalSort(editions);
// find StructureCreator if ppath is not null
IStructureCreator structureCreator= null;
@@ -336,7 +338,7 @@ public class EditionSelectionDialog extends ResizableDialog {
for (int i= 0; i < count; i++)
editions[i]= (IModificationDate) inputEditions[i];
if (count > 1)
- internalSort(editions, 0, count-1);
+ internalSort(editions);
// find StructureCreator if ppath is not null
IStructureCreator structureCreator= null;
@@ -847,33 +849,19 @@ public class EditionSelectionDialog extends ResizableDialog {
}
}
- private static void internalSort(IModificationDate[] keys, int left, int right) {
-
- int original_left= left;
- int original_right= right;
-
- IModificationDate mid= keys[(left + right) / 2];
- do {
- while (keys[left].getModificationDate() > mid.getModificationDate())
- left++;
-
- while (mid.getModificationDate() > keys[right].getModificationDate())
- right--;
-
- if (left <= right) {
- IModificationDate tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (original_left < right)
- internalSort(keys, original_left, right);
-
- if (left < original_right)
- internalSort(keys, left, original_right);
+ private static void internalSort(IModificationDate[] keys) {
+ Arrays.sort(keys, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ IModificationDate d1= (IModificationDate) o1;
+ IModificationDate d2= (IModificationDate) o2;
+ long d= d2.getModificationDate() - d1.getModificationDate();
+ if (d < 0)
+ return -1;
+ if (d > 0)
+ return 1;
+ return 0;
+ }
+ });
}
/*

Back to the top