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 73498c78c764bef6cf310e1d8e47fb57cfb0bafd..3a33240b40f95b8c4546f5ce69a9c335f5bff993 100644 (file)
@@ -16,22 +16,29 @@ import java.io.File;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.zip.ZipEntry;
 
-import org.eclipse.ui.internal.wizards.datatransfer.TarEntry;
+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)
  */
-@SuppressWarnings("restriction")
 public class FileSystemObjectImportStructureProvider implements IImportStructureProvider {
 
     private IImportStructureProvider fImportProvider;
     private String fArchivePath;
 
-    FileSystemObjectImportStructureProvider(IImportStructureProvider importStructureProvider, String archivePath) {
+    /**
+     * Constructor
+     *
+     * @param importStructureProvider
+     *            the {@link IImportStructureProvider}
+     * @param archivePath
+     *            the path of the archive file
+     */
+    public FileSystemObjectImportStructureProvider(IImportStructureProvider importStructureProvider, String archivePath) {
         fImportProvider = importStructureProvider;
         fArchivePath = archivePath;
     }
@@ -44,6 +51,7 @@ public class FileSystemObjectImportStructureProvider implements IImportStructure
         for (Object o : children) {
             adapted.add(getIFileSystemObject(o));
         }
+
         return adapted;
     }
 
@@ -61,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.025776 seconds and 5 git commands to generate.