Index: trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java	(revision 10974)
+++ trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java	(revision 10975)
@@ -52,6 +52,4 @@
 
     static final private Dimension FIELD_SIZE = new Dimension(200,30);
-    static final private String MGINDEXES = "mg indexes";
-    static final private String MGPPINDEXES = "mgpp indexes";
 
     static final private String ALLFIELDS = "allfields";
@@ -98,8 +96,6 @@
 	    else {
 		add(index);
-		// Also set this index as the default one, but only if there are levels available (ie mg only)
-		if(index.getLevel() != -1) {
-		    setDefault(index);
-		}
+		// Also set this index as the default one, 
+		setDefault(index);
 	    }
 	    Gatherer.c_man.configurationChanged();
@@ -278,4 +274,6 @@
 	    // Remove any current metadata from this index
 	    CollectionDesignManager.collectionmeta_manager.removeMetadata(CollectionConfiguration.STOP_CHARACTER + index.getID());
+	    // Remove the index
+	    remove(index);
 	    // Check if the index removed happens to be the default index
 	    if(default_index != null && default_index.equals(index)) {
@@ -289,7 +287,5 @@
 		    default_index.setAssigned(false);
 		}
-	    }
-	    // Remove the index
-	    remove(index);
+	    } 
 	    Gatherer.c_man.configurationChanged();
 	}
@@ -315,5 +311,4 @@
 	if (!old_index.getID().equals(new_index.getID()) && contains(new_index)) {
 	    // shoudl we output an error??
-	    System.err.println("new index is already in the list, but is not the old one");
 	    return;
 	}
@@ -356,4 +351,5 @@
 	    default_index.setLevel(index.getLevel());
 	    default_index.setSources(index.getSources());
+	    
 	}
 	else {
@@ -453,9 +449,18 @@
 		int levels_list_size = levels_list.size();
 		for(int k = 0; k < levels_list_size; k++) {
-		    Level new_level = new Level((String)levels_list.get(k));
+		    String level_name = (String)levels_list.get(k);
+		    Level new_level = new Level(level_name);
 		    if(!levels_model.contains(new_level)) {
-			levels_model.add(levels_model.getSize(), new_level);
+			CollectionMeta metadatum = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.STOP_CHARACTER + level_name, false);
+			// If no metadata was found, add new pseudo metadata using the id
+			if(metadatum == null) {
+			    metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + level_name);
+			    metadatum.setAssigned(true);
+			    metadatum.setValue(level_name);
+			}
+			addLevel(new_level, metadatum);
 		    }
 		    new_level = null;
+		    
 		}
 	    }
@@ -468,8 +473,4 @@
 	    mg_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);
 	    mg_element = null;
- 	    if(default_index != null) {
- 		//default_index.setAssigned(false);
-		default_index.setLevel(-1);
- 	    }
 	}
 	// change MGPP -> MG
@@ -479,8 +480,4 @@
 	    Element mg_element = CollectionDesignManager.collect_config.getMGIndexes();
 	    mg_element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.TRUE_STR);
-	    if(default_index != null) {
-		default_index.setAssigned(true);
-		default_index.setLevel(1); // for now
-	    }
 	    // If mg element has no indexes, and the current mgpp index include a text one, then generate text indexes for each of the registered levels.
 	    NodeList indexes = mg_element.getElementsByTagName(CollectionConfiguration.INDEX_ELEMENT);
@@ -522,4 +519,9 @@
 	    levels_model.root.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, CollectionConfiguration.FALSE_STR);
 	}
+	// its really hard to transfer defaults between mg and mgpp. so we'll just assign the first one to be the default.
+	Index first_index = (Index) getElementAt(0);
+	setDefault(first_index);
+	first_index = null;
+	
 	
     }
@@ -803,4 +805,6 @@
 		    tabbed_pane.remove(0);
 		    add(main_index_pane, BorderLayout.CENTER);
+		    source_list.setEnabled(true); // in case it had been disabled
+		    allfields_box.setSelected(false);
 		}
 	    }
@@ -830,6 +834,12 @@
 	    source_list.clearTicked();
 	    ArrayList sources = selected_index.getSources();
-	    source_list.setTickedObjects(sources.toArray());
-	   
+	    if (mgpp_enabled && sources.get(0).equals(ALLFIELDS)) {
+		source_list.setEnabled(false);
+		allfields_box.setSelected(true);
+	    } else {
+		source_list.setTickedObjects(sources.toArray());
+		source_list.setEnabled(true);
+		allfields_box.setSelected(false);
+	    }
 	}
 	
@@ -1117,5 +1127,4 @@
 		}
 		index_list.setSelectedIndex(i);
-
 		// This will produce an event on the list, updating the other buttons
 		if (size == 0) {
