Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java	(revision 2994)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java	(revision 2995)
@@ -74,6 +74,10 @@
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
 		// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage sub-corpus creation and edition
 		if (SubcorpusPreferences.getInstance().getBoolean(SubcorpusPreferences.EDITORMODE)) {
 			return execute_editor(event);
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 2994)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 2995)
@@ -80,6 +80,10 @@
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
 		// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage partitions creation and edition
 		if (PartitionPreferences.getInstance().getBoolean(PartitionPreferences.EDITOR_MODE)) {
 			return execute_editor(event);
Index: tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java
===================================================================
--- tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java	(revision 2994)
+++ tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java	(revision 2995)
@@ -321,7 +321,7 @@
 				title = NLS.bind(IndexUIMessages.indexOfInfP0SupWithPropertyColonP1InThePartitionColonP2, new Object[] {
 						query.getQueryString(), properties, corpus.getName() });
 			
-			JobHandler jobhandler = new JobHandler(title, go.getParent()) {
+			JobHandler jobhandler = new JobHandler(title) {
 				
 				@Override
 				protected IStatus run(IProgressMonitor monitor) {
@@ -356,8 +356,9 @@
 						index.cut(); // Tmax
 						Log.info("TSIndex done.");
 						
-						if (monitor.isCanceled())
+						if (monitor.isCanceled()) {
 							return Status.CANCEL_STATUS;
+						}
 						
 						this.acquireSemaphore();
 						
@@ -369,15 +370,19 @@
 						this.releaseSemaphore();
 						
 						final String message;
-						if (index.getV() == 1)
+						if (index.getV() == 1) {
 							message = ("one result");
-						else if (index.getV() > 0)
+						}
+						else if (index.getV() > 0) {
 							message = (IndexUIMessages.bind(TXMUIMessages.doneColonP0Items, index.getV(), index.getT()));
-						else
+						}
+						else {
 							message = (IndexUIMessages.IndexEditor_17);
+						}
 						
-						if (monitor.isCanceled())
+						if (monitor.isCanceled()) {
 							return Status.CANCEL_STATUS;
+						}
 						
 						monitor.worked(95);
 						// refresh ui
@@ -393,10 +398,12 @@
 								CorporaView.expand(index.getParent());
 								QueriesView.refresh();
 								RVariablesView.refresh();
-								if (partition != null)
+								if (partition != null) {
 									setPartName(partition.getName() + ": " + index.getName()); //$NON-NLS-1$
-								else
+								}
+								else {
 									setPartName(corpus.getName() + ": " + index.getName()); //$NON-NLS-1$
+								}
 								
 								// if (!queryWidget.isDisposed()) queryWidget.memorize();
 								nblinesperpage = NLignePPageSpinner.getSelection();
@@ -446,14 +453,18 @@
 	 */
 	private boolean simpleQuery(CQLQuery query, List<Property> props) {
 		for (Property p : props) {
-			if (p instanceof StructuralUnitProperty) return false;
+			if (p instanceof StructuralUnitProperty) {
+				return false;
+			}
 		}
 		String trimed = query.getQueryString().trim();
 		Property p = props.get(0);
-		if (props.size() > 1)
+		if (props.size() > 1) {
 			return false;
-		else if (trimed.equals("[]")) //$NON-NLS-1$
+		}
+		else if (trimed.equals("[]")) { //$NON-NLS-1$
 			return true;
+		}
 		else if (trimed.equals("[" + p.getName() + "=\".*\"]")) //$NON-NLS-1$ //$NON-NLS-2$
 		{
 			return true;
@@ -538,8 +549,7 @@
 		
 		// select focus properties
 		propsArea = new PropertiesSelector(queryArea, SWT.NONE);
-		propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-				false, false));
+		propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
 		propsArea.setLayout(new GridLayout(3, false));
 		propsArea.addValueChangeListener(new Listener() {
 			
@@ -665,8 +675,7 @@
 		NLignePPageSpinner.setSelection(100);
 		NLignePPageSpinner.setIncrement(1);
 		NLignePPageSpinner.setPageIncrement(100);
-		NLignePPageSpinner.setLayoutData(new GridData(
-				GridData.VERTICAL_ALIGN_END));
+		NLignePPageSpinner.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END));
 		NLignePPageSpinner.addSelectionListener(new SelectionListener() {
 			
 			@Override
@@ -684,8 +693,7 @@
 		infosArea.setLayout(new GridLayout(6, false));
 		
 		navigationArea = new NavigationWidget(infosArea, SWT.NONE);
-		navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true,
-				false));
+		navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
 		
 		navigationArea.addFirstListener(new SelectionListener() {
 			
@@ -707,7 +715,7 @@
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				int i = (index.getV() / NLignePPageSpinner.getSelection());
-				int top = top = i * NLignePPageSpinner.getSelection();
+				int top = i * NLignePPageSpinner.getSelection();
 				
 				int bottom = top + NLignePPageSpinner.getSelection();
 				fillDisplayArea(top, bottom);
@@ -737,8 +745,9 @@
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				int top = topLine - NLignePPageSpinner.getSelection();
-				if (top < 0)
+				if (top < 0) {
 					top = 0;
+				}
 				int bottom = top + NLignePPageSpinner.getSelection();
 				fillDisplayArea(top, bottom);
 				viewer.getTable().select(0);
@@ -812,8 +821,7 @@
 		FormLayout resultLayout = new FormLayout();
 		resultArea.setLayout(resultLayout);
 		
-		viewer = new TableViewer(resultArea, SWT.MULTI
-				| SWT.FULL_SELECTION | SWT.BORDER);
+		viewer = new TableViewer(resultArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
 		viewer.getTable().setLinesVisible(true);
 		viewer.getTable().setHeaderVisible(true);
 		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
@@ -852,7 +860,6 @@
 			}
 		});
 		
-		
 		nColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
 		nColumn.setText(" "); //$NON-NLS-1$
 		nColumn.pack();
@@ -936,11 +943,9 @@
 		if (this.partition != null) {
 			List<String> partnames = this.partition.getPartNames();
 			if (partnames.size() > 1)
-				if (viewer.getTable().getColumnCount() < partnames
-						.size() + 3) {
+				if (viewer.getTable().getColumnCount() < partnames.size() + 3) {
 				for (int i = 0; i < partnames.size(); i++) {
-				final TableColumn partColumn = new TableColumn(
-						viewer.getTable(), SWT.RIGHT);
+				final TableColumn partColumn = new TableColumn(viewer.getTable(), SWT.RIGHT);
 				try {
 				partColumn.setText(partnames.get(i) + " t=" + partition.getParts().get(i).getSize()); //$NON-NLS-1$
 				}
@@ -1054,9 +1059,11 @@
 			// props
 			ArrayList<WordProperty> availables = new ArrayList<>();
 			try {
-				for (WordProperty p : index.getCorpus().getOrderedProperties())
-					if (!index.getProperties().contains(p))
+				for (WordProperty p : index.getCorpus().getOrderedProperties()) {
+					if (!index.getProperties().contains(p)) {
 						availables.add(p);
+					}
+				}
 			}
 			catch (CqiClientException e) {
 				Log.printStackTrace(e);
@@ -1090,10 +1097,12 @@
 			this.FminSpinner.setSelection(1);
 			this.FmaxSpinner.setSelection(9999999);
 			
-			if (partition != null)
+			if (partition != null) {
 				setPartName(partition.getName());
-			else
+			}
+			else {
 				setPartName(corpus.getName());
+			}
 			queryWidget.setFocus();
 		}
 		else {
@@ -1117,8 +1126,9 @@
 		if (index.getV() > 0) {
 			lines = index.getLines(from, to);
 		}
-		else
+		else {
 			lines = new ArrayList<>();
+		}
 		
 		navigationArea.setInfoLineText("" + (from + 1), //$NON-NLS-1$
 				"-" + (to) + " / " + index.getV()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1135,11 +1145,12 @@
 		lVInfo.getParent().layout();
 		
 		String unitColumnHeader = ""; //$NON-NLS-1$
-		for (Property p : index.getProperties())
+		for (Property p : index.getProperties()) {
 			unitColumnHeader += p.toString() + propSeparator;
-		if (unitColumnHeader.length() > 0)
-			unitColumnHeader = unitColumnHeader.substring(0, unitColumnHeader
-					.length() - 1);
+		}
+		if (unitColumnHeader.length() > 0) {
+			unitColumnHeader = unitColumnHeader.substring(0, unitColumnHeader.length() - 1);
+		}
 		unitColumn.setText(unitColumnHeader);
 		
 		viewer.setInput(lines);
@@ -1161,13 +1172,14 @@
 		if (index != null) {
 			String str;
 			
-			if (partition != null)
+			if (partition != null) {
 				str = NLS.bind(IndexUIMessages.IndexEditor_17,
 						new Object[] { partition.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax() });
-			else
+			}
+			else {
 				str = NLS.bind(IndexUIMessages.IndexEditor_17,
 						new Object[] { corpus.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax() });
-			
+			}
 			return str;
 		}
 		return ""; //$NON-NLS-1$
@@ -1180,8 +1192,9 @@
 	 */
 	@Override
 	public void _setFocus() {
-		if (!this.queryWidget.isDisposed())
+		if (!this.queryWidget.isDisposed()) {
 			this.queryWidget.setFocus();
+		}
 		StatusLine.setMessage(IndexUIMessages.openingTheIndexResults);
 	}
 	
Index: tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/QueryIndexEditor.java
===================================================================
--- tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/QueryIndexEditor.java	(revision 2994)
+++ tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/QueryIndexEditor.java	(revision 2995)
@@ -304,8 +304,7 @@
 		title = "Computing QueryIndex...";
 		
 		try {
-			JobHandler jobhandler = new JobHandler(title,
-					queryWidget.getParent()) {
+			JobHandler jobhandler = new JobHandler(title) {
 				
 				@Override
 				protected IStatus run(IProgressMonitor monitor) {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationActionBarAdvisor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationActionBarAdvisor.java	(revision 2994)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationActionBarAdvisor.java	(revision 2995)
@@ -1,196 +0,0 @@
-// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
-// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
-// Lyon 2, University of Franche-Comté, University of Nice
-// Sophia Antipolis, University of Paris 3.
-// 
-// The TXM platform is free software: you can redistribute it
-// and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation,
-// either version 2 of the License, or (at your option) any
-// later version.
-// 
-// The TXM platform is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-// PURPOSE. See the GNU General Public License for more
-// details.
-// 
-// You should have received a copy of the GNU General
-// Public License along with the TXM platform. If not, see
-// http://www.gnu.org/licenses.
-// 
-// 
-// 
-// $LastChangedDate:$
-// $LastChangedRevision:$
-// $LastChangedBy:$ 
-//
-package org.txm.rcp;
-
-import org.eclipse.jface.action.ICoolBarManager;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
-import org.eclipse.ui.application.ActionBarAdvisor;
-import org.eclipse.ui.application.IActionBarConfigurer;
-//import org.txm.rcp.actions.ComputeSpecificities;
-//import org.txm.rcp.actions.CreateFrequencyList;
-//import org.txm.rcp.actions.CreatePartition;
-//import org.txm.rcp.actions.CreateSubcorpus;
-//import org.txm.rcp.actions.GetConcordances;
-import org.txm.rcp.actions.RunGroovyScript;
-import org.txm.rcp.messages.TXMUIMessages;
-
-// TODO: Auto-generated Javadoc
-/**
- * Controls the available commands in toolbar
- */
-@Deprecated
-public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
-
-	/**
-	 * Instantiates a new application action bar advisor.
-	 *
-	 * @param configurer the configurer
-	 */
-	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
-		super(configurer);
-	}
-
-	/** The exit action. */
-	private IWorkbenchAction exitAction;
-
-	/** The about action. */
-	private IWorkbenchAction aboutAction;
-
-	/** The preference action. */
-	private IWorkbenchAction preferenceAction;
-
-	/** The delete action. */
-	private IWorkbenchAction deleteAction;
-
-	/** The import action. */
-	private RunGroovyScript importAction;
-
-	/** The help action. */
-	private IWorkbenchAction helpAction;
-	
-	/** The help search action. */
-	private IWorkbenchAction helpSearchAction;
-	
-	/** The dynamic help action. */
-	private IWorkbenchAction dynamicHelpAction;
-
-	/**
-	 * build all the actions of the application, many are deprecated.
-	 *
-	 * @param window the window
-	 */
-	@Override
-	protected void makeActions(IWorkbenchWindow window) {
-
-		preferenceAction = ActionFactory.PREFERENCES.create(window);
-		preferenceAction.setText(TXMUIMessages.preferences);
-		register(preferenceAction);
-		exitAction = ActionFactory.QUIT.create(window);
-		exitAction.setText(TXMUIMessages.exit);
-		register(exitAction);
-		aboutAction = ActionFactory.ABOUT.create(window);
-		aboutAction.setText(TXMUIMessages.aboutTXM);
-		register(aboutAction);
-		deleteAction = ActionFactory.DELETE.create(window);
-		// register(deleteAction);
-		//computeSpecificities = new ComputeSpecificities(window);
-		//register(computeSpecificities);
-		//createPartition = new CreatePartition(window);
-		//register(createPartition);
-		//createSubcorpus = new CreateSubcorpus(window);
-		//register(createSubcorpus);
-		helpAction = ActionFactory.HELP_CONTENTS.create(window);
-		register(helpAction);
-		dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window);
-		register(dynamicHelpAction);
-		{
-			helpSearchAction = ActionFactory.HELP_SEARCH.create(window);
-			register(helpSearchAction);
-		}
-		//createFrequencyList = new CreateFrequencyList(window);
-		//register(createFrequencyList);
-
-		// TODO remettre l'analyse par correspondance dans la toolbar principale
-		// computeCorrespondanceAnalysis = new
-		// ComputeCorrespondanceAnalysis(window);
-		// register(computeCorrespondanceAnalysis);
-
-		//getConcordances = new GetConcordances(window);
-		//register(getConcordances);
-
-		// System.out.println(Messages.ApplicationActionBarAdvisor_0);
-		importAction = new RunGroovyScript(window);
-		register(importAction);
-
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager)
-	 */
-	@Override
-	protected void fillMenuBar(IMenuManager menuBar) {
-		// MenuManager fileMenu = new MenuManager(Messages.File_Menu_Label1,
-		// Messages.File_Menu_Label2);
-		// fileMenu.add(openFileCommand.);
-		// fileMenu.add(preferenceAction);
-		// fileMenu.add(importAction);
-		// fileMenu.add(new Separator());
-		// fileMenu.add(exitAction);
-
-		// MenuManager corpusMenu = new MenuManager(Messages.Corpus_Menu_Label1,
-		// Messages.Corpus_Menu_Label2);
-		// corpusMenu.add(createSubcorpus);
-		// corpusMenu.add(createPartition);
-		// corpusMenu.add(new Separator());
-		// corpusMenu.add(createFrequencyList);
-		// corpusMenu.add(getConcordances);
-		// corpusMenu.add(computeSpecificities);
-		// TODO remettre l'analyse par correspondance dans le menu corpus
-		// corpusMenu.add(computeCorrespondanceAnalysis);
-
-		// MenuManager helpMenu = new MenuManager(Messages.Help_Menu_Label1,
-		// Messages.Help_Menu_Label2);
-		// helpMenu.add(helpAction);
-		// helpMenu.add(dynamicHelpAction);
-		// helpMenu.add(helpSearchAction);
-		// helpMenu.add(aboutAction);
-
-		// menuBar.add(fileMenu);
-		// menuBar.add(corpusMenu);
-		// menuBar.add(helpMenu);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.ui.application.ActionBarAdvisor#fillCoolBar(org.eclipse.jface.action.ICoolBarManager)
-	 */
-	@Override
-	protected void fillCoolBar(ICoolBarManager coolBar) {
-		// IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle());
-		// coolBar.add(toolbar);
-		// toolbar.add(createSubcorpus);
-		// toolbar.add(createPartition);
-		// toolbar.add(new Separator());
-		// toolbar.add(createFrequencyList);
-		// toolbar.add(getConcordances);
-		// toolbar.add(computeSpecificities);
-		// toolbar.add(computeCorrespondanceAnalysis);
-	}
-
-	/**
-	 * Fill tray item.
-	 *
-	 * @param trayItem the tray item
-	 */
-	protected void fillTrayItem(IMenuManager trayItem) {
-		trayItem.add(aboutAction);
-		trayItem.add(exitAction);
-	}
-}
\ No newline at end of file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java	(revision 2994)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java	(revision 2995)
@@ -33,6 +33,7 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.osgi.util.NLS;
 import org.txm.Toolbox;
 import org.txm.rcp.JobsTimer;
@@ -44,46 +45,58 @@
 
 // TODO: Auto-generated Javadoc
 /**
- * restart TXM: restart searchengine, statengine, workspace... 
+ * restart TXM: restart searchengine, statengine, workspace...
+ * 
  * @author mdecorde
  * 
  */
 public class RestartTXM extends AbstractHandler {
-
+	
 	/** The ID. */
 	static public String ID = "org.txm.rcp.commands.RestartTXM"; //$NON-NLS-1$
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 	 */
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		JobHandler jobhandler = new JobHandler("Restarting...") { 
+		
+		if (!JobHandler.areAllTXMJobsDone()) {
+			Log.warning("Wait for all jobs to end and retry");
+			return null;
+		}
+		
+		JobHandler jobhandler = new JobHandler("Restarting...") {
+			
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
 				JobsTimer.start();
 				try {
 					monitor.beginTask(TXMUIMessages.restartTXM, 100);
-					//Toolbox.updateProperties(TxmPreferences.getProperties());
+					// Toolbox.updateProperties(TxmPreferences.getProperties());
 					if (Toolbox.restart()) {
 						Log.info(TXMUIMessages.info_txmIsReady);
-					} else {
+					}
+					else {
 						Log.warning("TXM not restarted normally.");
 					}
-
+					
 					monitor.worked(95);
 					syncExec(new Runnable() {
+						
 						@Override
 						public void run() {
 							reloadViews();
 						}
 					});
-
-				} catch (Exception e) {
+					
+				}
+				catch (Exception e) {
 					System.out.println(NLS.bind(TXMUIMessages.errorWhileRunningScriptColonP0, e));
 					org.txm.utils.logger.Log.printStackTrace(e);
-				} finally {
+				}
+				finally {
 					monitor.done();
 				}
 				JobsTimer.stopAndPrint();
@@ -93,10 +106,10 @@
 		jobhandler.startJob();
 		return event;
 	}
-
+	
 	public static void reloadViews() {
-		//System.out.println(Messages.RestartTXM_0);
-		//TODO TXM views must have been registered to be reloaded
+		// System.out.println(Messages.RestartTXM_0);
+		// TODO TXM views must have been registered to be reloaded
 		
 		org.txm.rcp.views.corpora.CorporaView.reload();
 		org.txm.rcp.views.corpora.CorporaView.refresh();
@@ -106,7 +119,7 @@
 		org.txm.rcp.views.QueriesView.reload();
 		org.txm.rcp.views.QueriesView.refresh();
 		SummaryView.reload();
-		//System.err.println(Messages.AddBase_10);
-		//StatusLine.setMessage(Messages.AddBase_10);
+		// System.err.println(Messages.AddBase_10);
+		// StatusLine.setMessage(Messages.AddBase_10);
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 2994)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 2995)
@@ -42,20 +42,17 @@
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.application.ActionBarAdvisor;
-import org.eclipse.ui.application.IActionBarConfigurer;
 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
 import org.eclipse.ui.internal.WorkbenchWindow;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.utils.logger.Log;
 
-// TODO: Auto-generated Javadoc
 /**
  * Configures TXM Windows
  */
 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
-
+	
 	/**
 	 * Instantiates a new application workbench window advisor.
 	 *
@@ -64,20 +61,14 @@
 	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
 		super(configurer);
 	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
-	 */
-	@Override
-	public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
-		return new ApplicationActionBarAdvisor(configurer);
-	}
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen()
 	 */
 	@Override
 	public void preWindowOpen() {
+		
 		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
 		configurer.setShowProgressIndicator(true);
 		configurer.setInitialSize(new Point(1024, 768));
@@ -89,21 +80,18 @@
 		configurer.setShowPerspectiveBar(true);
 		configurer.setTitle(TXMUIMessages.tXM);
 		
-
 		// This is a patch to remove the Quick Search Field and spacers from the Main toolbar
 		Log.fine(TXMUIMessages.removeUnnecessaryE4Elements);
 		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
 		if (window instanceof WorkbenchWindow) {
 			MWindow model = ((WorkbenchWindow) window).getModel();
-			EModelService modelService = model.getContext().get(
-					EModelService.class);
-
-			MTrimBar trimBar = modelService.getTrim((MTrimmedWindow) model,
-					SideValue.TOP);
+			EModelService modelService = model.getContext().get(EModelService.class);
+			
+			MTrimBar trimBar = modelService.getTrim((MTrimmedWindow) model, SideValue.TOP);
 			Iterator<MTrimElement> it = trimBar.getChildren().iterator();
 			while (it.hasNext()) {
 				MTrimElement next = it.next();
-				//System.out.println("Element: "+next.getElementId());
+				// System.out.println("Element: "+next.getElementId());
 				if ("com.none.playActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$
 				if ("org.eclipse.search.searchActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$
 				if ("org.eclipse.ui.edit.text.actionSet.annotationNavigation".equals(next.getElementId())) continue; //$NON-NLS-1$
@@ -112,21 +100,21 @@
 				if ("org.eclipse.debug.ui.launchActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$
 				if ("org.eclipse.ui.browser.editor".equals(next.getElementId())) continue; //$NON-NLS-1$
 				// Team
-				//if ("org.eclipse.team.svn.ui.SVNTeamPreferences".equals(next.getElementId())) continue;
+				// if ("org.eclipse.team.svn.ui.SVNTeamPreferences".equals(next.getElementId())) continue;
 				if ("group.editor".equals(next.getElementId())) continue; //$NON-NLS-1$
 				if ("SearchField".equals(next.getElementId())) continue;
-				//if ("PerspectiveSpacer".equals(next.getElementId())) continue;
-				//if ("Spacer Glue".equals(next.getElementId())) continue;
-				//if ("Search-PS Glue".equals(next.getElementId())) continue;
+				// if ("PerspectiveSpacer".equals(next.getElementId())) continue;
+				// if ("Spacer Glue".equals(next.getElementId())) continue;
+				// if ("Search-PS Glue".equals(next.getElementId())) continue;
 				if ("PerspectiveSwitcher".equals(next.getElementId())) continue; //$NON-NLS-1$
-				//System.out.println("DEL Element: "+next.getElementId());
-				if (next instanceof MToolControl)
-					next.setToBeRendered(false);
+				// System.out.println("DEL Element: "+next.getElementId());
+				if (next instanceof MToolControl) next.setToBeRendered(false);
 			}
 		}
 	}
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowOpen()
 	 */
 	@Override
@@ -137,31 +125,31 @@
 		page.hideActionSet("org.eclipse.ui.edit.text.actionSet.navigation"); //$NON-NLS-1$
 		page.hideActionSet("org.eclipse.ui.edit.text.actionSet.annotationNavigation"); //$NON-NLS-1$
 		page.hideActionSet("org.eclipse.ui.run"); //$NON-NLS-1$
-		//page.hideActionSet("org.eclipse.team.svn.ui.SVNTeamPreferences"); //$NON-NLS-1$
+		// page.hideActionSet("org.eclipse.team.svn.ui.SVNTeamPreferences"); //$NON-NLS-1$
 		// StatusLine.setMessage(Messages.ApplicationWorkbenchWindowAdvisor_statusready);
-
+		
 		IContributionItem[] mItems, mSubItems;
-		IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer ().getMenuManager ();
+		IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
 		mm.remove("org.eclipse.ui.run");
-//		mItems = mm.getItems ();
-//		for (int i = 0; i < mItems.length; i++)
-//		{
-//			if (mItems[i] instanceof MenuManager)
-//			{
-//				mSubItems = ((MenuManager) mItems[i]).getItems ();
-//				for (int j = 0; j < mSubItems.length; j++)
-//				{
-//					System.out.println("menu : "+mItems[i].getId());
-//					if (mItems[i].getId ().equals ("file"))
-//						((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
-//					else if (mItems[i].getId ().equals ("help"))
-//					{
-//						((MenuManager) mItems[i]).remove ("group.updates");
-//						((MenuManager) mItems[i]).remove ("org.eclipse.update.ui.updateMenu");
-//						((MenuManager) mItems[i]).remove ("org.eclipse.ui.actions.showKeyAssistHandler");
-//					}
-//				}
-//			}
-//		}
+		// mItems = mm.getItems ();
+		// for (int i = 0; i < mItems.length; i++)
+		// {
+		// if (mItems[i] instanceof MenuManager)
+		// {
+		// mSubItems = ((MenuManager) mItems[i]).getItems ();
+		// for (int j = 0; j < mSubItems.length; j++)
+		// {
+		// System.out.println("menu : "+mItems[i].getId());
+		// if (mItems[i].getId ().equals ("file"))
+		// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
+		// else if (mItems[i].getId ().equals ("help"))
+		// {
+		// ((MenuManager) mItems[i]).remove ("group.updates");
+		// ((MenuManager) mItems[i]).remove ("org.eclipse.update.ui.updateMenu");
+		// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.actions.showKeyAssistHandler");
+		// }
+		// }
+		// }
+		// }
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/JobHandler.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/JobHandler.java	(revision 2994)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/JobHandler.java	(revision 2995)
@@ -29,11 +29,14 @@
 
 import java.util.concurrent.Semaphore;
 
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.internal.progress.ProgressManagerUtil;
+import org.eclipse.ui.texteditor.ISchedulingRuleProvider;
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.utils.logger.Log;
@@ -60,24 +63,7 @@
 	
 	protected boolean success = false;
 	
-	
 	/**
-	 * Instantiates a new job handler.
-	 * 
-	 * @param title
-	 *            the title
-	 * @param parent
-	 *            the parent
-	 */
-	// FIXME: SJ: parent is not used anymore, need to remove or modify this constructor
-	public JobHandler(String title, Composite parent) {
-		super(title);
-		// this.parent = parent;
-		this.setUser(true);
-	}
-	
-	
-	/**
 	 * Create a job in RCP scheduler.
 	 * 
 	 * @param title
@@ -87,6 +73,24 @@
 		this(title, true);
 	}
 	
+	// static final ISchedulingRule RULE = new ISchedulingRule() {
+	//
+	// @Override
+	// public String toString() {
+	// return "MAIN RULE";
+	// }
+	//
+	// @Override
+	// public boolean isConflicting(ISchedulingRule rule) {
+	// return rule == this;
+	// }
+	//
+	// @Override
+	// public boolean contains(ISchedulingRule rule) {
+	// return rule == this;
+	// }
+	// };
+	
 	/**
 	 * Instantiates a new job handler.
 	 * 
@@ -98,9 +102,16 @@
 	public JobHandler(String title, boolean show) {
 		super(title);
 		this.setUser(show);
+		// this.setRule(RULE);
 	}
 	
+	final static public String TXM_FAMILY = "TXM";
 	
+	@Override
+	public boolean belongsTo(Object family) {
+		return TXM_FAMILY.equals(family);
+	}
+	
 	/**
 	 * You must set the current monitor to be available to manage the process
 	 * progress
@@ -202,9 +213,9 @@
 	 * Start job.
 	 */
 	public void startJob(boolean modal) {
-		if (modal) {
-			this.setRule(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());// set modal job
-		}
+		// if (modal) { // this will deadlock the job if the jobs needs to work on the RCP workspace files
+		// this.setRule(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());// set modal job
+		// }
 		this.setUser(true);// show popup
 		this.schedule();// start
 	}
@@ -288,4 +299,14 @@
 	public void setTaskName(String name) {
 		if (currentMonitor != null) currentMonitor.setTaskName(name);
 	}
+	
+	/**
+	 * All TXM jobs are done if there is no more TXM_FAMILY jobs
+	 * 
+	 * @return true if all TXM jobs are done
+	 */
+	public static boolean areAllTXMJobsDone() {
+		Job[] jobs = JobHandler.getJobManager().find(JobHandler.TXM_FAMILY);
+		return jobs == null || jobs.length == 0;
+	}
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/RunGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/RunGroovyScript.java	(revision 2994)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/RunGroovyScript.java	(revision 2995)
@@ -1,152 +0,0 @@
-// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
-// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
-// Lyon 2, University of Franche-Comté, University of Nice
-// Sophia Antipolis, University of Paris 3.
-// 
-// The TXM platform is free software: you can redistribute it
-// and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation,
-// either version 2 of the License, or (at your option) any
-// later version.
-// 
-// The TXM platform is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-// PURPOSE. See the GNU General Public License for more
-// details.
-// 
-// You should have received a copy of the GNU General
-// Public License along with the TXM platform. If not, see
-// http://www.gnu.org/licenses.
-// 
-// 
-// 
-// $LastChangedDate:$
-// $LastChangedRevision:$
-// $LastChangedBy:$ 
-//
-package org.txm.rcp.actions;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.txm.Toolbox;
-import org.txm.importer.scripting.GroovyImportScriptRunner;
-import org.txm.rcp.Application;
-import org.txm.rcp.IImageKeys;
-import org.txm.rcp.messages.TXMUIMessages;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.utils.logger.Log;
-
-import groovy.lang.Binding;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class RunGroovyScript.
- */
-public class RunGroovyScript extends Action implements IWorkbenchAction {
-
-	/** The ID. */
-	private static String ID = "org.txm.rcp.actions.RunGroovyScript"; //$NON-NLS-1$
-
-	/** The window. */
-	private IWorkbenchWindow window;
-
-	/** The gse. */
-	private GroovyImportScriptRunner gse = null;
-
-	/**
-	 * Instantiates a new run groovy script.
-	 * 
-	 * @param window
-	 *            the window
-	 */
-	public RunGroovyScript(IWorkbenchWindow window) {
-		this.window = window;
-		setId(ID);
-		setText(TXMUIMessages.ampRunScript);
-		setToolTipText(TXMUIMessages.runScript);
-		setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
-				Application.PLUGIN_ID, IImageKeys.ACTION_RUN_SCRIPT));
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
-	 */
-	@Override
-	public void dispose() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.action.Action#run()
-	 */
-	@Override
-	public void run() {
-
-		FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN);
-		dialog.setFilterExtensions(new String[] { TXMUIMessages.groovy });
-		String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts";
-		String scriptCurrentDir = Toolbox.getTxmHomePath() + "/scripts";
-		
-
-		if (LastOpened.getFolder(ID) != null) {
-			scriptCurrentDir = LastOpened.getFolder(ID);
-		}
-		dialog.setFilterPath(scriptCurrentDir);
-		String result = dialog.open();
-		if (result == null)
-			return;
-
-		final File script = new File(result);
-		LastOpened.set(ID, script.getParent(), script.getName());
-		try {
-			List<File> classPath = new ArrayList<File>();
-			classPath.add(new File(scriptRootDir));
-			gse = new GroovyImportScriptRunner(script, classPath);
-		} catch (IOException e) {
-			System.err.println(NLS.bind(TXMUIMessages.errorWhileOpeningGroovyScriptColonP0, e));
-			System.err.println(e);
-		}
-
-		if (gse != null) {
-			JobHandler jobhandler = new JobHandler(TXMUIMessages.scriptExecution, null) {
-				@Override
-				protected IStatus run(IProgressMonitor monitor) {
-					this.runInit(monitor);
-					try {
-						monitor.beginTask(TXMUIMessages.executeScript, 100);
-						new Binding();
-						// gse.run(binding);
-						monitor.worked(100);
-
-					} catch (ThreadDeath td) {
-						return Status.CANCEL_STATUS;
-					} catch (Exception e) {
-						Log.severe(NLS.bind(TXMUIMessages.errorWhileRunningScriptColonP0, e));
-					} finally {
-						monitor.done();
-					}
-					return Status.OK_STATUS;
-				}
-			};
-			jobhandler.startJob();
-		}
-	}
-}
\ No newline at end of file
