tmf: Use Apache Common Compress for importing from archive
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / internal / tmf / ui / project / wizards / importtrace / FileSystemObjectImportStructureProvider.java
index 02ddad60e96474dfcbafe86f7c8abd92d312b5dd..3a33240b40f95b8c4546f5ce69a9c335f5bff993 100644 (file)
@@ -15,15 +15,15 @@ package org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace;
 import java.io.File;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.List;
-import java.util.zip.ZipEntry;
 
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
 import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
 
 /**
  * An import provider that makes use of the IFileSystemObject abstraction
- * instead of using plain file system objects (File, TarEntry, ZipEntry, etc)
+ * instead of using plain file system objects (File, TarArchiveEntry, ZipArchiveEntry, etc)
  */
 public class FileSystemObjectImportStructureProvider implements IImportStructureProvider {
 
@@ -43,23 +43,6 @@ public class FileSystemObjectImportStructureProvider implements IImportStructure
         fArchivePath = archivePath;
     }
 
-    /**
-     * This orders by files first then the folders. Then by lexical order.
-     */
-    private final class FileObjectPathComparator implements Comparator<IFileSystemObject> {
-        @Override
-        public int compare(IFileSystemObject o1, IFileSystemObject o2) {
-            if (o1.isDirectory() != o2.isDirectory()) {
-                if (o1.isDirectory()) {
-                    return 1;
-                }
-                return -1;
-            }
-
-            return o1.getName().compareToIgnoreCase(o2.getName());
-        }
-    }
-
     @Override
     public List<IFileSystemObject> getChildren(Object element) {
         @SuppressWarnings("rawtypes")
@@ -69,7 +52,6 @@ public class FileSystemObjectImportStructureProvider implements IImportStructure
             adapted.add(getIFileSystemObject(o));
         }
 
-        adapted.sort(new FileObjectPathComparator());
         return adapted;
     }
 
@@ -87,10 +69,10 @@ public class FileSystemObjectImportStructureProvider implements IImportStructure
 
         if (o instanceof File) {
             return new FileFileSystemObject((File) o);
-        } else if (o instanceof TarEntry) {
-            return new TarFileSystemObject((TarEntry) o, fArchivePath);
-        } else if (o instanceof ZipEntry) {
-            return new ZipFileSystemObject((ZipEntry) o, fArchivePath);
+        } else if (o instanceof TarArchiveEntry) {
+            return new TarFileSystemObject((TarArchiveEntry) o, fArchivePath);
+        } else if (o instanceof ZipArchiveEntry) {
+            return new ZipFileSystemObject((ZipArchiveEntry) o, fArchivePath);
         } else if (o instanceof GzipEntry) {
             return new GzipFileSystemObject((GzipEntry) o, fArchivePath);
         }
This page took 0.039074 seconds and 5 git commands to generate.