Index: main/trunk/gli/src/org/greenstone/gatherer/cdm/BaseIndexManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/cdm/BaseIndexManager.java	(revision 36250)
+++ main/trunk/gli/src/org/greenstone/gatherer/cdm/BaseIndexManager.java	(revision 36251)
@@ -75,17 +75,20 @@
     protected String remove_button_key = "CDM.IndexManager.Remove";
     protected String remove_button_tooltip_key = null;
-  protected String default_indicator_key = null; //"CDM.IndexManager.Default_Index_Indicator";
-  protected String set_default_tooltip_key = "CDM.IndexManager.Set_Default_Tooltip";
+    protected String default_indicator_key = null;
+    protected String set_default_tooltip_key = "CDM.IndexManager.Set_Default_Tooltip";
+
+
     protected String nip_new_index_key = null;
     protected String nip_edit_index_key = null;
-    protected String nip_source_label_key = null; //"CDM.IndexManager.Source"
-    protected String nip_source_tooltip_key = null; //"CDM.IndexManager.Source"
-
-    protected String nip_add_index_button_key = null;//"CDM.IndexManager.Add_Index"
-    protected String nip_add_index_tooltip_key = null; //"CDM.IndexManager.Add_Index_Tooltip"
-    protected String nip_replace_index_button_key = null; //"CDM.IndexManager.Replace_Index"
-    protected String nip_replace_index_tooltip_key = null; //"CDM.IndexManager.Replace_Index_Tooltip"
-
-    static final protected Dimension PROMPT_SIZE = new Dimension(400,400);
+    protected String nip_source_label_key = null;
+    protected String nip_source_tooltip_key = null;
+    protected String nip_add_index_button_key = null;
+    protected String nip_add_index_tooltip_key = null; 
+    protected String nip_replace_index_button_key = null;
+    protected String nip_replace_index_tooltip_key = null; 
+    protected String nip_add_all_index_button_key = null; 
+    protected String nip_add_all_index_tooltip_key = null;
+
+    static final protected Dimension PROMPT_SIZE = new Dimension(500,500);
 
     public BaseIndexManager(Element indexes, String current_build_type, String index_element_name, String index_default_element_name, Index class_type) {
@@ -234,6 +237,5 @@
     protected void removeIndex(Index index) {
 	if(index != null) {
-	    // Remove any current metadata from this index
-	    //CollectionDesignManager.searchmeta_manager.removeMetadata(StaticStrings.STOP_CHARACTER + index.getID());
+	    // Remove any current metadata for this index
 	    CollectionDesignManager.searchmeta_manager.removeMetadata(index.getID(), SearchMeta.TYPE_INDEX);
 	    // Remove the index
@@ -267,5 +269,5 @@
 	}
 	// Remove the old index coll meta
-	CollectionDesignManager.searchmeta_manager.removeMetadata(/*StaticStrings.STOP_CHARACTER +*/ old_index.getID(), old_index.getType());
+	CollectionDesignManager.searchmeta_manager.removeMetadata( old_index.getID(), old_index.getType());
 	// Add the new coll meta
 	CollectionDesignManager.searchmeta_manager.addMetadatum(coll_meta);
@@ -565,19 +567,15 @@
 	protected class NewIndexPrompt 
 	    extends ModalDialog {
-
+	    
 	    NewIndexPrompt new_index_prompt = null;
 
 	    protected CheckList source_list;
 	    protected JButton add_or_replace_button;
-
-	    //protected JButton select_none_button;
-	    //protected JButton add_all_button;
-	    //protected JButton select_all_button;
-	    //protected JButton replace_button;
+	    protected JButton add_all_button;
 	    protected JButton cancel_button;
 
-          protected JPanel content_pane;
-          protected JPanel details_pane;
-          protected JPanel button_pane;
+	    protected JPanel content_pane;
+	    protected JPanel details_pane;
+	    protected JPanel button_pane;
 	    protected boolean editing = false;
 	
@@ -643,12 +641,21 @@
 		button_pane.setComponentOrientation(Dictionary.getOrientation());
                 
-		button_pane.setLayout(new GridLayout(0,2,5,0));
-
+		if (editing) {
+		    button_pane.setLayout(new GridLayout(0,2,5,0));
+		} else {
+		     button_pane.setLayout(new GridLayout(0,3,5,0));
+		}
 		if (existing_index != null) {
-		    add_or_replace_button = new GLIButton(Dictionary.get(nip_add_index_button_key), Dictionary.get(nip_replace_index_tooltip_key));
+		    // replace
+		    add_or_replace_button = new GLIButton(Dictionary.get(nip_replace_index_button_key), Dictionary.get(nip_replace_index_tooltip_key));
 		    add_or_replace_button.addActionListener(new ReplaceIndexListener());
 		} else {
+		    //new
 		    add_or_replace_button = new GLIButton(Dictionary.get(nip_add_index_button_key), Dictionary.get(nip_add_index_tooltip_key));
 		    add_or_replace_button.addActionListener(new AddIndexListener());
+		    // create the add all button, which we only have for "add"
+		    add_all_button = new GLIButton(Dictionary.get(nip_add_all_index_button_key), Dictionary.get(nip_add_all_index_tooltip_key));
+		    add_all_button.addActionListener(new AddAllActionListener());
+
 		}
 
@@ -656,6 +663,7 @@
 		add_or_replace_button.setEnabled(false);
 		button_pane.add(add_or_replace_button);
-		
-		
+		if (!editing) {
+		    button_pane.add(add_all_button);
+		}
 		// always have a cancel button
 		cancel_button = new GLIButton(Dictionary.get("General.Cancel"), Dictionary.get("General.Cancel"));
@@ -686,26 +694,4 @@
             
           }
-	    // Checks that specified index not already in the collection
-	    protected void validateAddOrReplaceButton() {
-		Index index;
-		ArrayList sources;
-		if (!source_list.isNothingTicked()) {
-		    sources = source_list.getTicked();
-		    index = createIndex(sources); 
-		} else {
-		    // nothing selected
-		    add_or_replace_button.setEnabled(false);
-		    return;
-		}
-		
-		sources = null;
-		if (index_model.contains(index)) {
-		    add_or_replace_button.setEnabled(false);
-		}
-		else {
-		    add_or_replace_button.setEnabled(true);
-		}
-		
-	    }
 
 	    protected Index generateNewIndex() {
@@ -719,7 +705,27 @@
 		return index;
 	    }
+
+	    // add/replace is only active if something is specified AND the specified index is not in the list already.
+	    protected void validateAddOrReplaceButton() {
+		Index index = generateNewIndex();
+		if (index == null || index_model.contains(index)) {
+		    add_or_replace_button.setEnabled(false);
+		} else {
+		    add_or_replace_button.setEnabled(true);
+		}
+		// we enable the add_all button if we have 2 or more sources ticked
+		// unless we are in "edit index"
+		if (!editing) {
+		    if (source_list.isEnabled() && source_list.numTicked() > 1) {
+			add_all_button.setEnabled(true);
+		    } else {
+			add_all_button.setEnabled(false);
+		    } 
+		}
+	    }
+
 	    
 	    protected SearchMeta generateSearchMeta(Index index) {
-		SearchMeta metadatum = new SearchMeta(/*StaticStrings.STOP_CHARACTER +*/ index.getID(), index.getType());
+		SearchMeta metadatum = new SearchMeta(index.getID(), index.getType());
 		if (use_macro_as_display_name(index.getID())) {
 		    metadatum.setValue(get_macro_name(index.getID()));
@@ -727,6 +733,4 @@
 		    metadatum.setValue(index.getID());
 		}
-                // is this right? Index vs index
-                //metadatum.setType(index_element_name);
 		return metadatum;
 	    }
@@ -749,4 +753,32 @@
 	    }
 
+	    /** add all selected sources as separate indexes (fields).  */
+	    private class AddAllActionListener
+	        implements ActionListener {
+
+	        public void actionPerformed(ActionEvent event) {
+	            ArrayList sources = source_list.getTicked();
+
+	            ArrayList new_sources = new ArrayList();
+	            for(int i = 0; i < sources.size(); i++) {
+	        	Object source = sources.get(i);
+
+	        	// Create new index
+	        	new_sources.clear();
+	        	new_sources.add(source);
+	        	Index index = createIndex(new_sources);
+	        	if(!index_model.contains(index)) {
+			    SearchMeta metadatum = generateSearchMeta(index);
+	        	    addIndex(index, metadatum);
+	        	}
+	        	source = null;
+	        	index = null;
+	            }
+	            new_sources = null;
+	            new_index_prompt.dispose();
+		
+	        }
+	    }
+
 
 	    protected class SourceListListener
@@ -787,5 +819,5 @@
 	     */
 	    protected boolean use_macro_as_display_name(String index_id) {
-		//String metaname = index_id;	
+
 		if (index_id.indexOf(":") != -1) {
 		    index_id = index_id.substring(index_id.indexOf(":") + 1);
