use of com.mucommander.job.impl.UnpackJob in project mucommander by mucommander.
the class CopyDialog method createTransferFileJob.
// ////////////////////////////////////////////
// TransferDestinationDialog implementation //
// ////////////////////////////////////////////
@Override
protected TransferFileJob createTransferFileJob(ProgressDialog progressDialog, PathUtils.ResolvedDestination resolvedDest, int defaultFileExistsAction) {
AbstractFile baseFolder = files.getBaseFolder();
AbstractArchiveFile parentArchiveFile = baseFolder.getParentArchive();
TransferFileJob job;
String newName = resolvedDest.getDestinationType() == DestinationType.EXISTING_FOLDER ? null : resolvedDest.getDestinationFile().getName();
// their natural order (more efficient)
if (parentArchiveFile != null) {
// Add all selected archive entries to a vector
int nbFiles = files.size();
List<ArchiveEntry> selectedEntries = new Vector<ArchiveEntry>();
for (int i = 0; i < nbFiles; i++) {
selectedEntries.add((ArchiveEntry) files.elementAt(i).getAncestor(AbstractArchiveEntryFile.class).getUnderlyingFileObject());
}
job = new UnpackJob(progressDialog, mainFrame, parentArchiveFile, PathUtils.getDepth(baseFolder.getAbsolutePath(), baseFolder.getSeparator()) - PathUtils.getDepth(parentArchiveFile.getAbsolutePath(), parentArchiveFile.getSeparator()), resolvedDest.getDestinationFolder(), newName, defaultFileExistsAction, selectedEntries);
} else {
job = new CopyJob(progressDialog, mainFrame, files, resolvedDest.getDestinationFolder(), newName, TransferMode.COPY, defaultFileExistsAction);
}
return job;
}
use of com.mucommander.job.impl.UnpackJob in project mucommander by mucommander.
the class CopyDialog method createTransferFileJob.
// ////////////////////////////////////////////
// TransferDestinationDialog implementation //
// ////////////////////////////////////////////
@Override
protected TransferFileJob createTransferFileJob(ProgressDialog progressDialog, PathUtils.ResolvedDestination resolvedDest, FileCollisionDialog.FileCollisionAction defaultFileExistsAction) {
AbstractFile baseFolder = files.getBaseFolder();
AbstractArchiveFile parentArchiveFile = baseFolder.getParentArchive();
TransferFileJob job;
String newName = resolvedDest.getDestinationType() == DestinationType.EXISTING_FOLDER ? null : resolvedDest.getDestinationFile().getName();
// their natural order (more efficient)
if (parentArchiveFile != null) {
// Add all selected archive entries to a vector
int nbFiles = files.size();
List<ArchiveEntry> selectedEntries = new Vector<ArchiveEntry>();
for (int i = 0; i < nbFiles; i++) {
selectedEntries.add((ArchiveEntry) files.elementAt(i).getAncestor(AbstractArchiveEntryFile.class).getUnderlyingFileObject());
}
job = new UnpackJob(progressDialog, mainFrame, parentArchiveFile, PathUtils.getDepth(baseFolder.getAbsolutePath(), baseFolder.getSeparator()) - PathUtils.getDepth(parentArchiveFile.getAbsolutePath(), parentArchiveFile.getSeparator()), resolvedDest.getDestinationFolder(), newName, defaultFileExistsAction, selectedEntries);
} else {
job = new CopyJob(progressDialog, mainFrame, files, resolvedDest.getDestinationFolder(), newName, TransferMode.COPY, defaultFileExistsAction);
}
return job;
}
Aggregations