From 3afaa476f5afe9fd284ab6313066aa9efb51c499 Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Thu, 12 Jul 2012 09:43:47 -0400 Subject: [PATCH] Fix for Bug384878 - Add ending separator to folders in trace comparison Signed-off-by: Francois Chouinard --- .../wizards/ImportTraceWizardPage.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java index 219605786f..91c0dd17e5 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/ImportTraceWizardPage.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -870,7 +871,14 @@ public class ImportTraceWizardPage extends WizardResourceImportPage { if (ok && traceTypeOK && !traceType.equals("")) { //$NON-NLS-1$ // Tag the selected traces with their type List files = new ArrayList(fileSystemObjects.keySet()); - Collections.sort(files); + Collections.sort(files, new Comparator() { + @Override + public int compare(String o1, String o2) { + String v1 = o1 + File.separatorChar; + String v2 = o2 + File.separatorChar; + return v1.compareTo(v2); + } + }); // After sorting, traces correspond to the unique prefixes String prefix = null; for (int i = 0; i < files.size(); i++) { @@ -913,8 +921,14 @@ public class ImportTraceWizardPage extends WizardResourceImportPage { for (Entry entry : fileSystemObjects.entrySet()) { fileList.add(entry.getValue()); } - Collections.sort(fileList); - + Collections.sort(fileList, new Comparator() { + @Override + public int compare(File o1, File o2) { + String v1 = o1.getAbsolutePath() + File.separatorChar; + String v2 = o2.getAbsolutePath() + File.separatorChar; + return v1.compareTo(v2); + } + }); // Perform a distinct import operation for everything that has the same prefix // (distinct prefixes correspond to traces - we don't want to re-create parent structures) -- 2.34.1