Index: /gli/trunk/src/org/greenstone/gatherer/cdm/PluginManager.java
===================================================================
--- /gli/trunk/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 14233)
+++ /gli/trunk/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 14234)
@@ -366,4 +366,5 @@
     private void removePlugin(Plugin plugin) {
 	remove(plugin);
+  
     }
 
@@ -673,76 +674,71 @@
 	}
 
-	/** listens for changes in the list selection and enables the configure and remove buttons if there is a selection, disables them if there is no selection */
-	private class ListListener
-	    implements ListSelectionListener {
-
-	    public void valueChanged(ListSelectionEvent e) {
-		if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one (the second one)
-		    if (plugin_list.isSelectionEmpty()) {
-			move_up_button.setEnabled(false);
-			move_down_button.setEnabled(false);
-			configure.setEnabled(false);
-			remove.setEnabled(false);
-		    }
-		    else {
-			Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue();
-			if(selected_plugin.isSeparator()) {
-			    move_up_button.setEnabled(false);
-			    move_down_button.setEnabled(false);
-			    configure.setEnabled(false);
-			    remove.setEnabled(false);
-			}
-			else {
-			    configure.setEnabled(true);
-			    String plugin_name = selected_plugin.getName();
-			    // Some buttons are only available for plugins other than ArcPlug and RecPlug 
-			    if(plugin_name.equals(StaticStrings.ARCPLUG_STR) || plugin_name.equals(StaticStrings.RECPLUG_STR) ) {
-				move_up_button.setEnabled(false);
-				move_down_button.setEnabled(false);
-				remove.setEnabled(false);
-			    }
-			    else if (plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR)) {
-				remove.setEnabled(false);
-			    }
-				
-			    else {
-				// don't let people remove special plugins such GAPlug an METSPlug,
-				// unless they are in systems mode or above
-				int mode = Configuration.getMode();
-				for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) {
-				    if ((plugin_name.equals(StaticStrings.KEEP_PLUG[i])) &&
-					(mode < Configuration.SYSTEMS_MODE)) {
-					remove.setEnabled(false); 
-					break;
-				    } else {
-					remove.setEnabled(true);
-				    }
-				}
-				    
-				// Move ups are only enabled if the selected plugin isn't already at the top 
-				Plugin first_plugin = (Plugin) getElementAt(0);
-				if(!first_plugin.equals(selected_plugin)) {
-				    move_up_button.setEnabled(true);
-				}
-				else {
-				    move_up_button.setEnabled(false);
-				}
-				// And move downs are only allowed when the selected plugin isn't at an index one less than the separator line.
-				int separator_index = findSeparatorIndex();
-				int selected_index = plugin_list.getSelectedIndex();
-				if(selected_index < separator_index - 1) {
-				    move_down_button.setEnabled(true);
-				}
-				else {
-				    move_down_button.setEnabled(false);
-				}
-			    }
-			    selected_plugin = null;
-			    plugin_name = null;
-			}
-		    }
-		}
-	    }
-	}
+  /** listens for changes in the list selection and enables the configure and remove buttons if there is a selection, disables them if there is no selection */
+  private class ListListener
+    implements ListSelectionListener {
+    
+    public void valueChanged(ListSelectionEvent e) {
+      if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one (the second one)
+        if (plugin_list.isSelectionEmpty()) {
+          move_up_button.setEnabled(false);
+          move_down_button.setEnabled(false);
+          configure.setEnabled(false);
+          remove.setEnabled(false);
+        } else {
+          Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue();
+          if(selected_plugin.isSeparator()) {
+            move_up_button.setEnabled(false);
+            move_down_button.setEnabled(false);
+            configure.setEnabled(false);
+            remove.setEnabled(false);
+          } else {
+            configure.setEnabled(true);
+            String plugin_name = selected_plugin.getName();
+            // Some buttons are only available for plugins other than ArcPlug and RecPlug
+            if(plugin_name.equals(StaticStrings.ARCPLUG_STR) || plugin_name.equals(StaticStrings.RECPLUG_STR) ) {
+              move_up_button.setEnabled(false);
+              move_down_button.setEnabled(false);
+              remove.setEnabled(false);
+            } else if (plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR)) {
+              remove.setEnabled(false);
+            }
+            
+            else {
+              // don't let people remove special plugins such GAPlug an METSPlug,
+              // unless they are in systems mode or above
+              int mode = Configuration.getMode();
+              for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) {
+                if ((plugin_name.equals(StaticStrings.KEEP_PLUG[i])) &&
+                  (mode < Configuration.SYSTEMS_MODE)) {
+                  remove.setEnabled(false);
+                  break;
+                } else {
+                  remove.setEnabled(true);
+                }
+              }
+              
+              // Move ups are only enabled if the selected plugin isn't already at the top
+              Plugin first_plugin = (Plugin) getElementAt(0);
+              if(!first_plugin.equals(selected_plugin)) {
+                move_up_button.setEnabled(true);
+              } else {
+                move_up_button.setEnabled(false);
+              }
+              // And move downs are only allowed when the selected plugin isn't at an index one less than the separator line.
+              int separator_index = findSeparatorIndex();
+              int selected_index = plugin_list.getSelectedIndex();
+              if(selected_index < separator_index - 1) {
+                move_down_button.setEnabled(true);
+              } else {
+                move_down_button.setEnabled(false);
+              }
+            }
+            selected_plugin = null;
+            plugin_name = null;
+          }
+        }
+      }
+    }
+  }
 
 	/** A special list renderer which is able to render separating lines as well. */
@@ -818,55 +814,58 @@
     }
 	
-	/** This class listens for actions upon the remove button in the controls, and if detected calls the <i>removePlugin()</i> method.
-	 */
-	private class RemoveListener
-	    implements ActionListener {
-	    /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured on one of our target controls.
-	     * @param event An <strong>ActionEvent</strong> containing information garnered from the control action.
-	     */
-	    public void actionPerformed(ActionEvent event) {
-		int selected_index = plugin_list.getSelectedIndex();
-		if(selected_index != -1) {
-		    Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue();
-		    removePlugin(selected_plugin);
-		    selected_plugin = null;
-		    // Select the next plugin if available
-		    if(selected_index < plugin_list.getModel().getSize()) {
-			// If the new selection is above the separator we can remove it
-			if(selected_index < findSeparatorIndex()) {
-			    plugin_list.setSelectedIndex(selected_index);
-			    
-			    // don't let people remove special plugins such GAPlug an METSPlug,
-			    // unless they are in systems mode or above
-			    int mode = Configuration.getMode();
-			    for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) {
-				String selected_plugin_name
-				    = ((Plugin)plugin_list.getSelectedValue()).getName();
-				if ((selected_plugin_name.equals(StaticStrings.KEEP_PLUG[i])) &&
-				    (mode < Configuration.SYSTEMS_MODE)) {
-				    remove.setEnabled(false); 
-				    break;
-				} else {
-				    remove.setEnabled(true);
-				}
-			    }					
-			}
-			// Otherwise select the first non-removable plugin
-			else {
-			    plugin_list.setSelectedIndex(selected_index + 1);
-			    remove.setEnabled(false);
-			}
-		    }
-		    else {
-			remove.setEnabled(false);
-		    }
-		    // Refresh the available plugins
-		    plugin_combobox.setModel(new DefaultComboBoxModel(getAvailablePlugins()));
-		}
-		else {
-		    remove.setEnabled(false);
-		}
-	    }
-	}
+  /** This class listens for actions upon the remove button in the controls, and if detected calls the <i>removePlugin()</i> method.
+   */
+  private class RemoveListener
+    implements ActionListener {
+    /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured on one of our target controls.
+     * @param event An <strong>ActionEvent</strong> containing information garnered from the control action.
+     */
+    public void actionPerformed(ActionEvent event) {
+      int selected_index = plugin_list.getSelectedIndex();
+      if(selected_index != -1) {
+        Plugin selected_plugin = (Plugin) plugin_list.getSelectedValue();
+        removePlugin(selected_plugin);
+        selected_plugin = null;
+        // Refresh the available plugins
+        plugin_combobox.setModel(new DefaultComboBoxModel(getAvailablePlugins()));
+
+        // Select the next plugin if available
+        if(selected_index < plugin_list.getModel().getSize()) {
+          // If the new selection is above the separator we can remove it
+          if(selected_index < findSeparatorIndex()) {
+            plugin_list.setSelectedIndex(selected_index);
+            
+            // don't let people remove special plugins such GAPlug an METSPlug,
+            // unless they are in systems mode or above
+            int mode = Configuration.getMode();
+            for (int i=0; i<StaticStrings.KEEP_PLUG.length; i++) {
+              String selected_plugin_name
+                = ((Plugin)plugin_list.getSelectedValue()).getName();
+              
+              if (selected_plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR)) {
+                //this plug cannot be removed under any conditions.
+                remove.setEnabled(false);
+              }else if ((selected_plugin_name.equals(StaticStrings.KEEP_PLUG[i])) &&
+                (mode < Configuration.SYSTEMS_MODE)) {
+                remove.setEnabled(false);
+                break;
+              } else {
+                remove.setEnabled(true);
+              }
+            }
+          }
+          // Otherwise select the first non-removable plugin
+          else {
+            plugin_list.setSelectedIndex(selected_index + 1);
+            remove.setEnabled(false);
+          }
+        } else {
+          remove.setEnabled(false);
+        }
+      } else {
+        remove.setEnabled(false);
+      }
+    }
+  }
     }
     
