Changeset 11242 for trunk


Ignore:
Timestamp:
2006-02-14T14:58:24+13:00 (18 years ago)
Author:
mdewsnip
Message:

Added the back-end code for supporting file/folder renames in the collection tree (Gather pane). Renaming is done almost exactly the same as moving.

Location:
trunk/gli/src/org/greenstone/gatherer/file
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileJob.java

    r11241 r11242  
    6060    /** An element of the job type enumeration indicating an empty folder delete action. */
    6161    static final public byte DELETE_EMPTY_DIRECTORY = 5;
     62    /** An element of the job type enumeration indicating a rename action. */
     63    static final public byte RENAME = 6;
    6264
    6365    /** Constructor.
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r11241 r11242  
    312312    File source_directory = source_node.getFile();
    313313    File target_directory = new File(target_node.getFile(), source_directory.getName());
     314    if (file_job.type == FileJob.RENAME) {
     315        // This is the only difference between moves and renames
     316        target_directory = target_node.getFile();
     317        target_node = (FileNode) source_node.getParent();
     318    }
    314319
    315320    // Check the target directory isn't the source directory
     
    486491    File source_file = source_node.getFile();
    487492    File target_file = new File(target_node.getFile(), source_file.getName());
     493    if (file_job.type == FileJob.RENAME) {
     494        // This is the only difference between moves and renames
     495        target_file = target_node.getFile();
     496        target_node = (FileNode) source_node.getParent();
     497    }
    488498
    489499    // Check the target file isn't the source file
     
    580590    }
    581591
    582     // Move job
    583     if (file_job.type == FileJob.MOVE) {
     592    // Move (or rename) job
     593    if (file_job.type == FileJob.MOVE || file_job.type == FileJob.RENAME) {
    584594        file_status.setText(Dictionary.get("FileActions.Moving", formatPath("FileActions.Moving", source_file.getAbsolutePath(), file_status.getSize().width)));
    585595        if (source_file.isFile()) {
Note: See TracChangeset for help on using the changeset viewer.