Index: trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java	(revision 4293)
+++ trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java	(revision 4364)
@@ -35,103 +35,103 @@
  */
 public class SynchronizedTreeModelTools {
-	 /** Adds an insertNodeInto model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above. */
-	 static final public Runnable insertNodeInto(final DefaultTreeModel model, final MutableTreeNode parent, final MutableTreeNode target_node) {
-		  final Runnable doInsertNodeInto = new Runnable() {
-					 public void run() {
-						  int index = -1;
-						  int pos = 0;
-						  while(index == -1 && pos < parent.getChildCount()) {
-								TreeNode node = parent.getChildAt(pos);
-								int result = 0;
-								///ystem.err.println("Compare " + target_node + " to " + node);
-								if((target_node.isLeaf() && node.isLeaf()) || (!target_node.isLeaf() && !node.isLeaf())) {
-									 result = target_node.toString().toLowerCase().compareTo(node.toString().toLowerCase());
-								}
-								else if(target_node.isLeaf()) {
-									 result = -1;
-								}
-								else {
-									 result = 1;
-								}
-								if(result > 0) {
-									 ///ystem.err.println("Keep searching...");
-									 pos++;
-								}
-								else {
-									 ///ystem.err.println("Found!");
-									 index = pos;
-								}
-						  }
-						  if(index == -1) {
-								index = parent.getChildCount();
-						  }
-						  model.insertNodeInto(target_node, parent, index);
-					 }
-				};
-		  try {
+    /** Adds an insertNodeInto model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above. */
+    static final public Runnable insertNodeInto(final DefaultTreeModel model, final MutableTreeNode parent, final MutableTreeNode target_node) {
+	final Runnable doInsertNodeInto = new Runnable() {
+		public void run() {
+		    int index = -1;
+		    int pos = 0;
+		    while(index == -1 && pos < parent.getChildCount()) {
+			TreeNode node = parent.getChildAt(pos);
+			int result = 0;
+			///ystem.err.println("Compare " + target_node + " to " + node);
+			if((target_node.isLeaf() && node.isLeaf()) || (!target_node.isLeaf() && !node.isLeaf())) {
+			    result = target_node.toString().toLowerCase().compareTo(node.toString().toLowerCase());
+			}
+			else if(target_node.isLeaf()) {
+			    result = -1;
+			}
+			else {
+			    result = 1;
+			}
+			if(result > 0) {
+			    ///ystem.err.println("Keep searching...");
+			    pos++;
+			}
+			else {
+			    ///ystem.err.println("Found!");
+			    index = pos;
+			}
+		    }
+		    if(index == -1) {
+			index = parent.getChildCount();
+		    }
+		    model.insertNodeInto(target_node, parent, index);
+		}
+	    };
+	try {
 				//SwingUtilities.invokeLater(doInsertNodeInto);
-				SwingUtilities.invokeAndWait(doInsertNodeInto);
-		  }
-		  catch (Exception e) {
-				e.printStackTrace();
-		  }
-		  // If (and only if) we've thrown an error because we tried to invoke the runnable task and wait, when we are in the AWTEvent thread already, then try agin but with an invoke later.
-		  catch (java.lang.Error error) {
-				if(error.toString().equals("java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread")) {
-					 SwingUtilities.invokeLater(doInsertNodeInto);
-				}
-		  }
-		  return doInsertNodeInto;
-	 }
-	 /** Adds a removeNodeFromParent model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above.
-	  * @param model The <strong>GTreeModel</strong> we want to remove the node from.
-	  * @param target_node The <strong>GTreeNode</strong> to remove.
-	  */
-	 static final public void removeNodeFromParent(final DefaultTreeModel model, final MutableTreeNode target_node) {
-		  ///ystem.err.println("Remove " + target_node + " from parent in model " + model);
-		  final Runnable doRemoveNodeFromParent = new Runnable() {
-					 public void run() {
-						  model.removeNodeFromParent(target_node);
-					 }
-				};
-		  try {
+	    SwingUtilities.invokeAndWait(doInsertNodeInto);
+	}
+	catch (Exception e) {
+	    e.printStackTrace();
+	}
+	// If (and only if) we've thrown an error because we tried to invoke the runnable task and wait, when we are in the AWTEvent thread already, then try agin but with an invoke later.
+	catch (java.lang.Error error) {
+	    if(error.toString().equals("java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread")) {
+		SwingUtilities.invokeLater(doInsertNodeInto);
+	    }
+	}
+	return doInsertNodeInto;
+    }
+    /** Adds a removeNodeFromParent model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above.
+     * @param model The <strong>GTreeModel</strong> we want to remove the node from.
+     * @param target_node The <strong>GTreeNode</strong> to remove.
+     */
+    static final public void removeNodeFromParent(final DefaultTreeModel model, final MutableTreeNode target_node) {
+	///ystem.err.println("Remove " + target_node + " from parent in model " + model);
+	final Runnable doRemoveNodeFromParent = new Runnable() {
+		public void run() {
+		    model.removeNodeFromParent(target_node);
+		}
+	    };
+	try {
 				//SwingUtilities.invokeLater(doRemoveNodeFromParent);
-				SwingUtilities.invokeAndWait(doRemoveNodeFromParent);
-		  }
-		  catch (Exception e) {
-				e.printStackTrace();
+	    SwingUtilities.invokeAndWait(doRemoveNodeFromParent);
+	}
+	catch (Exception e) {
+	    e.printStackTrace();
 				///ystem.err.println(e);
-		  }
-		  // If we've thrown an error because we tried to invoke the runnable task and wait, when we are in the AWTEvent thread already, then try agin but with an invoke later.
-		  catch (java.lang.Error error) {
-				if(error.toString().equals("java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread")) {
-					 SwingUtilities.invokeLater(doRemoveNodeFromParent);
-				}
-		  }
-	 }
-	 /** Adds a replaceNode model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above.
-	  * @param model The <strong>GTreeModel</strong> we want to change.
-	  * @param old_node The <strong>GTreeNode</strong> to replace.
-	  * @param new_node The <strong>GTreeNode</strong> to replace it with.
-	  */
-	 static final public void replaceNode(final DefaultTreeModel model, final MutableTreeNode old_node, final MutableTreeNode new_node) {
-		  final Runnable doReplaceNode = new Runnable() {
-					 public void run() {
-						  MutableTreeNode parent = (MutableTreeNode) old_node.getParent();
-						  if(parent != null) {
-								int index = parent.getIndex(old_node);
-								model.removeNodeFromParent(old_node);
-								model.insertNodeInto(new_node, parent, index);
-						  }
-						  parent = null;
-					 }
-				};
-		  try {
+	}
+	// If we've thrown an error because we tried to invoke the runnable task and wait, when we are in the AWTEvent thread already, then try agin but with an invoke later.
+	catch (java.lang.Error error) {
+	    if(error.toString().equals("java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread")) {
+		SwingUtilities.invokeLater(doRemoveNodeFromParent);
+	    }
+	}
+    }
+    /** Adds a replaceNode model update onto the AWT Event queue. This gets around the lack of synchronization illustrated above.
+     * @param model The <strong>GTreeModel</strong> we want to change.
+     * @param old_node The <strong>GTreeNode</strong> to replace.
+     * @param new_node The <strong>GTreeNode</strong> to replace it with.
+     */
+    static final public void replaceNode(final DefaultTreeModel model, final MutableTreeNode old_node, final MutableTreeNode new_node) {
+	final Runnable doReplaceNode = new Runnable() {
+		public void run() {
+		    MutableTreeNode parent = (MutableTreeNode) old_node.getParent();
+		    if(parent != null) {
+			int index = parent.getIndex(old_node);
+			model.removeNodeFromParent(old_node);
+			model.insertNodeInto(new_node, parent, index);
+		    }
+		    parent = null;
+		}
+	    };
+	try {
 				//SwingUtilities.invokeLater(doReplaceNode);
-				SwingUtilities.invokeAndWait(doReplaceNode);
-		  }
-		  catch (Exception e) {
-				e.printStackTrace();
-		  }
-	 }
+	    SwingUtilities.invokeAndWait(doReplaceNode);
+	}
+	catch (Exception e) {
+	    e.printStackTrace();
+	}
+    }
 }
