use of com.mucommander.commons.file.AbstractFile 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.commons.file.AbstractFile in project mucommander by mucommander.
the class CloneTabToOtherPanelAction method performAction.
@Override
public void performAction() {
AbstractFile currentLocation = mainFrame.getActivePanel().getCurrentFolder();
mainFrame.getInactivePanel().getTabs().add(currentLocation);
}
use of com.mucommander.commons.file.AbstractFile in project mucommander by mucommander.
the class CombineFilesAction method performAction.
@Override
public void performAction(FileSet files) {
// Filter out files that are not regular files
FileFilter filter = new AttributeFileFilter(FileAttribute.FILE);
filter.filter(files);
if (files.size() == 0)
return;
AbstractFile destFolder = mainFrame.getInactivePanel().getCurrentFolder();
new CombineFilesDialog(mainFrame, files, destFolder).showDialog();
}
use of com.mucommander.commons.file.AbstractFile in project mucommander by mucommander.
the class MkdirAction method toggleEnabledState.
@Override
protected void toggleEnabledState() {
AbstractFile firstFile = mainFrame.getActiveTable().getFileTableModel().getFileAt(0);
// If there is no file at all, do not rely on the action being supported by the current folder as this
// would be incorrect for some filesystems which do not support operations consistently across the
// filesystem (e.g. S3). In that case, err on the safe side and enable the action, even if the operation
// end up not being supported.
setEnabled(firstFile == null || firstFile.isFileOperationSupported(FileOperation.CREATE_DIRECTORY));
}
use of com.mucommander.commons.file.AbstractFile in project mucommander by mucommander.
the class OpenAction method performAction.
/**
* Opens the currently selected file in the active folder panel.
*/
@Override
public void performAction() {
// Retrieves the currently selected file.
// Note: a CachedFile instance is retrieved to avoid blocking the event thread.
AbstractFile file = mainFrame.getActiveTable().getSelectedFile(true, true);
// Aborts if none.
if (file == null)
return;
// Opens the currently selected file.
open(file, mainFrame.getActivePanel());
}
Aggregations