Changeset 9464


Ignore:
Timestamp:
2005-03-18T13:44:38+13:00 (19 years ago)
Author:
kjdon
Message:

enabled drag and drop onto a file - just puts it into the same directory as the file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java

    r8994 r9464  
    345345        if(isValidDrop(target_path)) {
    346346            target = (FileNode) target_path.getLastPathComponent();
     347        } else if (isValidDropOntoFile(target_path)) {
     348            target = (FileNode) target_path.getParentPath().getLastPathComponent();
    347349        }
    348350        }
     
    628630    }
    629631
     632    private boolean isValidDropOntoFile(TreePath target_path) {
     633    boolean valid = false;
     634    if(target_path != null) {
     635        FileNode target_node = (FileNode) target_path.getLastPathComponent();
     636        if (target_node.isLeaf()) {
     637        // check the parent node for being a valid drop
     638        return isValidDrop(target_path.getParentPath());
     639        }
     640    }
     641    return false;
     642    }
     643
     644       
    630645    private boolean isValidDrop(TreePath target_path) {
    631646    boolean valid = false;
Note: See TracChangeset for help on using the changeset viewer.