Ejemplo n.º 1
0
  @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);

    // If this job corresponds to a file renaming in the same directory, select the renamed 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));
    }
  }
Ejemplo n.º 2
0
  @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);

    // If this job correponds to a 'local copy' of a single file and in the same directory,
    // 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));
    }
  }