Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 2564)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 2565)
@@ -135,6 +135,11 @@
 	protected IProgressMonitor monitor;
 	
 	/**
+	 * Thread used when calling compute().
+	 */
+	protected Thread computingThread;
+	
+	/**
 	 * To manage the computing cancel with TreadDeath.
 	 */
 	private Semaphore progressSemaphore = new Semaphore(1);
@@ -2281,7 +2286,7 @@
 	 * @return
 	 * @throws Exception
 	 */
-	public boolean compute(boolean deepComputing) {
+	public boolean compute(boolean deepComputing) throws InterruptedException {
 		return this.compute(new LogMonitor("Computing " + this), deepComputing);
 	}
 	
@@ -2293,7 +2298,7 @@
 	 * @return
 	 * @throws Exception
 	 */
-	public boolean compute() {
+	public boolean compute() throws InterruptedException {
 		return this.compute(true);
 	}
 	
@@ -2306,7 +2311,7 @@
 	 * @param monitor
 	 * @return
 	 */
-	public boolean compute(IProgressMonitor monitor) {
+	public boolean compute(IProgressMonitor monitor) throws InterruptedException {
 		return this.compute(monitor, true);
 	}
 	
@@ -2320,8 +2325,10 @@
 	 * @param deepComputing
 	 * @return
 	 */
-	public boolean compute(IProgressMonitor monitor, boolean deepComputing) {
+	public boolean compute(IProgressMonitor monitor, boolean deepComputing) throws InterruptedException {
 		
+		this.computingThread = Thread.currentThread();
+		
 		// skip the process if the result is already in computing stage
 		if (this.computing) {
 			return true;
@@ -2502,6 +2509,16 @@
 				}
 			}
 		}
+		catch (ThreadDeath e) {
+			// set parent and its children as canceled
+			this.resetComputingState();
+			throw new InterruptedException("TXMResult computing thread stopped.");
+		}
+		catch (InterruptedException e) {
+			// set parent and its children as canceled
+			this.resetComputingState();
+			throw e;
+		}
 		catch (Exception e) {
 			e.printStackTrace();
 			Log.severe(TXMCoreMessages.bind("TXMResult.compute(): Exception occurs during computing: {0}.", e));
@@ -2533,19 +2550,24 @@
 	
 	/**
 	 * Sets the result and all its children as canceled (set them as dirty and set computing state as false).
+	 * Resets the computing state.
 	 * Dedicated to be called when computing has been killed.
 	 * 
 	 */
-	public void cancel() {
+	public void resetComputingState() {
 		if (this.computing) {
 			
 			// set back to dirty
 			this.dirty = true;
 			this.computing = false;
+			this.hasBeenComputedOnce = false;
+			this.setCanceled(true);
 			
+			Log.finest(NLS.bind("Computing state of {0} ({1}) has been reset...", this.getName(), this.getClass().getSimpleName()));
+			
 			// deep canceling
 			for (int i = 0; i < this.children.size(); i++) {
-				this.children.get(i).cancel();
+				this.children.get(i).resetComputingState();
 			}
 			
 		}
@@ -2684,9 +2706,9 @@
 	@Override
 	public void setCanceled(boolean value) {
 		if (monitor != null) {
+			Log.info(NLS.bind("Canceling computing of {0} ({1})...", this.getName(), this.getClass().getSimpleName()));
 			monitor.setCanceled(value);
 		}
-		Log.info("Canceling command...");
 	}
 	
 	@Override
@@ -2946,4 +2968,12 @@
 	public boolean mustBeSynchronizedWithParent() {
 		return synchronizedWithParent;
 	}
+	
+	
+	/**
+	 * @return the computingThread
+	 */
+	public Thread getComputingThread() {
+		return computingThread;
+	}
 }
Index: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 2564)
+++ tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 2565)
@@ -156,7 +156,7 @@
 	 */
 	@SuppressWarnings("unchecked")
 	public List<Project> getProjects() {
-		return (List<Project>) getChildren(Project.class);
+		return getChildren(Project.class);
 	}
 	
 	/**
@@ -437,10 +437,16 @@
 			Project project = (Project) r;
 			if (project.isOpen()) {
 				for (CorpusBuild cb : project.getCorpora()) {
-					if (!cb.compute(false)) {
-						System.out.println("Deleting broken corpus: " + cb + " of " + cb.getProject());
-						cb.delete();
+					try {
+						if (!cb.compute(false)) {
+							System.out.println("Deleting broken corpus: " + cb + " of " + cb.getProject());
+							cb.delete();
+						}
 					}
+					catch (InterruptedException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
 				}
 			}
 		}
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 2564)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 2565)
@@ -220,10 +220,16 @@
 				this.loadResults(null);
 				
 				for (TXMResult cb : getCorpora()) {
-					if (!cb.compute(false)) {
-						Log.warning("Deleting broken corpus: " + cb + " of " + cb.getProject());
-						cb.delete();
+					try {
+						if (!cb.compute(false)) {
+							Log.warning("Deleting broken corpus: " + cb + " of " + cb.getProject());
+							cb.delete();
+						}
 					}
+					catch (InterruptedException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
 				}
 				
 				if (monitor != null) monitor.subTask("");
@@ -684,7 +690,7 @@
 	 */
 	@SuppressWarnings("unchecked")
 	public List<Text> getTexts() {
-		return (List<Text>) getChildren(Text.class);
+		return getChildren(Text.class);
 	}
 	
 	/**
@@ -1211,7 +1217,7 @@
 	
 	@SuppressWarnings("unchecked")
 	private List<CorpusBuild> getCorpusBuilds() {
-		return (List<CorpusBuild>) getChildren(CorpusBuild.class);
+		return getChildren(CorpusBuild.class);
 	}
 	
 	public void setImportModuleName(String name) {
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java	(revision 2564)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java	(revision 2565)
@@ -163,7 +163,7 @@
 	}
 	
 	@Override
-	public boolean compute(IProgressMonitor monitor) {
+	public boolean compute(IProgressMonitor monitor) throws InterruptedException {
 		return compute(monitor, true);
 	}
 	
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 2564)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 2565)
@@ -344,7 +344,13 @@
 					// StatusLine.setMessage(((TXMResult)selectedItem).getComputingDoneMessage());
 					
 					if (selectedItem instanceof MainCorpus) { // just for this result type, pre-compute to show the corpus size
-						((MainCorpus) selectedItem).compute(false);
+						try {
+							((MainCorpus) selectedItem).compute(false);
+						}
+						catch (InterruptedException e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
 					}
 					
 					StatusLine.setMessage(((TXMResult) selectedItem).getDetails());
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 2564)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 2565)
@@ -21,13 +21,13 @@
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 
 public class UpdateCorpus extends AbstractHandler {
-
+	
 	public static final String ID = UpdateCorpus.class.getCanonicalName();
-
+	
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		
+		ISelection sel = HandlerUtil.getCurrentSelection(event);
 		if (!(sel instanceof IStructuredSelection)) return null;
 		IStructuredSelection selection = (IStructuredSelection) sel;
 		
@@ -44,70 +44,82 @@
 		}
 		
 		update(corpus);
-
+		
 		return corpus;
 	}
 	
 	public static JobHandler update(final MainCorpus corpus) {
-
+		
 		final Project project = corpus.getProject();
-		if (project == null)  return null;
-
-//		String iname = project.getImportModuleName();
-//		if (!iname.matches("xtz|txt|hyperbase|discours|cnr|alceste|xml|xmltxm")) {
-//			System.out.println("Can't update a CQP corpus not imported with one of the XTZ, TXT, XML, XML-TXM, CNRS, Alceste, Hyperbase import modules.");
-//			System.out.println(NLS.bind("The corpus was imported with the \"{0}\" import module.", iname));
-//			return null;
-//		}
-
+		if (project == null) return null;
+		
+		// String iname = project.getImportModuleName();
+		// if (!iname.matches("xtz|txt|hyperbase|discours|cnr|alceste|xml|xmltxm")) {
+		// System.out.println("Can't update a CQP corpus not imported with one of the XTZ, TXT, XML, XML-TXM, CNRS, Alceste, Hyperbase import modules.");
+		// System.out.println(NLS.bind("The corpus was imported with the \"{0}\" import module.", iname));
+		// return null;
+		// }
+		
 		Display d = Display.getCurrent();
 		if (d == null) {
 			d = Display.getDefault();
 		}
 		if (d != null) {
 			d.syncExec(new Runnable() {
+				
 				@Override
-				public void run() {CloseEditorsUsing.corpus(corpus);}
+				public void run() {
+					CloseEditorsUsing.corpus(corpus);
+				}
 			});
 		}
-
+		
 		project.setDirty(true, false);// dont propagate dirty
 		project.setNeedToBuild();
-		project.setDoMultiThread(false); //too soon
+		project.setDoMultiThread(false); // too soon
 		project.setDoUpdate(true);
 		String currentModule = project.getImportModuleName();
 		if (!(currentModule.equals("xtz") || currentModule.equals("transcriber"))) {
 			project.setImportModuleName("xtz");
 		}
-
-		JobHandler job = new JobHandler("Updating corpus "+corpus+" using "+project) {
-
+		
+		JobHandler job = new JobHandler("Updating corpus " + corpus + " using " + project) {
+			
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
 				project.setCurrentMonitor(monitor);
-				if (project.compute(true)) { // TODO children should be recomputed later when the user needs it
-
-					this.syncExec(new Runnable() {
-						@Override
-						public void run() {
-							RestartTXM.reloadViews();
-						}
-					});
-					return Status.OK_STATUS;
-				} else {
+				try {
+					if (project.compute(true)) { // TODO children should be recomputed later when the user needs it
+						
+						this.syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								RestartTXM.reloadViews();
+							}
+						});
+						return Status.OK_STATUS;
+					}
+					else {
+						return Status.CANCEL_STATUS;
+					}
+				}
+				catch (InterruptedException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
 					return Status.CANCEL_STATUS;
 				}
 			}
 		};
-
+		
 		job.schedule();
-
-		////		String txmhome = Toolbox.getTxmHomePath();
-		////		File scriptDir = new File(txmhome, "scripts/groovy/user/org/txm/scripts/importer/xtz");
-		////		File script = new File(scriptDir, "xtzLoader.groovy");
-		//		System.out.println();
-		//		JobHandler ret = ExecuteImportScript.executeScript(project);
-		//		
+		
+		//// String txmhome = Toolbox.getTxmHomePath();
+		//// File scriptDir = new File(txmhome, "scripts/groovy/user/org/txm/scripts/importer/xtz");
+		//// File script = new File(scriptDir, "xtzLoader.groovy");
+		// System.out.println();
+		// JobHandler ret = ExecuteImportScript.executeScript(project);
+		//
 		return job;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 2564)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 2565)
@@ -75,6 +75,7 @@
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.preferences.RCPPreferences;
 import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.dialog.AdvancedProgressMonitorDialog;
 import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
 import org.txm.rcp.swt.widget.AssistedQueryWidget;
 import org.txm.rcp.swt.widget.FloatSpinner;
@@ -392,117 +393,37 @@
 		
 		try {
 			
-			// since some editor fields need some values of their parent ensure the parent is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.)
-			// need to set deep, eg. for Partition that must synchronize its Parts (if false, the Parts are not computed)
-			// it does not break the lazy since the children lazy is now determined by the hasBeenComputedOnce state
-			// Runnable job = new Runnable() {
-			//
-			// @Override
-			// public void run() {
-			// // TODO Auto-generated method stub
-			// TXMEditor.this.getResult().getParent().compute(false);
-			// }
-			// };
-			//
-			// BusyIndicator.showWhile(getSite().getShell().getDisplay(), job);
+			// since some editor fields need some values of their parent,
+			// ensure the parent is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.)
 			
 			// FIXME: SJ: tests to show modal blocking cancelable progression dialog
 			try {
 				if (!this.getResult().getParent().hasBeenComputedOnce()) {
-					IRunnableWithProgress job2 = new IRunnableWithProgress() {
+					
+					IRunnableWithProgress runnable = new IRunnableWithProgress() {
 						
 						@Override
-						public void run(IProgressMonitor monitor) {
-							// TODO Auto-generated method stub
+						public void run(IProgressMonitor monitor) throws InterruptedException {
 							TXMEditor.this.getResult().getParent().compute(monitor, false);
 						}
 					};
 					
-					ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell()) {
-						
-						@Override
-						protected void cancelPressed() {
-							super.cancelPressed();
-							Thread.currentThread().stop();
-						}
-					};
+					AdvancedProgressMonitorDialog dialog = new AdvancedProgressMonitorDialog(this.getSite().getShell(), TXMEditor.this.getResult().getParent());
+					dialog.run(true, runnable);
 					
-					// Trying to display the dialog only after X seconds, not at start so it not appears for short tasks
-					dialog.setOpenOnRun(false);
-					Timer timer = new Timer();
-					timer.schedule(new TimerTask() {
-						
-						protected int elapsedTime = 0;
-						
-						@Override
-						public void run() {
-							elapsedTime += 10;
-							if (elapsedTime > 1000) {
-								Display.getDefault().asyncExec(new Runnable() {
-									
-									@Override
-									public void run() {
-										dialog.open();
-									}
-								});
-								timer.purge();
-								timer.cancel();
-							}
-						}
-					}, 0, 10);
-					// end of test
 					
-					
-					
-					dialog.run(true, true, job2);
 				}
 			}
 			// Canceling
-			catch (ThreadDeath e) {
+			catch (InterruptedException e) {
 				
-				// set parent as canceled
-				this.getResult().getParent().cancel();
-				
 				CorporaView.refresh();
-				
 				this.close();
-				return;
 				
+				return;
 			}
 			
-			// JobHandler job3 = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getParent().getName()), true) {
-			//
-			// @Override
-			// protected IStatus run(IProgressMonitor monitor) {
-			// this.runInit(monitor);
-			// // TODO Auto-generated method stub
-			// TXMEditor.this.getResult().getParent().compute(true);
-			// return Status.OK_STATUS;
-			// }
-			// };
-			// job3.setUser(true);
-			// job3.startJob();
 			
-			
-			
-			
-			// job3.setProperty(IProgressConstants.PROPERTY_IN_DIALOG, true);
-			// IProgressService ps = PlatformUI.getWorkbench().getProgressService();
-			// ps.showInDialog(getSite().getShell(), job3);
-			// ps.runInUI(ps, (IRunnableWithProgress) job3, org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());
-			// ps.busyCursorWhile((IRunnableWithProgress) job3);
-			// job3.wait();
-			
-			
-			// this.getResult().getParent().compute(true);
-			
-			// TXMResult corpus = this.getResult().getFirstParent(CorpusBuild.class);
-			// if (corpus != null) {
-			// corpus.compute(false);
-			// }
-			
-			
-			
 			this.parent = parent;
 			
 			// disable the rendering while creating the widgets
@@ -1118,13 +1039,14 @@
 					});
 				}
 				// for user direct canceling
-				catch (ThreadDeath td) {
+				catch (ThreadDeath | InterruptedException e) {
 					// FIXME: SJ: should call clean() and/or set the result as dirty?
 					return Status.CANCEL_STATUS;
 					// FIXME: SJ tests, but it doesn't seem to improve the canceling, need to check more
 					// throw td;
 				}
 				catch (Exception e) {
+					TXMEditor.this.getResult().resetComputingState();
 					Log.printStackTrace(e);
 				}
 				finally {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/AdvancedProgressMonitorDialog.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/AdvancedProgressMonitorDialog.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/AdvancedProgressMonitorDialog.java	(revision 2565)
@@ -0,0 +1,102 @@
+package org.txm.rcp.swt.dialog;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.txm.core.results.TXMResult;
+
+/**
+ * An advanced progress monitor modal dialog managing delay before display and the force of cancel using Thread.stop().
+ * 
+ * @author sjacquot
+ *
+ */
+public class AdvancedProgressMonitorDialog extends ProgressMonitorDialog {
+	
+	
+	protected TXMResult result;
+	
+	/**
+	 * Delay in ms before opening the dialog after starting runnable.
+	 */
+	protected int delayBeforeOpen;
+	
+	
+	/**
+	 * 
+	 * @param parent
+	 * @param delayBeforeOpen delay in ms before opening the dialog after starting runnable
+	 */
+	public AdvancedProgressMonitorDialog(Shell parent, TXMResult result, int delayBeforeOpen) {
+		super(parent);
+		this.result = result;
+		this.delayBeforeOpen = delayBeforeOpen;
+		// this.setBlockOnOpen(shouldBlock);
+		this.setOpenOnRun(false);
+	}
+	
+	/**
+	 * 
+	 * @param parent
+	 */
+	public AdvancedProgressMonitorDialog(Shell parent, TXMResult result) {
+		this(parent, result, 1000);
+	}
+	
+	
+	/**
+	 * Runs the given <code>IRunnableWithProgress</code>.
+	 * 
+	 * @param cancelable
+	 * @param runnable
+	 * @throws InvocationTargetException
+	 * @throws InterruptedException
+	 */
+	public void run(boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+		this.run(true, cancelable, runnable);
+	}
+	
+	
+	@Override
+	public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+		
+		// manage the dialog open delay
+		Timer timer = new Timer();
+		timer.schedule(new TimerTask() {
+			
+			protected int elapsedTime = 0;
+			
+			@Override
+			public void run() {
+				this.elapsedTime += 10;
+				if (this.elapsedTime > delayBeforeOpen) {
+					Display.getDefault().asyncExec(new Runnable() {
+						
+						@Override
+						public void run() {
+							open();
+						}
+					});
+					this.cancel();
+					timer.purge();
+					timer.cancel();
+				}
+			}
+		}, 0, 10);
+		
+		super.run(fork, cancelable, runnable);
+	}
+	
+	
+	@Override
+	protected void cancelPressed() {
+		this.result.getComputingThread().stop();
+		super.cancelPressed();
+	}
+	
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/AdvancedProgressMonitorDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java	(revision 2564)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java	(revision 2565)
@@ -59,11 +59,12 @@
  * Command which creates a subcorpus from a Corpus @ author mdecorde.
  */
 public class Union extends AbstractHandler {
-
+	
 	/** The selection. */
 	private IStructuredSelection selection;
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 	 */
 	@Override
@@ -71,34 +72,41 @@
 		
 		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
 		if (selection == null) {
-			System.out.println(TXMUIMessages.noSelectionForColon+HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
 			return null;
 		}
 		List list = selection.toList();
 		if (list.size() == 0) {
 			Log.info("No corpus selected");
 			return null;
-		} else if (list.size() != 1) {
+		}
+		else if (list.size() != 1) {
 			Log.info("Substraction need a selection of 1 corpus");
 			return null;
 		}
 		Object firstElement = list.get(0);
-//		Object secondElement = list.get(1);
+		// Object secondElement = list.get(1);
 		
 		if (!(firstElement instanceof CQPCorpus)) {
-			System.out.println(TXMUIMessages.selectionIsNotACorpusColon+firstElement);
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
 			return null;
 		}
 		
-//		if (!(secondElement instanceof CQPCorpus)) {
-//			System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
-//			return null;
-//		}
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
 		
 		final CQPCorpus corpus = (CQPCorpus) firstElement;
-		corpus.compute(false);
-//		final CQPCorpus corpus2 = (CQPCorpus) secondElement;
-//		corpus2.compute(false);
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
 		
 		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
 		final SetOperationsDialog d = new SetOperationsDialog(shell, "UNION", corpus);
@@ -106,8 +114,9 @@
 		if (code == Window.OK) {
 			JobHandler jobhandler = new JobHandler(NLS.bind(
 					TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
 				@Override
-				protected IStatus run(IProgressMonitor monitor) {		
+				protected IStatus run(IProgressMonitor monitor) {
 					this.runInit(monitor);
 					JobsTimer.start();
 					try {
@@ -117,17 +126,17 @@
 						if (name.length() == 0) {
 							name = d.getDefaultName();
 						}
-							
+						
 						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
 						
-						String cqpid = "S"+Subcorpus.getNextSubcorpusCounter();
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
 						CQPCorpus[] order = d.getCorpusOrder();
 						order[1].compute(false);
-						String query = cqpid+"=join "+order[0].getQualifiedCqpId()+" "+order[1].getQualifiedCqpId()+";";
-						System.out.println("QUERY="+query);
+						String query = cqpid + "=join " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
 						cqi.query(query);
 						
-						if (cqi.subCorpusSize(order[0].getMainCorpus()+":"+cqpid) == 0) {
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
 							Log.info("The created subcorpus was empty. Aborting.");
 							return Status.CANCEL_STATUS;
 						}
@@ -142,34 +151,39 @@
 						
 						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
 						monitor.worked(50);
-
+						
 						monitor.subTask(TXMUIMessages.refreshingCorpora);
-						final Subcorpus subcorpus2 = subcorpus; 
+						final Subcorpus subcorpus2 = subcorpus;
 						syncExec(new Runnable() {
+							
 							@Override
 							public void run() {
 								CorporaView.refresh();
 								CorporaView.expand(subcorpus2.getParent());
 							}
 						});
-
+						
 						monitor.worked(100);
-					} catch (ThreadDeath td) {
+					}
+					catch (ThreadDeath td) {
 						return Status.CANCEL_STATUS;
-					} catch (Exception e) {
+					}
+					catch (Exception e) {
 						org.txm.utils.logger.Log.printStackTrace(e);
 						Log.severe(e.toString());
 						
 						try {
 							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
-						} catch (Exception e1) {
-							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon+e1);
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
 							org.txm.utils.logger.Log.printStackTrace(e1);
 						}
-					} finally {
+					}
+					finally {
 						monitor.done();
 						JobsTimer.stopAndPrint();
-					}				
+					}
 					return Status.OK_STATUS;
 				}
 			};
@@ -177,4 +191,4 @@
 		}
 		return null;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java	(revision 2564)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java	(revision 2565)
@@ -59,11 +59,12 @@
  * Command which creates a subcorpus from a Corpus @ author mdecorde.
  */
 public class Substraction extends AbstractHandler {
-
+	
 	/** The selection. */
 	private IStructuredSelection selection;
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 	 */
 	@Override
@@ -71,34 +72,41 @@
 		
 		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
 		if (selection == null) {
-			System.out.println(TXMUIMessages.noSelectionForColon+HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
 			return null;
 		}
 		List list = selection.toList();
 		if (list.size() == 0) {
 			Log.info("No corpus selected");
 			return null;
-		} else if (list.size() != 1) {
+		}
+		else if (list.size() != 1) {
 			Log.info("Substraction need a selection of 1 corpus");
 			return null;
 		}
 		Object firstElement = list.get(0);
-//		Object secondElement = list.get(1);
+		// Object secondElement = list.get(1);
 		
 		if (!(firstElement instanceof CQPCorpus)) {
-			System.out.println(TXMUIMessages.selectionIsNotACorpusColon+firstElement);
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
 			return null;
 		}
 		
-//		if (!(secondElement instanceof CQPCorpus)) {
-//			System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
-//			return null;
-//		}
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
 		
 		final CQPCorpus corpus = (CQPCorpus) firstElement;
-		corpus.compute(false);
-//		final CQPCorpus corpus2 = (CQPCorpus) secondElement;
-//		corpus2.compute(false);
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
 		
 		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
 		final SetOperationsDialog d = new SetOperationsDialog(shell, "MINUS", corpus);
@@ -106,8 +114,9 @@
 		if (code == Window.OK) {
 			JobHandler jobhandler = new JobHandler(NLS.bind(
 					TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
 				@Override
-				protected IStatus run(IProgressMonitor monitor) {		
+				protected IStatus run(IProgressMonitor monitor) {
 					this.runInit(monitor);
 					JobsTimer.start();
 					try {
@@ -117,17 +126,17 @@
 						if (name.length() == 0) {
 							name = d.getDefaultName();
 						}
-							
+						
 						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
 						
-						String cqpid = "S"+Subcorpus.getNextSubcorpusCounter();
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
 						CQPCorpus[] order = d.getCorpusOrder();
 						order[1].compute(false);
-						String query = cqpid+"=difference "+order[0].getQualifiedCqpId()+" "+order[1].getQualifiedCqpId()+";";
-						System.out.println("QUERY="+query);
+						String query = cqpid + "=difference " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
 						cqi.query(query);
 						
-						if (cqi.subCorpusSize(order[0].getMainCorpus()+":"+cqpid) == 0) {
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
 							Log.info("The created subcorpus was empty. Aborting.");
 							return Status.CANCEL_STATUS;
 						}
@@ -146,34 +155,39 @@
 						
 						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
 						monitor.worked(50);
-
+						
 						monitor.subTask(TXMUIMessages.refreshingCorpora);
-						final Subcorpus subcorpus2 = subcorpus; 
+						final Subcorpus subcorpus2 = subcorpus;
 						syncExec(new Runnable() {
+							
 							@Override
 							public void run() {
 								CorporaView.refresh();
 								CorporaView.expand(subcorpus2.getParent());
 							}
 						});
-
+						
 						monitor.worked(100);
-					} catch (ThreadDeath td) {
+					}
+					catch (ThreadDeath td) {
 						return Status.CANCEL_STATUS;
-					} catch (Exception e) {
+					}
+					catch (Exception e) {
 						org.txm.utils.logger.Log.printStackTrace(e);
 						Log.severe(e.toString());
 						
 						try {
 							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
-						} catch (Exception e1) {
-							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon+e1);
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
 							org.txm.utils.logger.Log.printStackTrace(e1);
 						}
-					} finally {
+					}
+					finally {
 						monitor.done();
 						JobsTimer.stopAndPrint();
-					}				
+					}
 					return Status.OK_STATUS;
 				}
 			};
@@ -181,4 +195,4 @@
 		}
 		return null;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java	(revision 2564)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java	(revision 2565)
@@ -96,7 +96,13 @@
 //		}
 		
 		final CQPCorpus corpus = (CQPCorpus) firstElement;
-		corpus.compute(false);
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+		}
 //		final CQPCorpus corpus2 = (CQPCorpus) secondElement;
 //		corpus2.compute(false);
 		
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 2564)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 2565)
@@ -110,7 +110,13 @@
 		super(parametersNodePath);
 		
 		if (getID() != null && getProjectDirectory() != null) {
-			compute(false);
+			try {
+				compute(false);
+			}
+			catch (InterruptedException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 		}
 	}
 	
Index: tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java
===================================================================
--- tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 2564)
+++ tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 2565)
@@ -848,7 +848,13 @@
 	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
 		
 		corpus = ((SynopticEditorInput) input).getCorpus(); // corpus focused when opening the editions
-		corpus.compute(false);
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 		mainCorpus = corpus.getMainCorpus(); // get the main corpus of the corpus
 		text = ((SynopticEditorInput) input).getText();
 		editionNames = ((SynopticEditorInput) input).getEditions();
