Index: trunk/gli/src/org/greenstone/gatherer/shell/GBuildProgressMonitor.java
===================================================================
--- trunk/gli/src/org/greenstone/gatherer/shell/GBuildProgressMonitor.java	(revision 6388)
+++ trunk/gli/src/org/greenstone/gatherer/shell/GBuildProgressMonitor.java	(revision 6533)
@@ -121,11 +121,16 @@
     /** The progress bar this monitor updates. */
     private JProgressBar progress_bar;
+    /** A progress bar that is shared between this this listener and the Import monitor. */
+    private JProgressBar shared_progress_bar;
 
     /** Construct a new GBuildProgressMonitor. */
-    public GBuildProgressMonitor() {
+    public GBuildProgressMonitor(JProgressBar shared_progress_bar) {
+	this.shared_progress_bar = shared_progress_bar;
 	progress_bar = new JProgressBar();
 	progress_bar.setMaximum(MAX);
 	progress_bar.setMinimum(MIN);
-	progress_bar.setValue(MIN);
+	progress_bar.setString(null);
+	progress_bar.setStringPainted(true);
+	setValue(MIN);
     }
 
@@ -137,5 +142,7 @@
 	progress_bar.setMaximum(MAX);
 	progress_bar.setMinimum(MIN);
-	progress_bar.setValue(MIN);
+	progress_bar.setStringPainted(false);
+	progress_bar.setString(null);
+	setValue(MIN);
     }
 
@@ -155,8 +162,13 @@
 	return progress_bar;
     }
+
+    public JProgressBar getSharedProgress() {
+	return shared_progress_bar;
+    }
+
     /** Method to determine the state of the stop flag, which may be set by the visual component that created this monitor.
      * @return A <strong>boolean</strong> indicating if the process has been asked to stop.
      */
-    public boolean hasSignalledStop() {
+    public synchronized boolean hasSignalledStop() {
 	return stop;
     }
@@ -193,5 +205,5 @@
 		    state = BUILD;
 		    // Produce a lower detail message if required
-		    if(Gatherer.config.getMode() <= threshold) {
+		    if(Gatherer.config.getMode() <= threshold && !stop) {
 			queue.add(new GShellEvent(event.getSource(), 0, event.getType(), Dictionary.get("GShell.Build.BuildBegun1"), event.getStatus()));
 		    }
@@ -254,5 +266,5 @@
 		else if(name.equals(BUILD_ELEMENT) && element.isClosed()) {
 		    progress_bar.setIndeterminate(false);
-		    progress_bar.setValue(MAX);
+		    setValue(MAX);
 		    state = BASE;
 		    if(Gatherer.config.getMode() <= threshold) {
@@ -279,10 +291,10 @@
 			// One third complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.3d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.3d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(COMPRESSINGTEXT_VALUE)) {
 			// Two thirds complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.6d) * MAX) / expected_stages);
+		        setValue((int)(((double)current_stages + 0.6d) * MAX) / expected_stages);
 		    }
 		    else {
@@ -302,5 +314,5 @@
 		    current_stages++;
 		    progress_bar.setIndeterminate(false);
-		    progress_bar.setValue((current_stages * MAX) / expected_stages);
+		    setValue((current_stages * MAX) / expected_stages);
 		    state = BUILD;
 		}
@@ -323,20 +335,20 @@
 			// One fifth complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.2d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.2d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(CREATETHEWEIGHTS_VALUE)) {
 			// Two fifths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.4d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.4d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(CREATESTEMMEDDIC_VALUE)) {
 			// Three fifths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.6d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.6d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(CREATINGSTEMINDX_VALUE)) {
 			// Four fifths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.8d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.8d) * MAX) / expected_stages);
 		    }
 		    else {
@@ -359,5 +371,5 @@
 		    current_stages++;
 		    progress_bar.setIndeterminate(false);
-		    progress_bar.setValue((current_stages * MAX) / expected_stages);
+		    setValue((current_stages * MAX) / expected_stages);
 		    state = BUILD;
 		}
@@ -379,25 +391,25 @@
 			// One sixth complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.16d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.16d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(SORTANDRENUMBER_VALUE)) {
 			// Two sixths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.33d) * MAX) / expected_stages);
+		        setValue((int)(((double)current_stages + 0.33d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(PHRASEDATABASES_VALUE)) {
 			// Three sixths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.5d) * MAX) / expected_stages);
+		        setValue((int)(((double)current_stages + 0.5d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(WORDLEVELINDEXES_VALUE)) {
 			// Four sixths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.66d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.66d) * MAX) / expected_stages);
 		    }
 		    else if(value.equals(DOCINFODATABASES_VALUE)) {
 			// Five sixths complete
 			progress_bar.setIndeterminate(false);
-			progress_bar.setValue((int)(((double)current_stages + 0.83d) * MAX) / expected_stages);
+			setValue((int)(((double)current_stages + 0.83d) * MAX) / expected_stages);
 		    }
 		    else {
@@ -412,5 +424,5 @@
 		    current_stages++;
 		    progress_bar.setIndeterminate(false);
-		    progress_bar.setValue((current_stages * MAX) / expected_stages);
+		    setValue((current_stages * MAX) / expected_stages);
 		    state = BUILD;
 		}
@@ -429,5 +441,5 @@
 		    current_stages++;
 		    progress_bar.setIndeterminate(false);
-		    progress_bar.setValue((current_stages * MAX) / expected_stages);
+		    setValue((current_stages * MAX) / expected_stages);
 		    state = BUILD;
 		}
@@ -455,12 +467,15 @@
 	expected_stages = 0;
 	progress_bar.setIndeterminate(false);
-	progress_bar.setString(StaticStrings.SPACE_CHARACTER);
-	progress_bar.setValue(MIN);
+	progress_bar.setString(null);
+	setValue(MIN);
 	state = BASE;
-	stop = false;
 	progress_bar.updateUI();
     }
 
     public void saving() {
+    }
+
+    public void setSharedProgressBar(JProgressBar shared_progress_bar) {
+	this.shared_progress_bar = shared_progress_bar;
     }
 
@@ -468,6 +483,6 @@
      * @param state The desired state of the stop flag as a <strong>boolean</strong>.
      */
-    public void setStop(boolean state) {
-	stop = state;
+    public synchronized void setStop(boolean state) {
+	this.stop = state;
 	progress_bar.setIndeterminate(false);
     }
@@ -476,5 +491,6 @@
      */
     public void start() {
-	progress_bar.setValue(MIN);
+	stop = false;
+	setValue(MIN);
 	expected_stages = 3; // Always compress text, create info database and auxiliary creation
 	// Retrieve cdm.
@@ -507,5 +523,13 @@
     public void stop() {
 	progress_bar.setIndeterminate(false);
-	progress_bar.setValue(MAX);
+	setValue(MAX);
+    }
+
+    private void setValue(int value) {
+	progress_bar.setValue(value);
+	// Incrementing the shared progress bar is a little more problematic as we may very well be trying to set it to MIN but instead set it to halfway if we're not careful.
+	if(value > MIN) {
+	    shared_progress_bar.setValue(MAX + value);
+	}
     }
 }
