Changeset 8599
- Timestamp:
- 2004-11-18T15:16:13+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/file
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileJob.java
r8243 r8599 39 39 40 40 public boolean folder_level = false; 41 /** true if this should generate an undo event, false for a redo one. */42 public boolean undo = true;43 /** true if this job should generate an undo event of any kind. */44 public boolean undoable = false;45 41 /** The type of this movement as an byte. */ 46 42 public byte type = 0; … … 69 65 * @param dest The files new FileNode parent within the target. 70 66 * @param type The type of this movement as an int, either COPY or DELETE. 71 * @param undo true if this job some create an undo job when actioned, false for a redo job.72 * @param undoable true if this job can generate undo or redo jobs, false otherwise.73 67 */ 74 public FileJob(long id, DragComponent source, FileNode orig, DragComponent target, FileNode dest, byte type , boolean undo, boolean undoable) {68 public FileJob(long id, DragComponent source, FileNode orig, DragComponent target, FileNode dest, byte type) { 75 69 this.id = id; 76 70 this.source = source; 77 71 this.target = target; 78 72 this.type = type; 79 this.undo = undo;80 this.undoable = undoable;81 73 ///ystem.err.println("New Job: " + type + ", " + source + ", " + target); 82 74 // Dont store FileNodes which can go stale. Store paths instead, which are used to locate current 'fresh' versions of nodes. -
trunk/gli/src/org/greenstone/gatherer/file/FileManager.java
r8595 r8599 190 190 // Queue the job(s) (this may fail if we are asked to delete a read only file) 191 191 for (int i = 0; i < source_nodes.length; i++) { 192 queue.addJob(id, source, source_nodes[i], target, target_node, type, true , true, true);192 queue.addJob(id, source, source_nodes[i], target, target_node, type, true); 193 193 } 194 194 } -
trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java
r8598 r8599 94 94 * @param parent The files new FileNode parent within the target. 95 95 * @param type The type of this movement as an int, either COPY or DELETE. 96 * @param undo true if this job should generate undo jobs, false for redo ones. 97 * @param undoable true if this job can generate undo or redo jobs at all, false otherwise. 98 */ 99 public void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean undo, boolean undoable, boolean folder_level) { 100 addJob(id, source, child, target, parent, type, undo, undoable, folder_level, -1); 101 } 102 103 synchronized private void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean undo, boolean undoable, boolean folder_level, int position) { 104 FileJob job = new FileJob(id, source, child, target, parent, type, undo, undoable); 96 */ 97 public void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean folder_level) { 98 addJob(id, source, child, target, parent, type, folder_level, -1); 99 } 100 101 synchronized private void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean folder_level, int position) { 102 FileJob job = new FileJob(id, source, child, target, parent, type); 105 103 job.folder_level = folder_level; 106 104 DebugStream.println("Adding job: " + job); … … 186 184 // Retrieve the next job 187 185 int position = queue.size() - 1; 188 FileJob job = removeJob(position); 186 FileJob job = null; 187 if (position >= 0) { 188 job = (FileJob) queue.remove(position); 189 } 190 189 191 if (job != null) { 190 192 ///ystem.err.println("Found job: " + job); … … 357 359 SynchronizedTreeModelTools.insertNodeInto(target_model, destination_node, new_record); 358 360 new_node = new_record; 359 360 // create undo job361 if(job.undoable) {362 job.undoable = false;363 }364 361 new_record = null; 365 362 } … … 369 366 // create new record 370 367 FileNode directory_record = new FileNode(target_file); 371 ///ystem.err.println("Directory record = " + directory_record + " (" + target_file.getAbsolutePath() + ")");372 368 SynchronizedTreeModelTools.insertNodeInto(target_model, destination_node, directory_record); 373 369 // Why is this not happening eh? … … 377 373 target_file.mkdirs(); 378 374 new_node = directory_record; 379 // create undo job380 if(job.undoable) {381 job.undoable = false;382 }383 375 } 384 376 // Else inform the users that a directory already exists and files will be copied into it … … 398 390 for(int i = 0; i < origin_node.getChildCount(); i++) { 399 391 child_record = (FileNode) origin_node.getChildAt(i); 400 addJob(job.ID(), job.source, child_record, job.target, directory_record, job.type, job.undo, false,false, position);392 addJob(job.ID(), job.source, child_record, job.target, directory_record, job.type, false, position); 401 393 } 402 394 child_record = null; … … 486 478 FileNode child_record = (FileNode) origin_node.get(i); 487 479 ///atherer.println("Queuing: " + child_record); 488 addJob(job.ID(), job.source, child_record, job.target, destination_node, FileJob.DELETE, job.undo, false,false, position);480 addJob(job.ID(), job.source, child_record, job.target, destination_node, FileJob.DELETE, false, position); 489 481 } 490 482 } … … 666 658 } 667 659 } 668 669 670 private FileJob removeJob(int position) {671 FileJob job = null;672 if(queue.size() > 0) {673 job = (FileJob) queue.remove(position);674 }675 return job;676 }677 660 }
Note:
See TracChangeset
for help on using the changeset viewer.