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 {
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")
adapted.add(getIFileSystemObject(o));
}
- adapted.sort(new FileObjectPathComparator());
return adapted;
}
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);
}