Search in sources :

Example 1 with AbstractRWArchiveFile

use of com.mucommander.commons.file.archive.AbstractRWArchiveFile in project mucommander by mucommander.

the class MoveJob method jobCompleted.

// //////////////////////
// Overridden methods //
// //////////////////////
@Override
protected void jobCompleted() {
    super.jobCompleted();
    // If the source files are located inside an archive, optimize the archive file
    AbstractArchiveFile sourceArchiveFile = getBaseSourceFolder() == null ? null : getBaseSourceFolder().getParentArchive();
    if (sourceArchiveFile != null && sourceArchiveFile.isArchive() && sourceArchiveFile.isWritable())
        optimizeArchive((AbstractRWArchiveFile) sourceArchiveFile);
    // If the destination files are located inside an archive, optimize the archive file, only if the destination
    // archive is different from the source one
    AbstractArchiveFile destArchiveFile = baseDestFolder.getParentArchive();
    if (destArchiveFile != null && destArchiveFile.isArchive() && destArchiveFile.isWritable() && !(sourceArchiveFile != null && destArchiveFile.equalsCanonical(sourceArchiveFile)))
        optimizeArchive((AbstractRWArchiveFile) destArchiveFile);
    // in the active table after this job has finished (and hasn't been cancelled)
    if (files.size() == 1 && newName != null && baseDestFolder.equalsCanonical(files.elementAt(0).getParent())) {
        // Resolve new file instance now that it exists: some remote files do not immediately update file attributes
        // after creation, we need to get an instance that reflects the newly created file attributes
        selectFileWhenFinished(FileFactory.getFile(baseDestFolder.getAbsolutePath(true) + newName));
    }
}
Also used : AbstractArchiveFile(com.mucommander.commons.file.archive.AbstractArchiveFile) AbstractRWArchiveFile(com.mucommander.commons.file.archive.AbstractRWArchiveFile)

Example 2 with AbstractRWArchiveFile

use of com.mucommander.commons.file.archive.AbstractRWArchiveFile in project mucommander by mucommander.

the class UnpackJob method jobCompleted.

// //////////////////////
// Overridden methods //
// //////////////////////
@Override
protected void jobCompleted() {
    super.jobCompleted();
    // If the destination files are located inside an archive, optimize the archive file
    AbstractArchiveFile archiveFile = baseDestFolder.getParentArchive();
    if (archiveFile != null && archiveFile.isArchive() && archiveFile.isWritable())
        optimizeArchive((AbstractRWArchiveFile) archiveFile);
    // Unselect all files in the active table upon successful completion
    if (selectedEntries != null) {
        ActionManager.performAction(UnmarkAllAction.Descriptor.ACTION_ID, getMainFrame());
    }
}
Also used : AbstractArchiveFile(com.mucommander.commons.file.archive.AbstractArchiveFile) AbstractRWArchiveFile(com.mucommander.commons.file.archive.AbstractRWArchiveFile)

Example 3 with AbstractRWArchiveFile

use of com.mucommander.commons.file.archive.AbstractRWArchiveFile in project mucommander by mucommander.

the class CopyJob method jobCompleted.

// //////////////////////
// Overridden methods //
// //////////////////////
@Override
protected void jobCompleted() {
    super.jobCompleted();
    baseDestFolder.postCopyHook();
    // If the destination files are located inside an archive, optimize the archive file
    AbstractArchiveFile archiveFile = baseDestFolder.getParentArchive();
    if (archiveFile != null && archiveFile.isArchive() && archiveFile.isWritable())
        optimizeArchive((AbstractRWArchiveFile) archiveFile);
    // select the copied file in the active table after this job has finished (and hasn't been cancelled)
    if (files.size() == 1 && newName != null && baseDestFolder.equalsCanonical(files.elementAt(0).getParent())) {
        // Resolve new file instance now that it exists: some remote files do not immediately update file attributes
        // after creation, we need to get an instance that reflects the newly created file attributes
        selectFileWhenFinished(FileFactory.getFile(baseDestFolder.getAbsolutePath(true) + newName));
    }
}
Also used : AbstractArchiveFile(com.mucommander.commons.file.archive.AbstractArchiveFile) AbstractRWArchiveFile(com.mucommander.commons.file.archive.AbstractRWArchiveFile)

Example 4 with AbstractRWArchiveFile

use of com.mucommander.commons.file.archive.AbstractRWArchiveFile in project mucommander by mucommander.

the class DeleteJob method jobCompleted.

@Override
protected void jobCompleted() {
    super.jobCompleted();
    // If the source files are located inside an archive, optimize the archive file
    AbstractArchiveFile archiveFile = getBaseSourceFolder().getParentArchive();
    if (archiveFile != null && archiveFile.isArchive() && archiveFile.isWritable()) {
        while (true) {
            try {
                archiveToOptimize = ((AbstractRWArchiveFile) archiveFile);
                isOptimizingArchive = true;
                archiveToOptimize.optimizeArchive();
                break;
            } catch (IOException e) {
                if (showErrorDialog(errorDialogTitle, Translator.get("error_while_optimizing_archive", archiveFile.getName())) == FileJobAction.RETRY)
                    continue;
                break;
            }
        }
        isOptimizingArchive = true;
    }
}
Also used : AbstractArchiveFile(com.mucommander.commons.file.archive.AbstractArchiveFile) IOException(java.io.IOException) AbstractRWArchiveFile(com.mucommander.commons.file.archive.AbstractRWArchiveFile)

Aggregations

AbstractArchiveFile (com.mucommander.commons.file.archive.AbstractArchiveFile)4 AbstractRWArchiveFile (com.mucommander.commons.file.archive.AbstractRWArchiveFile)4 IOException (java.io.IOException)1