Index: main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java	(revision 32050)
+++ main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java	(revision 32091)
@@ -25,4 +25,8 @@
 
 package org.greenstone.gatherer.gui;
+
+// for RSyntaxTextArea editor's search functionality:
+import org.fife.ui.rtextarea.SearchEngine;
+import org.fife.ui.rtextarea.SearchContext;
 
 import org.greenstone.gatherer.Configuration;
@@ -35,5 +39,4 @@
 import org.w3c.dom.*;
 
-
 import java.io.File;
 import java.io.IOException;
@@ -57,4 +60,12 @@
     private JTextArea editor_msgarea;
 
+    
+    // https://github.com/bobbylight/RSyntaxTextArea/wiki/Example:-Using-Find-and-Replace
+    private JTextField searchField;
+    private JCheckBox regexCB;
+    private JCheckBox matchCaseCB;
+    private JButton nextButton;
+    private JButton prevButton;
+	
     //private final String DEFAULT_PROCESSING_INSTRUCTION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";    
 
@@ -62,9 +73,9 @@
 
     public ConfigFileEditor() {
-
-      super(Gatherer.g_man, true);
-      setModal(true);
-      setSize(SIZE);
-
+	
+	super(Gatherer.g_man, true);
+	setModal(true);
+	setSize(SIZE);
+	
 	String collection_folder_path = Gatherer.getCollectDirectoryPath();
 	String collectionName  = Gatherer.c_man.getCollection().getName(); // we won't be in this constructor if collection is null.
@@ -88,4 +99,24 @@
 	validation_msg_panel.add(validation_label, BorderLayout.WEST);
 	validation_msg_panel.add(new JScrollPane(editor_msgarea), BorderLayout.CENTER);
+
+	// Find functionality - can extend for Find and Replace
+	// taken from https://github.com/bobbylight/RSyntaxTextArea/wiki/Example:-Using-Find-and-Replace
+	// Create a toolbar with searching options.
+	JToolBar toolBar = new JToolBar();
+	searchField = new JTextField(30);
+	toolBar.add(searchField);
+	nextButton = new JButton("Find Next");
+	nextButton.setActionCommand("FindNext");
+	nextButton.addActionListener(this);
+	toolBar.add(nextButton);
+	searchField.addActionListener(this);
+	prevButton = new JButton("Find Previous");
+	prevButton.setActionCommand("FindPrev");
+	prevButton.addActionListener(this);
+	toolBar.add(prevButton);
+	regexCB = new JCheckBox("Regex");
+	toolBar.add(regexCB);
+	matchCaseCB = new JCheckBox("Match Case");
+	toolBar.add(matchCaseCB);
 	
 	// the all important XML editor
@@ -106,4 +137,9 @@
 	button_panel.add(save_button);
 
+	// toolbars_panel to contain find-and-replace toolbar and undo/redo/cancel/save button panel
+	JPanel toolbars_panel = new JPanel(new BorderLayout());
+	toolbars_panel.add(toolBar, BorderLayout.NORTH);
+	toolbars_panel.add(button_panel, BorderLayout.CENTER);
+	
 	JPanel content_pane = (JPanel) getContentPane();
 	content_pane.setComponentOrientation(Dictionary.getOrientation());
@@ -111,6 +147,6 @@
 	content_pane.add(validation_msg_panel, BorderLayout.NORTH);
 	content_pane.add(new JScrollPane(editor), BorderLayout.CENTER); // make editor scrollable
-	content_pane.add(button_panel, BorderLayout.SOUTH);
-
+	//content_pane.add(button_panel, BorderLayout.SOUTH);
+	content_pane.add(toolbars_panel, BorderLayout.SOUTH);
 	
 	// NOW WE CAN PREPARE THE ACTUAL CONTENT TO GO INTO THE XML EDITOR TEXTAREA
@@ -166,4 +202,5 @@
 	Dimension screen_size = Configuration.screen_size;
 	setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
+	editor.setCaretPosition(0); // start at top of config XML
     }
 
@@ -190,6 +227,44 @@
 	    Gatherer.c_man.loadCollection(current_collection_filepath);
 	}
-    }
-
+	
+	// Find functionality, can extend for Find and Replace
+	// taken from https://github.com/bobbylight/RSyntaxTextArea/wiki/Example:-Using-Find-and-Replace
+	else if(e.getSource() == searchField) {
+	    nextButton.doClick(0);
+	}
+	else if(e.getSource() == nextButton || e.getSource() == prevButton) {
+	    // "FindNext" => search forward, "FindPrev" => search backward
+	    String command = e.getActionCommand();
+	    boolean forward = "FindNext".equals(command);
+	    
+	    // Create an object defining our search parameters.
+	    SearchContext context = new SearchContext();
+	    String text = searchField.getText();
+	    if (text.length() == 0) {
+		return;
+	    }
+	    context.setSearchFor(text);
+	    context.setMatchCase(matchCaseCB.isSelected());
+	    context.setRegularExpression(regexCB.isSelected());
+	    context.setSearchForward(forward);
+	    context.setWholeWord(false);
+
+	    //boolean found = SearchEngine.find(this.editor, context).wasFound();
+	    boolean found = false;
+	    try {
+		found = SearchEngine.find(this.editor, context);
+		// if the current search string is a correction to a previous invalid regex,
+		// then return background colour back to normal
+		searchField.setBackground(Color.white);
+		if (!found) {
+		    JOptionPane.showMessageDialog(this, "Text not found");
+		}
+	    } catch(java.util.regex.PatternSyntaxException regex_exception) {
+		searchField.setBackground(Color.red);
+		JOptionPane.showMessageDialog(this, "Invalid regex");
+	    }
+	    
+	}
+    }
     
    
