Changeset 4313
- Timestamp:
- 2003-05-23T16:36:19+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r4293 r4313 18 18 import org.greenstone.gatherer.util.DragGroup; 19 19 import org.greenstone.gatherer.util.DragTreeSelectionModel; 20 import org.greenstone.gatherer.util.Utility; 20 21 21 22 public class DragTree … … 304 305 ///ystem.err.println("Drop target drop: " + this); 305 306 event.acceptDrop(drag_action); 306 // Determine what node we dropped over. The current valid drop path, if any, is stored in previous path. 307 if(previous_path != null && isValidDrop(previous_path)) { 308 ///ystem.err.println("Valid drop."); 309 FileNode target = (FileNode) previous_path.getLastPathComponent(); 310 TreePath[] selection = group.getSelection(); 307 if(!name.equals(Utility.WORKSPACE_TREE)) { 308 // Determine what node we dropped over. 309 Point pt = event.getLocation(); 310 TreePath target_path = this.getPathForLocation(pt.x, pt.y); 311 FileNode target = null; 312 if(target_path != null) { 313 if(isValidDrop(target_path)) { 314 target = (FileNode) target_path.getLastPathComponent(); 315 } 316 else { 317 // Warn that this is an invalid drop. 318 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("FileActions.InvalidTarget"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 319 } 320 } 321 else { 322 target = (FileNode) getModel().getRoot(); 323 } 324 target_path = null; 325 pt = null; 311 326 if(target != null) { 312 FileNode[] source_nodes = new FileNode[selection.length]; 313 for(int i = 0; i < source_nodes.length; i++) { 314 source_nodes[i] = (FileNode) selection[i].getLastPathComponent(); 315 } 316 Gatherer.f_man.action(group.getSource(), source_nodes, this, target); 317 source_nodes = null; 318 } 319 group.setSelection(null); 320 group.setSource(null); 321 selection = null; 322 target = null; 327 ///ystem.err.println("Valid drop."); 328 TreePath[] selection = group.getSelection(); 329 if(target != null) { 330 FileNode[] source_nodes = new FileNode[selection.length]; 331 for(int i = 0; i < source_nodes.length; i++) { 332 source_nodes[i] = (FileNode) selection[i].getLastPathComponent(); 333 } 334 Gatherer.f_man.action(group.getSource(), source_nodes, this, target); 335 source_nodes = null; 336 } 337 group.setSelection(null); 338 group.setSource(null); 339 selection = null; 340 target = null; 341 } 323 342 } 324 343 else { 325 ///ystem.err.println("Not a valid drop."); 344 // Warn that this is an invalid drop. 345 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("FileActions.ReadOnlyTarget"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 326 346 } 327 347 // Clear up the group.image_ghost
Note:
See TracChangeset
for help on using the changeset viewer.