Index: trunk/gli/src/org/greenstone/gatherer/file/FileManager.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/file/FileManager.java	(revision 7357)
+++ trunk/gli/src/org/greenstone/gatherer/file/FileManager.java	(revision 7360)
@@ -43,4 +43,5 @@
 import org.greenstone.gatherer.file.FileNode;
 import org.greenstone.gatherer.file.FileQueue;
+import org.greenstone.gatherer.gui.LongProgressBar;
 import org.greenstone.gatherer.gui.NewFolderPrompt;
 import org.greenstone.gatherer.gui.tree.DragTree;
@@ -146,4 +147,5 @@
 	private FileNode[] source_nodes;
 	private long id;
+
 	public Task(long id, DragComponent source, FileNode[] source_nodes, DragComponent target, FileNode target_node, byte type) {
 	    this.id = id;
@@ -154,11 +156,27 @@
 	    this.type = type;
 	}
-	public void run() {
-	    // Reset, and calculate progress bar size.
+
+	public void run()
+	{
+	    // Check there is something to do
+	    if (source_nodes == null) {
+		return;
+	    }
+
+	    // Reset the progress bar and set it to indeterminate while calculating its size
+	    LongProgressBar progress_bar = queue.getProgressBar();
+	    progress_bar.reset();
+	    progress_bar.setIndeterminate(true);
+
+	    // Calculate the progress bar size
 	    boolean cancelled = queue.calculateSize(source_nodes);
-	    // Now we queue the job(s). Note that this may fail if a read only file is encountered and we have been asked to delete.
-	    for(int i = 0; !cancelled && source_nodes != null && i < source_nodes.length; i++) {
-		queue.addJob(id, source, source_nodes[i], target, target_node, type, true, true, true);
+	    if (!cancelled) {
+		// Queue the job(s) (this may fail if we are asked to delete a read only file)
+		for (int i = 0; i < source_nodes.length; i++) {
+		    queue.addJob(id, source, source_nodes[i], target, target_node, type, true, true, true);
+		}
 	    }
+
+	    progress_bar.setIndeterminate(false);
 	}
     }
Index: trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java	(revision 7357)
+++ trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java	(revision 7360)
@@ -72,5 +72,4 @@
     private JLabel file_status = null;
     /** A list containing a queue of waiting movement jobs. */
-    //private LinkedList queue;
     private ArrayList queue;
     /** A progress bar which shows how many bytes, out of the total size of bytes, has been moved. */
@@ -86,5 +85,5 @@
     public FileQueue(boolean return_immediately) {
 	this.return_immediately = return_immediately;
-	this.queue = new ArrayList();//LinkedList();
+	this.queue = new ArrayList();
 	String args[] = new String[2];
 	args[0] = "0";
@@ -141,27 +140,28 @@
      * @see org.greenstone.gatherer.file.FileManager.Task#run()
      */
-    public boolean calculateSize(FileNode[] files) {
-	progress.reset();
+    public boolean calculateSize(FileNode[] files)
+    {
+	file_status.setText(Dictionary.get("FileActions.Calculating_Size"));
 	progress.setString(Dictionary.get("FileActions.Calculating_Size"));
-	progress.setIndeterminate(true);
+
+	// Calculate the total file size of all the selected file nodes
 	Vector remaining = new Vector();
-	for(int i = 0; !cancel_action && i < files.length; i++) {
+	for (int i = 0; !cancel_action && i < files.length; i++) {
 	    remaining.add(files[i]);
 	}
-	while(!cancel_action && remaining.size() > 0) {
-	    FileNode node = (FileNode)remaining.remove(0);
-	    if(node.isLeaf()) {
+	while (!cancel_action && remaining.size() > 0) {
+	    FileNode node = (FileNode) remaining.remove(0);
+	    if (node.isLeaf()) {
 		progress.addMaximum(node.getFile().length());
 	    }
 	    else {
-		for(int i = 0; !cancel_action && i < node.getChildCount(); i++) {
+		for (int i = 0; !cancel_action && i < node.getChildCount(); i++) {
 		    remaining.add(node.getChildAt(i));
 		}
 	    }
 	}
-	progress.setString(Dictionary.get("FileActions.No_Activity"));
-	progress.setIndeterminate(false);
+
 	// Now we return if calculation was cancelled so that the FileManagers Task can skip the addJob phase correctly.
-	if(cancel_action) {
+	if (cancel_action) {
 	    cancel_action = false; // reset
 	    return true;
@@ -182,5 +182,5 @@
 
     /** Access to the progress bar. */
-    public LongProgressBar getProgress() {
+    public LongProgressBar getProgressBar() {
 	return progress;
     }
@@ -189,4 +189,6 @@
 	progress.setIndeterminate(true);
     }
+
+
     /** The run method exists in every thread, and here it is used to work its way through the queue of Jobs. If no jobs are waiting and it cans, it waits until a job arrives. If a job is present then it is either COPIED or DELETED, with the records being copied or removed as necessary, and directories being recursed through. Finally the user can press cancel to cause the loop to prematurely dump the job queue then wait.
      * @see org.greenstone.gatherer.Gatherer
@@ -199,7 +201,9 @@
      * @see org.greenstone.gatherer.util.Utility
      */
-    public void run() {
+    public void run()
+    {
 	super.setName("FileQueue");
-	while(!Gatherer.self.exit) {
+
+	while (!Gatherer.self.exit) {
 	    try {
 		// Retrieve the next job
@@ -475,4 +479,9 @@
 			///atherer.println("Delete/Move: " + origin_node);
 			///atherer.println(queue.size() + " jobs remain in queue");
+
+			if (source_file.isFile()) {
+			    progress.addValue(source_file.length());
+			}
+
 			// If the source is an empty directory or a file. Don't do anything to the root node of a tree.
 			File[] child_list = source_file.listFiles();
@@ -487,6 +496,5 @@
 			    // update status area
 			    String args[] = new String[1];
-			    args[0] = "" + (queue.size() + 1) + "";
-			    //job_status.setText(Dictionary.get("FileActions.Jobs", args));
+			    // args[0] = "" + (queue.size() + 1) + "";
 			    args[0] = Utility.formatPath("FileActions.Deleting", source_file.getAbsolutePath(), file_status.getSize().width);
 			    file_status.setText(Dictionary.get("FileActions.Deleting", args));
@@ -510,51 +518,6 @@
 			    File recycled_file = null;
 			    FileNode recycled_parent = null;
-			    if(job.type == FileJob.DELETE) {
-
-			       /** If we ever decide to reenable undo then this code will have to be seriously improved.
-				// See if this record already has a previous recycle folder noted in the recycle folder mappings.
-				recycled_parent = (FileNode) recycle_folder_mappings.get(origin_node);
-				if(recycled_parent != null) {
-				    recycle_folder_mappings.remove(origin_node);
-				}
-				else {
-				    recycled_parent = (FileNode) Gatherer.c_man.undo.getTreeModel().getRoot();
-				}
-				// This may be a directory which we have already added previously.
-				if(completed_folder_mappings.containsKey(origin_node)) {
-				    FileNode recycled_record = (FileNode) completed_folder_mappings.get(origin_node);
-				    // Replace the temporary directory record in the undo tree with this one.
-				    SynchronizedTreeModelTools.replaceNode(Gatherer.c_man.undo.getTreeModel(), recycled_record, origin_node);
-				    origin_node.setFile(recycled_record.getFile());
-				}
-				else {
-				    // copy the file to the recycle bin
-				    recycled_file = new File(recycled_parent.getFile(), origin_node.toString());
-				    // If the file already exists, delete it.
-				    if(recycled_file.exists()) {
-					recycled_file.delete();
-				    }
-				    recycled_file.deleteOnExit();
-				    copyFile(source_file, recycled_file, progress);
-				    origin_node.setFile(recycled_file);
-				    // Add the node to the appropriate place in the UndoManagers tree model. Unfortunately this one does have the possibility of altering the GUI (if the removeNodeFromParent above hasn't occured yet), so we must put it on the queue.
-				    SynchronizedTreeModelTools.insertNodeInto(Gatherer.c_man.undo.getTreeModel(), recycled_parent, origin_node);
-				}
-				Gatherer.c_man.undo.addMetadata(source_file, metadatum);
-			       **/
-			    }
 			    // delete the source file
 			    Utility.delete(source_file);
-			    /**
-			    // create undo job as necessary. File move would have been handled above.
-			    if(job.undoable) {
-				job.undoable = false;
-				// The target is null, indicating that we moved this file to the recycle bin. The UndoManager will replace null with 'this'.
-				Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_DELETE, job.source, parent_record, null, origin_node, job.undo);
-			    }
-			    recycled_parent = null;
-			    recycled_file = null;
-			    **/
-			    //metadatum = null;
 			}
 			// Else the source is a directory and it has children remaining
@@ -565,24 +528,4 @@
 			    // Don't worry about all this for true file move actions.
 			    if(job.type == FileJob.DELETE) {
-			       /** Again, if we reenable undo then this code must be debugged.
-				// See if this record already has a previous recycle folder noted in the recycle folder mappings.
-				FileNode parent = (FileNode) recycle_folder_mappings.get(origin_node);
-				if(parent != null) {
-				    recycle_folder_mappings.remove(origin_node);
-				}
-				else {
-				    parent = (FileNode) Gatherer.c_man.undo.getTreeModel().getRoot();
-				}
-				// We must add the folder node to our undo manager tree now, so we'll have something to add children to. We use a copy of the directory file record.
-				File recycle_folder = new File(parent.getFile(), origin_node.toString());
-				recycle_folder.deleteOnExit();
-				recycle_folder.mkdirs();
-				recycle_folder_record = new FileNode(recycle_folder);
-				// Add this node to the undo tree model.
-				SynchronizedTreeModelTools.insertNodeInto(Gatherer.c_man.undo.getTreeModel(), parent, recycle_folder_record);
-				// We add an entry to the complete mappings to ensure this directory isn't added again
-				completed_folder_mappings.put(origin_node, recycle_folder_record);
-				///ystem.err.println("Added completed directories mapping " + origin_node);
-				**/
 			       // queue all of its children, (both filtered and non-filtered), but for deleting only. Don't queue jobs for a current move event, as they would be queued as part of copying. I have no idea way, per sec, however the children within the origin node are always invalid during deletion (there are several copies of some nodes?!?). I'll check that each child is only added once.
 			       ///ystem.err.println("Directory has " + origin_node.getChildCount() + " children.");
@@ -638,5 +581,4 @@
 			}
 			// Reset status area
-			//job_status.setText(Dictionary.get("No_Selection"));
 			file_status.setText(Dictionary.get("FileActions.No_Activity"));
 			progress.reset();
@@ -672,21 +614,4 @@
 	this.stop_button = stop_button;
     }
-
-    /** A second lock is necessary to prevent the thread waiting, because its notify occured momentarily before it waited. If the flag is set then the thread can't wait, but loops around. This may chew processor time so should only be used if you are certain files are about to be placed on the queue.
-     * @param wait_allowed The new state of the wait_allowed flag, as a boolean.
-     */
-    /* private void setWaitAllowed(boolean wait_allowed) {
-	this.wait_allowed = wait_allowed;
-	} */
-    /** Restore the progress bar so that it updates normally.
-     * @see org.greenstone.gatherer.gui.LongProgressBar
-     */
-    /* synchronized private void unpause() {
-	progress.setIndeterminate(false);
-	if(previous != null) {
-	    progress.setString(previous);
-	    previous = null;
-	}
-	} */
 
     /** Called when the user makes some selection in one of the trees we are listening to. From this we update the status details. */
@@ -708,9 +633,4 @@
 	    }
 	    selection = null;
-	    // String args[] = new String[2];
-	    // args[0] = "" + file_count + "";
-	    // args[1] = "" + dir_count + "";
-	    // job_status.setText(get("Selected", args));
-	    // args = null;
 	}
 	tree = null;
Index: trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java	(revision 7357)
+++ trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java	(revision 7360)
@@ -364,5 +364,5 @@
 	//JLabel job_status = job_queue.getJobStatus();
 
-	JProgressBar progress = file_queue.getProgress();
+	JProgressBar progress_bar = file_queue.getProgressBar();
 
 	JPanel button_pane = new JPanel();
@@ -402,5 +402,5 @@
 	progress_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
 	progress_pane.setLayout(new BorderLayout());
-	progress_pane.add(progress, BorderLayout.CENTER);
+	progress_pane.add(progress_bar, BorderLayout.CENTER);
 
 	inner_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10,10,10,10), BorderFactory.createLoweredBevelBorder()));
