Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 785)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 786)
@@ -48,7 +48,7 @@
 import org.txm.index.core.functions.LineComparator.SortMode;
 import org.txm.index.core.messages.IndexCoreMessages;
 import org.txm.index.core.preferences.IndexPreferences;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.ICqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -866,7 +866,7 @@
 
 		//long time = System.currentTimeMillis();
 		QueryResult result = corpus.query(pQuery, "index", true); //$NON-NLS-1$
-		boolean isTargetUsed = CQPEngine.getCqiClient().subCorpusHasField(result.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
+		boolean isTargetUsed = CQPSearchEngine.getCqiClient().subCorpusHasField(result.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
 		int nbresults = result.getNMatch();
 		this.nTotalTokens += nbresults; // get number of tokens
 
Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java	(revision 785)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java	(revision 786)
@@ -41,7 +41,7 @@
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.editors.TXMEditor;
 import org.txm.rcp.handlers.BaseAbstractHandler;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 
 /**
@@ -82,7 +82,7 @@
 	@Inject
 	public static IEditorPart openEditor(Object o) {
 		
-		if (!CQPEngine.isInitialized()) {
+		if (!CQPSearchEngine.isInitialized()) {
 			System.out.println("SearchEngine is not ready. Aborting.");
 			return null;
 		}
Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 785)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 786)
@@ -140,7 +140,7 @@
 import org.txm.rcp.utils.SWTEditorsUtils;
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.ReferencePattern;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -1257,8 +1257,8 @@
 			//System.err.println(Messages.CorporaView_3);
 			org.txm.rcp.utils.Logger.printStackTrace(e1);
 			try {
-				System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
-				Log.severe(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+				System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
+				Log.severe(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 			} catch (Exception e2) {
 				System.out.println(ConcordanceUIMessages.ConcordancesEditor_7+e2);
 				org.txm.rcp.utils.Logger.printStackTrace(e1);
Index: tmp/org.txm.synopticeditor.rcp/src/org/txm/synopticedition/rcp/handlers/BackToText.java
===================================================================
--- tmp/org.txm.synopticeditor.rcp/src/org/txm/synopticedition/rcp/handlers/BackToText.java	(revision 785)
+++ tmp/org.txm.synopticeditor.rcp/src/org/txm/synopticedition/rcp/handlers/BackToText.java	(revision 786)
@@ -52,7 +52,7 @@
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.utils.SWTEditorsUtils;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -130,7 +130,7 @@
 				if (yProperty != null) {
 					wProperty = corpus.getProperty("w");
 					if (wProperty != null) {
-						AbstractCqiClient CQI = CQPEngine.getCqiClient();
+						AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 						int[] cpos = {match.getStart()};
 						hProperty = corpus.getProperty("h");
 						if (hProperty != null) {
Index: tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OriflammsFunction.java
===================================================================
--- tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OriflammsFunction.java	(revision 785)
+++ tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OriflammsFunction.java	(revision 786)
@@ -11,7 +11,7 @@
 
 import org.txm.Toolbox;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -31,7 +31,7 @@
 	protected Corpus corpus;
 	protected File tsvFile;
 
-	protected AbstractCqiClient CQI = CQPEngine.getCqiClient();
+	protected AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 
 	protected StructuralUnit text_su;
 	protected StructuralUnitProperty text_id;
Index: tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/AbbreviationsAndLines.java
===================================================================
--- tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/AbbreviationsAndLines.java	(revision 785)
+++ tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/AbbreviationsAndLines.java	(revision 786)
@@ -6,7 +6,7 @@
 
 import org.txm.Toolbox;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -73,7 +73,7 @@
 
 		int[] positions = new int[length];
 		for (int i = 0 ; i < length ; i++) positions[i] = from++;
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 
 		String[] abbrNs = CQI.cpos2Str(abbrn.getQualifiedName(), positions);
 		String[] allLetters = CQI.cpos2Str(lettersAll.getQualifiedName(), positions);
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ToolboxTester.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ToolboxTester.java	(revision 785)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ToolboxTester.java	(revision 786)
@@ -4,7 +4,7 @@
 import org.txm.Toolbox;
 import org.txm.Toolbox;
 import org.txm.core.engines.EngineType;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 
 /**
  * PropertyTester to check Toolbox states
@@ -30,8 +30,8 @@
 			//System.out.println("TEST: "+property+" = "+Toolbox.getEngineManager(EngineType.STAT).getEngine("R").getState()); //$NON-NLS-1$ //$NON-NLS-2$
 			return Toolbox.getEngineManager(EngineType.STATS).getEngine("R").getState();
 		} else if (PROPERTY_SEARCH_ENGINE_READY.equals(property)) {
-			System.out.println("TEST: "+property+" = "+CQPEngine.isInitialized()); //$NON-NLS-1$ //$NON-NLS-2$
-			return CQPEngine.isInitialized();
+			System.out.println("TEST: "+property+" = "+CQPSearchEngine.isInitialized()); //$NON-NLS-1$ //$NON-NLS-2$
+			return CQPSearchEngine.isInitialized();
 		}
 		
 		return false;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 785)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 786)
@@ -65,7 +65,7 @@
 import org.txm.rcp.utils.GSERunner;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.tokenizer.TokenizerClasses;
@@ -205,7 +205,7 @@
 			}
 		}
 		
-		if (CQPEngine.isInitialized()) Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
+		if (CQPSearchEngine.isInitialized()) Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
 		final BaseParameters p = params;
 		JobHandler jobhandler = new JobHandler(TXMUIMessages.RunGroovyScript_0
 				+ script.getAbsolutePath()) { //$NON-NLS-1$
@@ -294,7 +294,7 @@
 					System.out.println(NLS.bind(TXMUIMessages.RunGroovyScript_8, e));
 					org.txm.rcp.utils.Logger.printStackTrace(e);
 				} finally {
-					if (!CQPEngine.isInitialized()) { // the import failed
+					if (!CQPSearchEngine.isInitialized()) { // the import failed
 						monitor.setTaskName("Restarting Toolbox search engine"); //$NON-NLS-1$
 						Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
 						
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java	(revision 785)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java	(revision 786)
@@ -18,7 +18,7 @@
 import org.eclipse.ui.handlers.IHandlerService;
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.statsengine.r.core.RStatsEngine;
 import org.txm.statsengine.r.core.messages.RCoreMessages;
 import org.txm.utils.logger.Log;
@@ -58,7 +58,7 @@
 	 * @return true if the corpus engine is available
 	 */
 	public boolean checkCorpusEngine()	{
-		if (!CQPEngine.isInitialized())	{
+		if (!CQPSearchEngine.isInitialized())	{
 			System.out.println("Corpus Engine is not ready, canceling command.");
 			Log.severe("Corpus Engine is not ready, canceling command.");
 			return false;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ComputeIntersection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ComputeIntersection.java	(revision 785)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ComputeIntersection.java	(revision 786)
@@ -13,7 +13,7 @@
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.Toolbox;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.CqpObject;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
@@ -58,7 +58,7 @@
 		String id2 = subcorpora.get(1).getQualifiedCqpId();
 		String cqpid = CqpObject.subcorpusNamePrefix + Corpus.getNextSubcorpusCounter();
 		String command = "inter";
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 
 		//TODO: finish the command
 		
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 785)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 786)
@@ -41,7 +41,7 @@
 import org.txm.concordance.core.functions.Line;
 import org.txm.concordance.rcp.editors.ConcordanceEditor;
 import org.txm.core.preferences.TXMPreferences;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -131,7 +131,7 @@
 					int leftPosition = Math.max(keywordPosition - line.getConcordance().getLeftContextSize(), 0);
 					int rightPosition = Math.min(keywordPosition + line.getConcordance().getRightContextSize(), corpus.getSize());
 					int[] positions = {leftPosition, rightPosition};
-					String[] times = CQPEngine.getCqiClient().cpos2Str(timeP.getQualifiedName(), positions);
+					String[] times = CQPSearchEngine.getCqiClient().cpos2Str(timeP.getQualifiedName(), positions);
 					sStartTime = times[0];
 					sEndTime = times[1];
 				} else {
Index: tmp/org.txm.core/src/java/org/txm/Toolbox.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 785)
+++ tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 786)
@@ -98,7 +98,7 @@
 		return state;
 	}
 
-	private static boolean fetchEngineManagers() {
+	private static boolean fetchEnginesManagers() {
 		Log.finest("Fetching engines managers...");
 		enginesManagers.clear();
 		//System.out.println("Contributions of "+EnginesManager.ENGINEMANAGER_EXTENSION_POINT_ID);
@@ -112,7 +112,7 @@
 			try {
 				EnginesManager<?> enginesManager = (EnginesManager<?>)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
 
-				Log.finest("Registering engines manager: " + enginesManager);
+				Log.finest("Registering " + enginesManager.getEnginesDescription() + " engines manager: " + enginesManager + "...");
 				
 				if (enginesManager.fetchEngines()) {
 					//System.out.println("add engine: "+engine);
@@ -226,7 +226,7 @@
 			state = startWorkspace(monitor);
 
 
-			Log.warning("Initializing logger");
+			Log.warning("Initializing logger...");
 			Log.setLevel(Level.parse(TXMPreferences.getString(TBXPreferences.LOG_LEVEL, TBXPreferences.PREFERENCES_NODE)));
 			Log.setPrintInConsole(TXMPreferences.getBoolean(TBXPreferences.ADD_TECH_LOGS, TBXPreferences.PREFERENCES_NODE));
 
@@ -523,7 +523,7 @@
 
 	private static boolean startsEngineManagers(IProgressMonitor monitor) {
 
-		fetchEngineManagers();
+		fetchEnginesManagers();
 
 		Log.info("Starting " + enginesManagers.keySet().size() + " engines managers...");
 
Index: tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java	(revision 785)
+++ tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java	(revision 786)
@@ -12,14 +12,16 @@
  * The Toolbox will manage the engines life-cycle. 
  * 
  * @author mdecorde
+ * @author sjacquot
  *
  */
 public abstract class EnginesManager<T extends Engine> {
 	
+	
 	public static final String ENGINES_MANAGER_EXTENSION_POINT_ID = EnginesManager.class.getName();
 	
 	/**
-	 * Managed engines.
+	 * Managed engines map (name => engine).
 	 */
 	protected HashMap<String, T> engines = new HashMap<String, T>();
 	
@@ -32,31 +34,6 @@
 	
 	
 	/**
-	 * Returns the current engine.
-	 * @return
-	 */
-	public T getCurrentEngine() {
-		return this.currentEngine;
-	}
-	
-	
-	/**
-	 * Sets the current engine.
-	 * @param engine
-	 */
-	public void setCurrentEngine(T engine)	{
-		this.currentEngine = engine;
-	}
-	
-	/**
-	 * Sets the current engine specified by its name.
-	 * @param name
-	 */
-	public void setCurrentEngine(String name)	{
-		this.setCurrentEngine(this.getEngine(name));
-	}
-	
-	/**
 	 * Finds out the engines that matches this manager engines extension point.
 	 * 
 	 * @return
@@ -66,7 +43,7 @@
 	
 	
 	/**
-	 * Creates and initializes the engines with the specified extension point id.
+	 * Creates and initializes the engines from contributions with the specified extension point id.
 	 * 
 	 * @param engineExtensionPointId
 	 * @return true if at least one engine has been created otherwise false
@@ -75,8 +52,8 @@
 
 		IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(engineExtensionPointId);
 
-		Log.finest("Looking for engines contributions with extension point id " + engineExtensionPointId + "."); //$NON-NLS-1$
-		Log.finest(contributions.length + " engines found."); //$NON-NLS-1$
+		Log.finest("Looking for " + this.getEnginesDescription() + " engines contributions with extension point id " + engineExtensionPointId + "."); //$NON-NLS-1$
+		Log.finest(contributions.length + " engine(s) found."); //$NON-NLS-1$
 		
 		for (int i = 0; i < contributions.length; i++) {
 			try {
@@ -107,7 +84,7 @@
 	public boolean startEngines(IProgressMonitor monitor) {
 		for (Engine engine : this.engines.values()) {
 			
-			String log = "Starting " + engine.getName() + " engine...";
+			String log = "Starting " + this.getEnginesDescription() + " engine: " + engine.getName() + "...";
 			Log.info(log);
 			
 			if (monitor != null) {
@@ -131,12 +108,12 @@
 	public boolean stopEngines() {
 		for (Engine engine : this.engines.values()) {
 			
-			Log.finest("Stopping " + engine.getName() + " engine..."); //$NON-NLS-1$
+			Log.finest("Stopping " + this.getEnginesDescription() + " engine: " + engine.getName() + "..."); //$NON-NLS-1$
 			
 			try {
 				engine.stop();
 			} catch (Exception e) {
-				Log.severe("Error: failed to stop engine: " + engine.getName() + ".");
+				Log.severe("Error: failed to stop engine " + engine.getName() + ".");
 				e.printStackTrace();
 			}
 		}
@@ -150,14 +127,27 @@
 	 * @return
 	 */
 	public boolean restartEngines() {
-		Log.finest("Restarting " + this.engines.size() + " engine(s)."); //$NON-NLS-1$
+		Log.finest("Restarting " + this.engines.size() + " " + this.getEnginesDescription() + " engine(s)."); //$NON-NLS-1$
 		return stopEngines() && startEngines(null);
 	}
 	
-	
+	/**
+	 * Gets the engine type that this manager supports.
+	 * @return the engine type that this manager supports
+	 */
 	public abstract EngineType getEnginesType();
 	
+	
 	/**
+	 * Gets the engine description that this manager supports.
+	 * @return the engine description that this manager supports
+	 */
+	public String getEnginesDescription()	{
+		return this.getEnginesType().getDescription();
+	}
+	
+	
+	/**
 	 * Gets the available engines. 
 	 * @return the available engines
 	 */
@@ -173,4 +163,32 @@
 	public T getEngine(String name) {
 		return engines.get(name);
 	}
+	
+	/**
+	 * Returns the current engine.
+	 * @return
+	 */
+	public T getCurrentEngine() {
+		return this.currentEngine;
+	}
+	
+	
+	/**
+	 * Sets the current engine.
+	 * @param engine
+	 */
+	public void setCurrentEngine(T engine)	{
+		Log.info("Setting current " + this.getEnginesDescription() + " engine to " + engine + ".");
+		this.currentEngine = engine;
+	}
+	
+	/**
+	 * Sets the current engine specified by its name.
+	 * @param name
+	 */
+	public void setCurrentEngine(String name)	{
+		this.setCurrentEngine(this.getEngine(name));
+	}
+	
+
 }
Index: tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java	(revision 785)
+++ tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java	(revision 786)
@@ -1,9 +1,40 @@
 package org.txm.core.engines;
 
+/**
+ * Engine types.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+// FIXME: the description (and name) of the engine should be done in extensions points as for the charts engine, it would be better and not break the plugins modularity
 public enum EngineType {
-	SEARCH,
-	STATS,
-	CHARTS,
-	SCRIPT,
-	ANNOTATION;
+	
+	SEARCH("search"),
+	STATS("statistics"),
+	CHARTS("charts"),
+	SCRIPT("scripts"),
+	ANNOTATION("annotations");
+
+	/**
+	 * Description.
+	 */
+	final private String description;
+
+	/**
+	 * 
+	 * @param description
+	 */
+	private EngineType(String description) {
+		this.description = description;
+	}
+
+	/**
+	 * Gets the description of the type.
+	 * @return
+	 */
+	public String getDescription() {
+		return this.description;
+	}
+
 }
Index: tmp/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java
===================================================================
--- tmp/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java	(revision 785)
+++ tmp/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java	(revision 786)
@@ -14,7 +14,7 @@
 import org.txm.core.results.TXMResult;
 import org.txm.internalview.core.messages.InternalViewCoreMessages;
 import org.txm.internalview.core.preferences.InternalViewPreferences;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -262,7 +262,7 @@
 				String str = InternalViewCoreMessages.InternalView_3;
 				for (Property sup : structuralUnitsProperties) {
 					int[] array = {getCurrentPage()};
-					str += " "+sup.getName()+"="+CQPEngine.getCqiClient().struc2Str(sup.getQualifiedName(), array)[0]; //$NON-NLS-1$ //$NON-NLS-2$
+					str += " "+sup.getName()+"="+CQPSearchEngine.getCqiClient().struc2Str(sup.getQualifiedName(), array)[0]; //$NON-NLS-1$ //$NON-NLS-2$
 				}
 				return str;
 			}
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 785)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 786)
@@ -14,7 +14,7 @@
 import org.txm.core.results.Parameter;
 import org.txm.core.results.TXMParameters;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.NetCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -155,7 +155,7 @@
 				}
 			}
 			else {
-				AbstractCqiClient CQI = CQPEngine.getCqiClient();
+				AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 				if (CQI instanceof NetCqiClient) {
 					System.out.println("Error: CQP eval method only available with CQP memory mode");
 					return false;
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_0_0Macro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_0_0Macro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_0_0Macro.groovy	(revision 786)
@@ -54,7 +54,7 @@
 public void doExport(MainCorpus corpus, String unit_type, String filename) {
 
 	size = corpus.getSize() // you may also use: corpus.getTextEndLimits() (= index of last token = size-1)
-	CQI = CQPEngine.getCqiClient()
+	CQI = CQPSearchEngine.getCqiClient()
 	word = corpus.getWordProperty()
 	// note: using "lbn" seems to work better than "pn" (some imported corpora are missing this information)
 	//pn = corpus.getProperty("pn")
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_1_0Macro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_1_0Macro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozz1_1_0Macro.groovy	(revision 786)
@@ -36,7 +36,7 @@
 // GLOBAL VARIABLES
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 
 // CHECK CORPUS
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozzMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozzMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportToGlozzMacro.groovy	(revision 786)
@@ -54,7 +54,7 @@
 public void doExport(MainCorpus corpus, String unit_type, String filename) {
 
 	size = corpus.getSize() // you may also use: corpus.getTextEndLimits() (= index of last token = size-1)
-	CQI = CQPEngine.getCqiClient()
+	CQI = CQPSearchEngine.getCqiClient()
 	word = corpus.getWordProperty()
 	// note: using "lbn" seems to work better than "pn" (some imported corpora are missing this information)
 	//pn = corpus.getProperty("pn")
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CategorieMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CategorieMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CategorieMacro.groovy	(revision 786)
@@ -77,7 +77,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieDemocratMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieDemocratMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieDemocratMacro.groovy	(revision 786)
@@ -172,7 +172,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Si2SingletonMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Si2SingletonMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Si2SingletonMacro.groovy	(revision 786)
@@ -33,7 +33,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
 vue = AnalecCorpora.getVue(corpus.getName())
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CattexMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CattexMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CattexMacro.groovy	(revision 786)
@@ -178,7 +178,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/PROPERanaphoriquesMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/PROPERanaphoriquesMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/PROPERanaphoriquesMacro.groovy	(revision 786)
@@ -41,7 +41,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Frpos2CategorieMacro.groovy	(revision 786)
@@ -172,7 +172,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/AccessibiliteMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/AccessibiliteMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/AccessibiliteMacro.groovy	(revision 786)
@@ -43,7 +43,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 
 analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
 vue = AnalecCorpora.getVue(corpus.getName())
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CattexMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CattexMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/Fropos2CattexMacro.groovy	(revision 786)
@@ -165,7 +165,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/RetoucheComplementDuNomMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/RetoucheComplementDuNomMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/RetoucheComplementDuNomMacro.groovy	(revision 786)
@@ -38,7 +38,7 @@
 if (!ParametersDialog.open(this)) return
 
 	corpus = corpusViewSelection.getMainCorpus()
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 
 analecCorpus = AnalecCorpora.getCorpus(corpus.getName())
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/LongueurDesMentionsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/LongueurDesMentionsMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/edit/LongueurDesMentionsMacro.groovy	(revision 786)
@@ -60,7 +60,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/analec/Frpos2CategorieMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/analec/Frpos2CategorieMacro.groovy	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/analec/Frpos2CategorieMacro.groovy	(revision 786)
@@ -172,7 +172,7 @@
 if (!ParametersDialog.open(this)) return
 
 corpus = corpusViewSelection
-CQI = CQPEngine.getCqiClient()
+CQI = CQPSearchEngine.getCqiClient()
 word = corpus.getWordProperty()
 posProperty = corpus.getProperty(pos_property_name)
 if (posProperty == null) {
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/export/AnalecAnnotationTEIExporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/export/AnalecAnnotationTEIExporter.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/export/AnalecAnnotationTEIExporter.java	(revision 786)
@@ -21,7 +21,7 @@
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.Application;
 import org.txm.rcp.TxmPreferences;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -88,8 +88,8 @@
 		int[] starts = mainCorpus.getTextStartLimits();
 		int[] ends = mainCorpus.getTextEndLimits();
 		StructuralUnit su_text = mainCorpus.getStructuralUnit("text");
-		int[] strucs = CQPEngine.getCqiClient().cpos2Struc(su_text.getQualifiedName(), starts);
-		String[] ids = CQPEngine.getCqiClient().struc2Str(su_text.getProperty("id").getQualifiedName(), strucs);
+		int[] strucs = CQPSearchEngine.getCqiClient().cpos2Struc(su_text.getQualifiedName(), starts);
+		String[] ids = CQPSearchEngine.getCqiClient().struc2Str(su_text.getProperty("id").getQualifiedName(), strucs);
 
 		File textsDirectory = new File(outputDirectory, "texts");
 		textsDirectory.mkdir();
@@ -349,7 +349,7 @@
 				writer.writeStartElement("span");
 				writer.writeAttribute("id", id);
 				int[] cpos = {unite.getDeb(), unite.getFin()};
-				String[] wordids = CQPEngine.getCqiClient().cpos2Str(wordid.getQualifiedName(), cpos);
+				String[] wordids = CQPSearchEngine.getCqiClient().cpos2Str(wordid.getQualifiedName(), cpos);
 				writer.writeAttribute("from", "text:"+wordids[0]);
 				writer.writeAttribute("to", "text:"+wordids[1]);
 				writer.writeAttribute("ana", "#"+id+"-fs");
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/export/ExportToGlozzMacro.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/export/ExportToGlozzMacro.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/export/ExportToGlozzMacro.java	(revision 786)
@@ -24,7 +24,7 @@
 import org.txm.Toolbox;
 import org.txm.analec.AnalecCorpora;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -43,7 +43,7 @@
 		int size = corpus.getSize(); // you may also use:
 										// corpus.getTextEndLimits() (= index of
 										// last token = size-1)
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		Property word = corpus.getWordProperty();
 		// note: using "lbn" seems to work better than "pn" (some imported
 		// corpora are missing this information)
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java	(revision 786)
@@ -42,7 +42,7 @@
 import org.txm.rcp.TxmPreferences;
 import org.txm.rcp.swt.dialog.ConfirmDialog;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.QueryResult;
@@ -551,7 +551,7 @@
 						final Integer unitNo = Arrays.binarySearch(unites, unit)+1;
 
 						MenuItem item = new MenuItem(menu, SWT.NONE);
-						AbstractCqiClient CQI = CQPEngine.getCqiClient();
+						AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 						try {
 							if (unit.getDeb() == unit.getFin()) {
 								String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[]{unit.getDeb()});
@@ -581,7 +581,7 @@
 	}
 
 	public String uniteToWords(Unite unit) {
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		String[] firstWords = null;
 		try {
 			if (unit.getDeb() == unit.getFin()) {
@@ -618,7 +618,7 @@
 				editor.removeFontWeightWordsById(previousSelectedTypeUnitIDS);
 				previousSelectedTypeUnitIDS = null; // release memory
 			}
-			String ids2[] = CQPEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
+			String ids2[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
 			previousSelectedTypeUnitIDS = Arrays.asList(ids2);
 
 			editor.addHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
@@ -655,13 +655,13 @@
 				previousSelectedUnitIDS = null; // release memory
 			}
 
-			String ids[] = CQPEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
+			String ids[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
 //			System.out.println("Highlight words with ids="+Arrays.toString(ids));
 
 			//positions = new int[]{positions[0]};
 			Property text_id = maincorpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
-			int[] text_strucs = CQPEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
-			String[] text_ids = CQPEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
+			int[] text_strucs = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+			String[] text_ids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
 
 			String firstWordId = ids[0];
 			String firstWordTextId = text_ids[0];
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java	(revision 786)
@@ -39,7 +39,7 @@
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.TxmPreferences;
 import org.txm.rcp.swt.dialog.ConfirmDialog;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.QueryResult;
@@ -510,7 +510,7 @@
 					editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
 					previousSelectedSchemaIDS = null; // release memory
 				}
-				String ids2[] = CQPEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
+				String ids2[] = CQPSearchEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
 				previousSelectedSchemaIDS = Arrays.asList(ids2);
 
 				editor.addHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
@@ -537,13 +537,13 @@
 				previousSelectedUniteIDS = null; // release memory
 			}
 
-			String ids[] = CQPEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
+			String ids[] = CQPSearchEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
 			//System.out.println("Highlight words with ids="+Arrays.toString(ids));
 
 			positions = new int[]{positions[0]};
 			Property text_id = c.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
-			int[] text_strucs = CQPEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
-			String[] text_ids = CQPEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
+			int[] text_strucs = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+			String[] text_ids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
 
 			String firstWordId = ids[0];
 			String firstWordTextId = text_ids[0];
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/imports/AnalecAnnotationsImporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/imports/AnalecAnnotationsImporter.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/imports/AnalecAnnotationsImporter.java	(revision 786)
@@ -20,7 +20,7 @@
 import org.txm.Toolbox;
 import org.txm.importer.graal.PersonalNamespaceContext;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.QueryResult;
 import org.txm.searchengine.cqp.corpus.query.Query;
@@ -134,7 +134,7 @@
 	}
 
 	private List<Integer> processText(String textid, File xmlTXMFile) throws Exception {
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		// N unit, N unit error, N unit no match error, N unit too much match error, N Relation, N Relation error, N Schema, N Schema error
 		int nUnitsAdded = 0;
 		int nUnitsError = 0;
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/imports/DOMAnalecAnnotationsImporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/imports/DOMAnalecAnnotationsImporter.java	(revision 785)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/imports/DOMAnalecAnnotationsImporter.java	(revision 786)
@@ -10,7 +10,7 @@
 import org.txm.Toolbox;
 import org.txm.importer.graal.PersonalNamespaceContext;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.utils.xml.DomUtils;
 import org.w3c.dom.Document;
@@ -71,7 +71,7 @@
 	}
 
 	private void processText(String textid, File xmlAnalec) throws Exception {
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 
 		HashMap<String, HashMap<String, String>> elementProperties = new HashMap<String, HashMap<String, String>>();
 
Index: tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java
===================================================================
--- tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java	(revision 785)
+++ tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java	(revision 786)
@@ -20,7 +20,7 @@
 import org.txm.index.core.functions.Index;
 import org.txm.index.core.functions.Line;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
@@ -352,7 +352,7 @@
 	private ArrayList<Match> buildMatches_CQI(String[] strings) throws CqiClientException, IOException, CqiServerError {
 		boolean debug = false;
 		ArrayList<Match> matches = new ArrayList<Match>();
-		AbstractCqiClient CQI = CQPEngine.getCqiClient();
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		Property idProperty = getCorpus().getProperty("id");
 
 		if (debug) System.out.println("Call CQI.str2Id with strings.len="+strings.length);
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 785)
+++ tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java	(revision 786)
@@ -91,7 +91,7 @@
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Partition;
@@ -403,7 +403,7 @@
 					} catch (Exception e) {
 						System.out.println(e.getLocalizedMessage());
 						try {
-							System.out.println(TXMUIMessages.LastCQPError + CQPEngine.getCqiClient().getLastCQPError());
+							System.out.println(TXMUIMessages.LastCQPError + CQPSearchEngine.getCqiClient().getLastCQPError());
 						} catch (Exception e1) {
 							System.out.println(IndexUIMessages.IndexEditor_10+e1);
 						}
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreateSubCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreateSubCorpus.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreateSubCorpus.java	(revision 786)
@@ -45,7 +45,7 @@
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Subcorpus;
@@ -147,7 +147,7 @@
 						Log.severe(e.toString());
 						
 						try {
-							System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+							System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 						} catch (Exception e1) {
 							System.out.println(TXMUIMessages.CreateSubCorpus_2+e1);
 							org.txm.rcp.utils.Logger.printStackTrace(e1);
Index: tmp/org.txm.annotation.core/src/org/txm/annotation/core/CQPAnnotationManager.java
===================================================================
--- tmp/org.txm.annotation.core/src/org/txm/annotation/core/CQPAnnotationManager.java	(revision 785)
+++ tmp/org.txm.annotation.core/src/org/txm/annotation/core/CQPAnnotationManager.java	(revision 786)
@@ -10,7 +10,7 @@
 import org.txm.annotation.core.repository.AnnotationType;
 import org.txm.annotation.core.repository.KnowledgeRepository;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -122,15 +122,15 @@
 			AnnotationType sup_type = supList.get(sup);
 			if (sup_type != null) sup_name = sup_type.getId();
 			
-			int Nstruct = CQPEngine.getCqiClient().attributeSize(sup.getQualifiedName());
+			int Nstruct = CQPSearchEngine.getCqiClient().attributeSize(sup.getQualifiedName());
 
 			//TODO: can optimize this, to fetch only structure that matches
 			int[] iStructs = new int[Nstruct];
 			for (int iStruct = 0; iStruct < Nstruct; iStruct++) iStructs[iStruct] = iStruct;
-			String svalues[] = CQPEngine.getCqiClient().struc2Str(sup.getQualifiedName(), iStructs); // one position
+			String svalues[] = CQPSearchEngine.getCqiClient().struc2Str(sup.getQualifiedName(), iStructs); // one position
 
 			for (int iStruct = 0; iStruct < Nstruct; iStruct++) {
-				int smatch[] = CQPEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+				int smatch[] = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
 
 				if (value != null) { // supplementary test if value is specified
 					if (!value.equals(svalues[iStruct])) {
@@ -194,7 +194,7 @@
 		Property prop = corpus.getProperty(type.getId().toLowerCase());
 		if (prop == null) return nullAnnotationList(matches.size()); // no property, no annotation :)
 
-		AbstractCqiClient cqi = CQPEngine.getCqiClient();
+		AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
 		
 		int positions[] = new int[matches.size()];
 		int i = 0;
@@ -231,7 +231,7 @@
 		StructuralUnitProperty sup = su.getProperty(REF);
 		if (sup == null) return nullAnnotationList(matches.size()); // no attribute REF, no annotation :)
 
-		int Nstruct = CQPEngine.getCqiClient().attributeSize(sup.getQualifiedName());
+		int Nstruct = CQPSearchEngine.getCqiClient().attributeSize(sup.getQualifiedName());
 		int iMatch = 0;
 		int iStruct = 0;
 		int Nmatches = matches.size();
@@ -241,7 +241,7 @@
 		if (Nstruct == 0) return new ArrayList<Annotation>(matches.size()); // no annotation
 		//System.out.println("NUMBER OF STRUCT "+sup+" "+Nstruct);
 		//System.out.println("MATCHES "+matches);
-		int smatch[] = CQPEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+		int smatch[] = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
 		//System.out.println(" TEST WITH "+smatch[0]+"-"+smatch[1]);
 		if (overlap) {
 			for (iMatch = 0 ; iStruct < Nstruct && iMatch < Nmatches; ) {
@@ -250,7 +250,7 @@
 				if(smatch[1] < m.getStart()) { // next struct
 					iStruct++;
 					if (iStruct < Nstruct)
-						smatch = CQPEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+						smatch = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
 					//System.out.println(" NEXT STRUCT TEST WITH "+smatch[0]+"-"+smatch[1]);
 				} else if (m.getEnd() < smatch[0]) { // next match
 					values.add(null);
@@ -276,11 +276,11 @@
 					iMatch++;
 					iStruct++;
 					if (iStruct < Nstruct)
-						smatch = CQPEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+						smatch = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
 				} else if(smatch[1] < m.getStart()) { // next struct
 					iStruct++;
 					if (iStruct < Nstruct)
-						smatch = CQPEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
+						smatch = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
 				} else if (m.getEnd() < smatch[0]) { // next match
 					values.add(null);
 					annotationsStartEnd.add(null);
@@ -303,7 +303,7 @@
 			}
 		}
 
-		String[] svalues = CQPEngine.getCqiClient().struc2Str(sup.getQualifiedName(), tmp_strucs);
+		String[] svalues = CQPSearchEngine.getCqiClient().struc2Str(sup.getQualifiedName(), tmp_strucs);
 		ArrayList<Annotation> annotations = new ArrayList<Annotation>();
 		for (int i = 0 ; i < values.size() ; i++) { // remove the fake values
 			if (values.get(i) == null) {
@@ -342,12 +342,12 @@
 		StructuralUnitProperty sup = su.getProperty(REF);
 		if (sup == null) return null;
 		int[] cpos = {start, end};
-		int[] struc = CQPEngine.getCqiClient().cpos2Struc(sup.getQualifiedName(), cpos);
+		int[] struc = CQPSearchEngine.getCqiClient().cpos2Struc(sup.getQualifiedName(), cpos);
 
 		if (struc[0] >= 0) {
 			System.out.println("struct for positions "+start+"-"+end+" -> "+struc[0]+"-"+struc[1]);
 			if (struc[0] == struc[1]) { // même structure
-				String[] struc_str = CQPEngine.getCqiClient().struc2Str(sup.getQualifiedName(), struc);
+				String[] struc_str = CQPSearchEngine.getCqiClient().struc2Str(sup.getQualifiedName(), struc);
 				return struc_str[0];
 			} else { // should not happens
 				System.out.println("WARNING: FOUND EXISTING ANNOTATION FOR TYPE="+type+" START="+start+" END="+end);
Index: tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java
===================================================================
--- tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java	(revision 785)
+++ tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java	(revision 786)
@@ -6,6 +6,7 @@
 import org.txm.core.engines.EngineType;
 import org.txm.core.engines.EnginesManager;
 
+//FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
 public class AnnotationEnginesManager extends EnginesManager<AnnotationEngine> {
 	
 	public AnnotationEnginesManager() {
Index: tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java
===================================================================
--- tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java	(revision 785)
+++ tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java	(revision 786)
@@ -2,6 +2,7 @@
 
 import org.txm.core.engines.Engine;
 
+//FIXME: useless class
 public abstract class AnnotationEngine implements Engine {
 
 	public static final String EXTENSION_POINT_ID = AnnotationEngine.class.getCanonicalName();
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java	(revision 785)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java	(revision 786)
@@ -14,6 +14,7 @@
  * @author sjacquot
  *
  */
+//FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
 public class ChartsEnginesManager extends EnginesManager<ChartsEngine> {
 
 	@Override
@@ -39,7 +40,7 @@
 		
 		this.setCurrentEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE));
 		
-		TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
+		//TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
 
 		return true;
 	}
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java	(revision 785)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java	(revision 786)
@@ -75,6 +75,11 @@
 	//FIXME: this preference is not used at this time, see if it's useless or not.
 	protected boolean directComputing; 
 
+	
+	static	{
+		TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
+	}
+	
 	/**
 	 * Creates a charts engine with the specified name, description and output format.
 	 * @param name
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPEngine.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPEngine.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPEngine.java	(revision 786)
@@ -1,403 +0,0 @@
-package org.txm.searchengine.cqp;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-import org.txm.Toolbox;
-import org.txm.core.engines.EngineType;
-import org.txm.core.messages.TXMCoreMessages;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.importer.cwb.PatchCwbRegistry;
-import org.txm.libs.cqp.CQPLibPreferences;
-import org.txm.objects.Base;
-import org.txm.searchengine.core.SearchEngine;
-import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
-import org.txm.searchengine.cqp.corpus.CorpusManager;
-import org.txm.searchengine.cqp.corpus.MainCorpus;
-import org.txm.utils.OSDetector;
-import org.txm.utils.Sh;
-import org.txm.utils.logger.Log;
-import org.w3c.dom.Element;
-
-public class CQPEngine extends SearchEngine {
-
-	/**
-	 * initialization state
-	 */
-	boolean state = false;
-	boolean useNetCQi = false;
-
-	@Override
-	public String getName() {
-		return "CQP";
-	}
-
-	/**
-	 * Starts the corpus engine if not remove then launch cqpserver.
-	 *
-	 * @return true, if successful
-	 */
-	public boolean start(IProgressMonitor monitor) throws Exception {
-
-		if (monitor != null) monitor.subTask("Starting Corpus Engine...");
-
-		boolean cqiserverok = false;
-
-		useNetCQi = Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_NETWORK_MODE, CQPLibPreferences.PREFERENCES_NODE));
-
-		Log.warning("Killing CQP and RServe process if any");
-		killSearchEngine();
-
-
-		boolean remote = Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_IS_REMOTE, CQPLibPreferences.PREFERENCES_NODE));
-		state = false;
-		// test if must-have properties for CWB are set
-
-
-		String reg_path = ""; // new way that concats registry of loaded corpus
-		String path_separator = System.getProperty("path.separator");
-		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
-			File binDir = b.getBaseDirectory();
-			File registryDir = new File(binDir, "registry");
-			reg_path += path_separator + registryDir.getAbsolutePath();
-			File[] files = registryDir.listFiles();
-			if (files != null)
-				for (File registryFile : files) {
-					if (registryFile.isHidden()) continue;
-					if (registryFile.isDirectory()) continue;
-
-					File dataDirectory = new File(binDir, "data/"+registryFile.getName().toUpperCase());
-					if (!dataDirectory.exists())dataDirectory = new File(binDir, "data"); // eventual old corpus
-					try {
-						PatchCwbRegistry.patch(registryFile, dataDirectory);
-					} catch (IOException e) {
-						System.out.println("Error while updating registry file "+registryFile+": "+e);
-						Log.printStackTrace(e);
-						return false;
-					}
-				}
-		}
-		if (reg_path.length() > 0) reg_path = reg_path.substring(path_separator.length()); // remove first path_separator
-		reg_path = reg_path.replace("\\\\", "//"); // fix the UNC paths for mingw
-
-		String init_path = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, CQPLibPreferences.PREFERENCES_NODE);
-
-
-		if (!remote) {
-
-			if (!useNetCQi) {
-				try {
-					cqiServer = new MemCqiServer(reg_path, 
-							init_path, 
-							TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, CQPLibPreferences.PREFERENCES_NODE)
-							+ " -P " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE), //$NON-NLS-1$
-							Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT, CQPLibPreferences.PREFERENCES_NODE)));
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					org.txm.utils.logger.Log.printStackTrace(e);
-				}
-			} else {
-
-				String exec_path = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, CQPLibPreferences.PREFERENCES_NODE);
-
-				if (exec_path == null || exec_path.length() == 0) {
-					System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
-				}
-				if (new File(exec_path).exists()) {
-					System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
-				}
-
-				cqiServer = new NetCqiServer(exec_path,
-						reg_path, 
-						init_path, 
-						TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, CQPLibPreferences.PREFERENCES_NODE)
-						+ " -P " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE), //$NON-NLS-1$
-						Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT, CQPLibPreferences.PREFERENCES_NODE)));
-			}
-
-			if (cqiServer != null)
-				cqiserverok = cqiServer.start();
-
-		}
-
-		// create cqi client
-		try {
-			if (cqiserverok) {
-				if (!useNetCQi) {
-					try {
-						cqiClient = new MemCqiClient((MemCqiServer) cqiServer);
-					} catch(Exception e) {
-						Log.severe(TXMCoreMessages.Toolbox_28+e);
-						cqiserverok = false;
-					}
-				} else {
-					int port = Integer.parseInt(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE));
-					String host = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE);
-					cqiClient = new NetCqiClient(host, port);
-				}
-			}
-		} catch (NumberFormatException e1) {
-			Log.severe(TXMCoreMessages.Toolbox_wrong_port + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE)); 
-		} catch (ServerNotFoundException e1) {
-			Log.severe(TXMCoreMessages.Error_CONNECTION_FAILED + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE)
-					+ TXMCoreMessages.Toolbox_27 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE)); 
-		}
-
-		// try connecting to the CWB server
-		try {
-			if (cqiserverok) {
-				String login = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_LOGIN, CQPLibPreferences.PREFERENCES_NODE);
-				String password = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PASSWORD, CQPLibPreferences.PREFERENCES_NODE);
-				state = cqiClient.connect(login, password);
-			}
-		} catch (Exception e1) {
-			Log.severe(Log.toString(e1));
-		}
-
-		if (state == false) {
-			System.out.println(TXMCoreMessages.Toolbox_29); 
-			if (cqiClient instanceof NetCqiClient) System.out.println(TXMCoreMessages.Toolbox_30 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_LOGIN, CQPLibPreferences.PREFERENCES_NODE) + " " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PASSWORD, CQPLibPreferences.PREFERENCES_NODE) + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE) + " " + Integer.parseInt(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE))); //$NON-NLS-1$ //$NON-NLS-2$
-			if (cqiServer != null && cqiServer instanceof NetCqiServer)
-				System.out.println(TXMCoreMessages.Toolbox_33 + cqiServer.getLastCmdLine());
-		} else {
-			if (cqiServer == null || cqiServer instanceof NetCqiServer)
-				System.out.println(TXMCoreMessages.Toolbox_connected_to_corpus_sever); 
-		}
-
-		CorpusManager.setCqiClient(cqiClient);
-
-		// wait for CQPSERVER TO BE READY
-		int scount = 0;
-		try {
-			CorpusManager.getCorpusManager().getCorpora();
-			do {
-				Thread.sleep(100);
-				CorpusManager.cleanCorpora();// to be sure to call cqpserver
-				CorpusManager.getCorpusManager().getCorpora();
-				scount++;
-				if (scount >= 10) {
-					Log.warning(TXMCoreMessages.Toolbox_17); 
-					break;
-				}
-			} while (CorpusManager.getCorpusManager().getCorpora().size() == 0);
-		} catch (Exception e) {
-			org.txm.utils.logger.Log.printStackTrace(e);
-			Log.severe(TXMCoreMessages.Toolbox_18 + e);
-		} 
-
-		if (Toolbox.workspace == null) {
-			System.out.println("Can't start CQP with workspace not ready.");
-			return false;
-		}
-
-		// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
-		System.out.print(TXMCoreMessages.Toolbox_workspace_init);
-		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
-			if (!loadCQPCorpora(b, monitor)) {
-				System.out.println("Failed to load CQP corpora of "+b.getName()+" corpus.");
-			}
-		}
-		
-		System.out.println(TXMCoreMessages.common_done);
-
-		return state;
-	}
-
-	public boolean loadCQPCorpora(Base base, IProgressMonitor monitor) {
-		//System.out.println("Load corpus from params: "+params.corpora);
-		for (String corpusname : base.getBaseParameters().corpora.keySet()) {
-			Element c = base.getBaseParameters().corpora.get(corpusname);
-			try {
-				MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
-				if (monitor != null) monitor.subTask("Loading "+corp+" subcorpora and partitions...");
-				corp.setSelfElement(c);
-				corp.setParent(base);
-				corp.load(); // don't load corpus right now, wait for the search engine to be ready
-				base.addChild(corp);
-				if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$
-					corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$
-				}
-			} catch (Exception e) {
-				System.out.println(e.getLocalizedMessage());
-				org.txm.utils.logger.Log.printStackTrace(e);
-				return false;
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean initialize() {
-		// all initialization done in the start method because we need CQP executable/lib to restart from the beginning
-		return true;
-	}
-
-	/** The CQI server. */
-	private static AbstractCqiServer cqiServer;
-
-	/** The CQI client. */
-	private static AbstractCqiClient cqiClient;
-
-	/**
-	 * Sets the CQI server.
-	 *
-	 * @param cqiServer the new cqi server
-	 */
-	public static void setCqiServer(AbstractCqiServer cqiServer) {
-		CQPEngine.cqiServer = cqiServer;
-	}
-
-	/**
-	 * Gets the cqi client.
-	 *
-	 * @return the cqi client
-	 */
-	public static AbstractCqiClient getCqiClient() {
-		return cqiClient;
-	}
-
-	/**
-	 * Sets the cqi client.
-	 *
-	 * @param cqiClient the new cqi client
-	 */
-	public static void setCqiClient(NetCqiClient cqiClient) {
-		CQPEngine.cqiClient = cqiClient;
-	}
-
-	/**
-	 * Gets the CQI server.
-	 *
-	 * @return the CQI server
-	 */
-	public static AbstractCqiServer getCqiServer() {
-		return cqiServer;
-	}
-
-	/**
-	 * Shut the toolbox searchengine down.
-	 */
-	public boolean stop() {
-		try {
-			if (cqiClient instanceof MemCqiClient) {
-				try  {
-				} catch(Exception e) {}
-				for (String name : ((MemCqiClient)cqiClient).listCorpora()) {
-					((MemCqiClient)cqiClient).dropCorpus(name);
-				}
-			}
-			cqiClient.disconnect();
-			cqiServer.stop();
-
-			CorpusManager.clean();
-			if (cqiServer instanceof NetCqiServer)
-				killSearchEngine();
-
-			state = false;
-		} catch (Exception e) {
-			Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
-			return false;
-		}
-		return true;
-	}
-
-	/**
-	 * kill cqpserver process.
-	 */
-	private static void killSearchEngine() {
-		if (!TXMPreferences.getBoolean(CQPLibPreferences.CQI_SERVER_IS_REMOTE, CQPLibPreferences.PREFERENCES_NODE))
-			// Windows OS
-			if (OSDetector.isFamilyWindows()) {
-				try {
-					Process p = Runtime.getRuntime().exec(
-							"taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
-					p.waitFor();
-					p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
-					p.waitFor();
-				} catch (IOException e) {
-					Log.severe(TXMCoreMessages.Toolbox_31+Log.toString(e));
-					System.out.println(TXMCoreMessages.Toolbox_31+Log.toString(e));
-					try {
-						Process p = Runtime.getRuntime().exec(
-								"tskill cqpserver.exe"); //$NON-NLS-1$
-						p.waitFor();
-						p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$
-						p.waitFor();
-					} catch (IOException e2) {
-						Log.severe(TXMCoreMessages.Toolbox_34+Log.toString(e2));
-						System.out.println(TXMCoreMessages.Toolbox_34+Log.toString(e2));
-					} catch (InterruptedException e3) {
-						Log.severe(Log.toString(e3));
-						System.out.println(Log.toString(e3));
-					}
-				} catch (InterruptedException e) {
-					Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
-					System.out.println(Log.toString(e));
-				}
-				;
-			}
-		// Mac, Linux
-			else {
-				String cmd = TXMCoreMessages.Toolbox_37 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE) + TXMCoreMessages.Toolbox_38;
-				try {
-					//Process p = Runtime.getRuntime().exec("killall -9 cqpserver"); //$NON-NLS-1$
-					// System.out.println("kill `ps aux | grep cqpserver | awk '/-P "
-					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
-					// String[] args =
-					// {"kill","`ps aux | grep cqpserver | awk '/-P " +
-					// TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`"};
-					// System.out.println("before Sh constructor");
-					Sh sh = new Sh(""); //$NON-NLS-1$
-					// System.out.println("after Sh constructor");
-					// System.out.println("EXECUTE SH : "+"kill `ps aux | grep cqpserver | awk '/-P "
-					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
-					sh.setIsc(cmd);
-					sh.sh();
-					// Runtime.getRuntime().exec("sh kill `ps aux | grep cqpserver | awk '/-P "
-					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
-
-				} catch (Exception e) {
-					Log.severe(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
-					System.out.println(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
-					org.txm.utils.logger.Log.printStackTrace(e);
-				}
-			}
-	}
-
-	/**
-	 * Restart the toolbox's searchengine.
-	 *
-	 * @return true, if successful
-	 */
-	public boolean restart() {
-		try {
-			boolean ret = stop();
-			Thread.sleep(10);
-			ret = ret && start(null);
-			return ret;
-		} catch (Exception e) {
-			Log.severe("Error while restarting CQP: "+e.getLocalizedMessage());
-		}
-		return false;
-	}
-
-	/**
-	 * test if searchEngine is initialized.
-	 *
-	 * @return true, if is initialized
-	 */
-	public static boolean isInitialized() {
-		return Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP").getState();
-	}
-
-	@Override
-	public boolean getState() {
-		return state;
-	}
-}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java	(revision 786)
@@ -10,7 +10,7 @@
 import org.txm.objects.Edition;
 import org.txm.objects.Page;
 import org.txm.objects.Text;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.QueryResult;
@@ -76,8 +76,8 @@
 			result.drop();
 			//System.out.println("starts: "+Arrays.toString(starts));
 			//System.out.println("ends: "+Arrays.toString(ends));
-			int[] strcutpos = CQPEngine.getCqiClient().cpos2Struc(properties.get(j).getQualifiedName(), starts);
-			String[] infos = CQPEngine.getCqiClient().struc2Str(properties.get(j).getQualifiedName(), strcutpos);
+			int[] strcutpos = CQPSearchEngine.getCqiClient().cpos2Struc(properties.get(j).getQualifiedName(), starts);
+			String[] infos = CQPSearchEngine.getCqiClient().struc2Str(properties.get(j).getQualifiedName(), strcutpos);
 			//allMatches.put(suname, list);
 			if (starts.length != ends.length) {
 				System.out.println(suname+": starts.length "+starts.length+" != ends.length "+ends.length); //$NON-NLS-1$ //$NON-NLS-2$
@@ -165,9 +165,9 @@
 		StructuralUnitProperty text_id = corpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
 		Property w_id =  corpus.getProperty("id"); //$NON-NLS-1$
 		int[] positions = {node.getStart()};
-		final String[] wordids = CQPEngine.getCqiClient().cpos2Str(w_id.getQualifiedName(), positions);
-		int[] textidstruct = CQPEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
-		String[] textids = CQPEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), textidstruct);
+		final String[] wordids = CQPSearchEngine.getCqiClient().cpos2Str(w_id.getQualifiedName(), positions);
+		int[] textidstruct = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+		String[] textids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), textidstruct);
 
 		if (wordids.length == 1 && textids.length == 1) {
 			Text text = corpus.getText(textids[0]);
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 786)
@@ -45,7 +45,7 @@
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.results.TXMResult;
 import org.txm.objects.TxmObject;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.query.Query;
 import org.txm.searchengine.cqp.corpus.query.QueryPart;
@@ -287,7 +287,7 @@
 			
 		} catch (Exception e) {
 			try {
-				throw new CqiClientException(TXMCoreMessages.Partition_9 + partitionName + "_" + partName + e + " last error: " + CQPEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
+				throw new CqiClientException(TXMCoreMessages.Partition_9 + partitionName + "_" + partName + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
 			} catch (Exception e1) {
 				System.out.println(TXMCoreMessages.Partition_18+e1);
 				org.txm.utils.logger.Log.printStackTrace(e1);
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 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 786)
@@ -45,7 +45,7 @@
 import org.txm.objects.Text;
 import org.txm.objects.TxmObject;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
 import org.txm.searchengine.cqp.corpus.query.Match;
@@ -387,7 +387,7 @@
 	 */
 	public boolean removeFromCWB() {
 		try {
-			if (CQPEngine.isInitialized()) {
+			if (CQPSearchEngine.isInitialized()) {
 				this.dropAllSubcorpora();
 				this.dropAllPartitions();
 			}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 786)
@@ -7,7 +7,7 @@
 import org.txm.Toolbox;
 import org.txm.objects.Edition;
 import org.txm.objects.Page;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
 import org.txm.searchengine.cqp.corpus.query.Match;
@@ -64,8 +64,8 @@
 		{
 			QueryResult rez = src.query(new Query("[_.text_id=\""+textid+"\" & id=\""+wordid+"\"]"), "Align", false);
 			int[] position = {rez.getMatch(0).getStart()};
-			int[] struct_align_pos = CQPEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
-			String[] struct_align_str = CQPEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
 			if(struct_align_str.length > 0)
 			{
 				String aligned_struct = struct_align_str[0]; // the struct align value
@@ -73,8 +73,8 @@
 				QueryResult rez2 = dest.query(new Query("<"+struct+"_align=\""+aligned_struct+"\">[]"), "Align", false);
 				int[] position2 = {rez2.getMatch(0).getStart()};
 				// get the id of this position
-				int[] struct_text_pos = CQPEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
-				String[] struct_text_str = CQPEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+				int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+				String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
 				return Arrays.asList(wordid, struct_text_str[0]);
 			}
 			else
@@ -91,8 +91,8 @@
 			//System.out.println(rez.getMatches());
 			int[] position = {rez.getMatch(0).getStart()};
 			//get the struct@align value for this position
-			int[] struct_align_pos = CQPEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
-			String[] struct_align_str = CQPEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
 			if(struct_align_str.length > 0)
 			{
 				String aligned_struct = struct_align_str[0]; // the struct align value
@@ -101,12 +101,12 @@
 				QueryResult rez2 = dest.query(new Query(query), "Align", false);
 				int[] position2 = {rez2.getMatch(0).getStart()};
 				// get the id of this position
-				String[] ids = CQPEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position2);
+				String[] ids = CQPSearchEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position2);
 
 				if(ids.length > 0)
 				{
-					int[] struct_text_pos = CQPEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
-					String[] struct_text_str = CQPEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+					int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+					String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
 					return Arrays.asList(ids[0], struct_text_str[0]);
 				}
 				else
@@ -146,8 +146,8 @@
 		Corpus src = CorpusManager.getCorpusManager().getCorpus(from);
 		StructuralUnitProperty align_src = src.getStructuralUnit(struct).getProperty("align");
 		int[] position = {idx};
-		int[] struct_align_pos = CQPEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
-		String[] struct_align_str = CQPEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+		int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+		String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
 		if (struct_align_str.length > 0) {
 			return resolveSeg(struct_align_str[0]);
 		}
@@ -166,12 +166,12 @@
 		int[] position = {rez.getMatch(0).getStart()};
 
 		Property id_dest = dest.getProperty("id");
-		String[] ids = CQPEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position);
+		String[] ids = CQPSearchEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position);
 		String wordid = ids[0];
 
 		StructuralUnitProperty text_dest = dest.getStructuralUnit("text").getProperty("id");
-		int[] struct_text_pos = CQPEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position);
-		String[] struct_text_str = CQPEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+		int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position);
+		String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
 		String textid = struct_text_str[0];
 		
 		return Arrays.asList(wordid, textid);
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 786)
@@ -33,7 +33,7 @@
 import org.txm.Toolbox;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.NetCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
@@ -215,9 +215,9 @@
 	public static void deleteCorpus(MainCorpus corpus) {
 		if (corpora != null)
 			corpora.remove(corpus);
-		if (CQPEngine.isInitialized()) {
+		if (CQPSearchEngine.isInitialized()) {
 			try {
-				CQPEngine.getCqiClient().dropCorpus(corpus.getName());
+				CQPSearchEngine.getCqiClient().dropCorpus(corpus.getName());
 			} catch (Exception e) {
 				Log.warning("Warning while removing corpus: Failed to drop corpus "+corpus);
 				Log.printStackTrace(e);
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 0)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 786)
@@ -0,0 +1,403 @@
+package org.txm.searchengine.cqp;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.objects.Base;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.OSDetector;
+import org.txm.utils.Sh;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+
+public class CQPSearchEngine extends SearchEngine {
+
+	/**
+	 * initialization state
+	 */
+	boolean state = false;
+	boolean useNetCQi = false;
+
+	@Override
+	public String getName() {
+		return "CQP";
+	}
+
+	/**
+	 * Starts the corpus engine if not remove then launch cqpserver.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean start(IProgressMonitor monitor) throws Exception {
+
+		if (monitor != null) monitor.subTask("Starting Corpus Engine...");
+
+		boolean cqiserverok = false;
+
+		useNetCQi = Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_NETWORK_MODE, CQPLibPreferences.PREFERENCES_NODE));
+
+		Log.warning("Killing CQP and RServe process if any");
+		killSearchEngine();
+
+
+		boolean remote = Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_IS_REMOTE, CQPLibPreferences.PREFERENCES_NODE));
+		state = false;
+		// test if must-have properties for CWB are set
+
+
+		String reg_path = ""; // new way that concats registry of loaded corpus
+		String path_separator = System.getProperty("path.separator");
+		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
+			File binDir = b.getBaseDirectory();
+			File registryDir = new File(binDir, "registry");
+			reg_path += path_separator + registryDir.getAbsolutePath();
+			File[] files = registryDir.listFiles();
+			if (files != null)
+				for (File registryFile : files) {
+					if (registryFile.isHidden()) continue;
+					if (registryFile.isDirectory()) continue;
+
+					File dataDirectory = new File(binDir, "data/"+registryFile.getName().toUpperCase());
+					if (!dataDirectory.exists())dataDirectory = new File(binDir, "data"); // eventual old corpus
+					try {
+						PatchCwbRegistry.patch(registryFile, dataDirectory);
+					} catch (IOException e) {
+						System.out.println("Error while updating registry file "+registryFile+": "+e);
+						Log.printStackTrace(e);
+						return false;
+					}
+				}
+		}
+		if (reg_path.length() > 0) reg_path = reg_path.substring(path_separator.length()); // remove first path_separator
+		reg_path = reg_path.replace("\\\\", "//"); // fix the UNC paths for mingw
+
+		String init_path = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, CQPLibPreferences.PREFERENCES_NODE);
+
+
+		if (!remote) {
+
+			if (!useNetCQi) {
+				try {
+					cqiServer = new MemCqiServer(reg_path, 
+							init_path, 
+							TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, CQPLibPreferences.PREFERENCES_NODE)
+							+ " -P " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE), //$NON-NLS-1$
+							Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT, CQPLibPreferences.PREFERENCES_NODE)));
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			} else {
+
+				String exec_path = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, CQPLibPreferences.PREFERENCES_NODE);
+
+				if (exec_path == null || exec_path.length() == 0) {
+					System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
+				}
+				if (new File(exec_path).exists()) {
+					System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
+				}
+
+				cqiServer = new NetCqiServer(exec_path,
+						reg_path, 
+						init_path, 
+						TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, CQPLibPreferences.PREFERENCES_NODE)
+						+ " -P " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE), //$NON-NLS-1$
+						Boolean.parseBoolean(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT, CQPLibPreferences.PREFERENCES_NODE)));
+			}
+
+			if (cqiServer != null)
+				cqiserverok = cqiServer.start();
+
+		}
+
+		// create cqi client
+		try {
+			if (cqiserverok) {
+				if (!useNetCQi) {
+					try {
+						cqiClient = new MemCqiClient((MemCqiServer) cqiServer);
+					} catch(Exception e) {
+						Log.severe(TXMCoreMessages.Toolbox_28+e);
+						cqiserverok = false;
+					}
+				} else {
+					int port = Integer.parseInt(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE));
+					String host = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE);
+					cqiClient = new NetCqiClient(host, port);
+				}
+			}
+		} catch (NumberFormatException e1) {
+			Log.severe(TXMCoreMessages.Toolbox_wrong_port + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE)); 
+		} catch (ServerNotFoundException e1) {
+			Log.severe(TXMCoreMessages.Error_CONNECTION_FAILED + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE)
+					+ TXMCoreMessages.Toolbox_27 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE)); 
+		}
+
+		// try connecting to the CWB server
+		try {
+			if (cqiserverok) {
+				String login = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_LOGIN, CQPLibPreferences.PREFERENCES_NODE);
+				String password = TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PASSWORD, CQPLibPreferences.PREFERENCES_NODE);
+				state = cqiClient.connect(login, password);
+			}
+		} catch (Exception e1) {
+			Log.severe(Log.toString(e1));
+		}
+
+		if (state == false) {
+			System.out.println(TXMCoreMessages.Toolbox_29); 
+			if (cqiClient instanceof NetCqiClient) System.out.println(TXMCoreMessages.Toolbox_30 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_LOGIN, CQPLibPreferences.PREFERENCES_NODE) + " " + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PASSWORD, CQPLibPreferences.PREFERENCES_NODE) + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_HOST, CQPLibPreferences.PREFERENCES_NODE) + " " + Integer.parseInt(TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE))); //$NON-NLS-1$ //$NON-NLS-2$
+			if (cqiServer != null && cqiServer instanceof NetCqiServer)
+				System.out.println(TXMCoreMessages.Toolbox_33 + cqiServer.getLastCmdLine());
+		} else {
+			if (cqiServer == null || cqiServer instanceof NetCqiServer)
+				System.out.println(TXMCoreMessages.Toolbox_connected_to_corpus_sever); 
+		}
+
+		CorpusManager.setCqiClient(cqiClient);
+
+		// wait for CQPSERVER TO BE READY
+		int scount = 0;
+		try {
+			CorpusManager.getCorpusManager().getCorpora();
+			do {
+				Thread.sleep(100);
+				CorpusManager.cleanCorpora();// to be sure to call cqpserver
+				CorpusManager.getCorpusManager().getCorpora();
+				scount++;
+				if (scount >= 10) {
+					Log.warning(TXMCoreMessages.Toolbox_17); 
+					break;
+				}
+			} while (CorpusManager.getCorpusManager().getCorpora().size() == 0);
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			Log.severe(TXMCoreMessages.Toolbox_18 + e);
+		} 
+
+		if (Toolbox.workspace == null) {
+			System.out.println("Can't start CQP with workspace not ready.");
+			return false;
+		}
+
+		// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
+		System.out.print(TXMCoreMessages.Toolbox_workspace_init);
+		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
+			if (!loadCQPCorpora(b, monitor)) {
+				System.out.println("Failed to load CQP corpora of "+b.getName()+" corpus.");
+			}
+		}
+		
+		System.out.println(TXMCoreMessages.common_done);
+
+		return state;
+	}
+
+	public boolean loadCQPCorpora(Base base, IProgressMonitor monitor) {
+		//System.out.println("Load corpus from params: "+params.corpora);
+		for (String corpusname : base.getBaseParameters().corpora.keySet()) {
+			Element c = base.getBaseParameters().corpora.get(corpusname);
+			try {
+				MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
+				if (monitor != null) monitor.subTask("Loading "+corp+" subcorpora and partitions...");
+				corp.setSelfElement(c);
+				corp.setParent(base);
+				corp.load(); // don't load corpus right now, wait for the search engine to be ready
+				base.addChild(corp);
+				if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$
+					corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+			} catch (Exception e) {
+				System.out.println(e.getLocalizedMessage());
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+		}
+		return true;
+	}
+
+	@Override
+	public boolean initialize() {
+		// all initialization done in the start method because we need CQP executable/lib to restart from the beginning
+		return true;
+	}
+
+	/** The CQI server. */
+	private static AbstractCqiServer cqiServer;
+
+	/** The CQI client. */
+	private static AbstractCqiClient cqiClient;
+
+	/**
+	 * Sets the CQI server.
+	 *
+	 * @param cqiServer the new cqi server
+	 */
+	public static void setCqiServer(AbstractCqiServer cqiServer) {
+		CQPSearchEngine.cqiServer = cqiServer;
+	}
+
+	/**
+	 * Gets the cqi client.
+	 *
+	 * @return the cqi client
+	 */
+	public static AbstractCqiClient getCqiClient() {
+		return cqiClient;
+	}
+
+	/**
+	 * Sets the cqi client.
+	 *
+	 * @param cqiClient the new cqi client
+	 */
+	public static void setCqiClient(NetCqiClient cqiClient) {
+		CQPSearchEngine.cqiClient = cqiClient;
+	}
+
+	/**
+	 * Gets the CQI server.
+	 *
+	 * @return the CQI server
+	 */
+	public static AbstractCqiServer getCqiServer() {
+		return cqiServer;
+	}
+
+	/**
+	 * Shut the toolbox searchengine down.
+	 */
+	public boolean stop() {
+		try {
+			if (cqiClient instanceof MemCqiClient) {
+				try  {
+				} catch(Exception e) {}
+				for (String name : ((MemCqiClient)cqiClient).listCorpora()) {
+					((MemCqiClient)cqiClient).dropCorpus(name);
+				}
+			}
+			cqiClient.disconnect();
+			cqiServer.stop();
+
+			CorpusManager.clean();
+			if (cqiServer instanceof NetCqiServer)
+				killSearchEngine();
+
+			state = false;
+		} catch (Exception e) {
+			Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * kill cqpserver process.
+	 */
+	private static void killSearchEngine() {
+		if (!TXMPreferences.getBoolean(CQPLibPreferences.CQI_SERVER_IS_REMOTE, CQPLibPreferences.PREFERENCES_NODE))
+			// Windows OS
+			if (OSDetector.isFamilyWindows()) {
+				try {
+					Process p = Runtime.getRuntime().exec(
+							"taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+					p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+				} catch (IOException e) {
+					Log.severe(TXMCoreMessages.Toolbox_31+Log.toString(e));
+					System.out.println(TXMCoreMessages.Toolbox_31+Log.toString(e));
+					try {
+						Process p = Runtime.getRuntime().exec(
+								"tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+						p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+					} catch (IOException e2) {
+						Log.severe(TXMCoreMessages.Toolbox_34+Log.toString(e2));
+						System.out.println(TXMCoreMessages.Toolbox_34+Log.toString(e2));
+					} catch (InterruptedException e3) {
+						Log.severe(Log.toString(e3));
+						System.out.println(Log.toString(e3));
+					}
+				} catch (InterruptedException e) {
+					Log.severe("Error while closing CQP: "+e.getLocalizedMessage());
+					System.out.println(Log.toString(e));
+				}
+				;
+			}
+		// Mac, Linux
+			else {
+				String cmd = TXMCoreMessages.Toolbox_37 + TXMPreferences.getString(CQPLibPreferences.CQI_SERVER_PORT, CQPLibPreferences.PREFERENCES_NODE) + TXMCoreMessages.Toolbox_38;
+				try {
+					//Process p = Runtime.getRuntime().exec("killall -9 cqpserver"); //$NON-NLS-1$
+					// System.out.println("kill `ps aux | grep cqpserver | awk '/-P "
+					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
+					// String[] args =
+					// {"kill","`ps aux | grep cqpserver | awk '/-P " +
+					// TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`"};
+					// System.out.println("before Sh constructor");
+					Sh sh = new Sh(""); //$NON-NLS-1$
+					// System.out.println("after Sh constructor");
+					// System.out.println("EXECUTE SH : "+"kill `ps aux | grep cqpserver | awk '/-P "
+					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
+					sh.setIsc(cmd);
+					sh.sh();
+					// Runtime.getRuntime().exec("sh kill `ps aux | grep cqpserver | awk '/-P "
+					// + TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQI_SERVER_PORT) + "/ {print $2}'`");
+
+				} catch (Exception e) {
+					Log.severe(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
+					System.out.println(TXMCoreMessages.Toolbox_39+cmd+TXMCoreMessages.Toolbox_40+Log.toString(e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+	}
+
+	/**
+	 * Restart the toolbox's searchengine.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean restart() {
+		try {
+			boolean ret = stop();
+			Thread.sleep(10);
+			ret = ret && start(null);
+			return ret;
+		} catch (Exception e) {
+			Log.severe("Error while restarting CQP: "+e.getLocalizedMessage());
+		}
+		return false;
+	}
+
+	/**
+	 * test if searchEngine is initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public static boolean isInitialized() {
+		return Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP").getState();
+	}
+
+	@Override
+	public boolean getState() {
+		return state;
+	}
+}

Property changes on: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.searchengine.cqp.core/plugin.xml
===================================================================
--- tmp/org.txm.searchengine.cqp.core/plugin.xml	(revision 785)
+++ tmp/org.txm.searchengine.cqp.core/plugin.xml	(revision 786)
@@ -4,7 +4,7 @@
    <extension
          point="org.txm.searchengine.core.SearchEngine">
       <SearchEngine
-            class="org.txm.searchengine.cqp.CQPEngine">
+            class="org.txm.searchengine.cqp.CQPSearchEngine">
       </SearchEngine>
    </extension>
    <extension
Index: tmp/org.txm.para.core/src/org/txm/para/core/functions/ParallelContexts.java
===================================================================
--- tmp/org.txm.para.core/src/org/txm/para/core/functions/ParallelContexts.java	(revision 785)
+++ tmp/org.txm.para.core/src/org/txm/para/core/functions/ParallelContexts.java	(revision 786)
@@ -11,7 +11,7 @@
 
 import org.txm.Toolbox;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
@@ -69,8 +69,8 @@
 
 				StructuralUnitProperty align_id = corpus.getStructuralUnit(struct).getProperty(structprop);
 				System.out.println("struct: "+struct+" prop: "+structprop+" -> "+align_id);
-				int[] struct_pos = CQPEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), positions);
-				String[] struct_ids = CQPEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
+				int[] struct_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), positions);
+				String[] struct_ids = CQPSearchEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
 
 				// fill allsegments
 				for (int i = 0 ; i < struct_ids.length ; i++) {
@@ -165,16 +165,16 @@
 				// get the seg that actually are in the corpus
 				QueryResult resul2t = corpus.query(new Query(segquery), "TMP", true);
 				int[] struct_starts = resul2t.getStarts();
-				int[] struct_pos = CQPEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), struct_starts);
-				String[] struct_ids = CQPEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
+				int[] struct_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), struct_starts);
+				String[] struct_ids = CQPSearchEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos);
 
 				//System.out.println("segs: "+Arrays.toString(struct_ids));
 
 				// get ref if asked
 				String[] ref_values = null;
 				if (ref != null) {
-					int[] struct_pos2 = CQPEngine.getCqiClient().cpos2Struc(ref.getQualifiedName(), struct_starts);
-					ref_values = CQPEngine.getCqiClient().struc2Str(ref.getQualifiedName(), struct_pos2);
+					int[] struct_pos2 = CQPSearchEngine.getCqiClient().cpos2Struc(ref.getQualifiedName(), struct_starts);
+					ref_values = CQPSearchEngine.getCqiClient().struc2Str(ref.getQualifiedName(), struct_pos2);
 				}
 				//System.out.println("ref values: "+Arrays.toString(ref_values));
 
Index: tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEnginesManager.java
===================================================================
--- tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEnginesManager.java	(revision 785)
+++ tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEnginesManager.java	(revision 786)
@@ -11,6 +11,7 @@
  * @author sjacquot
  *
  */
+//FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
 public class StatsEnginesManager extends EnginesManager<StatsEngine> {
 
 	public static StatsEngine getREngine() {
Index: tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEngine.java
===================================================================
--- tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEngine.java	(revision 785)
+++ tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEngine.java	(revision 786)
@@ -2,6 +2,7 @@
 
 import org.txm.core.engines.Engine;
 
+//FIXME: useless class
 public abstract class StatsEngine implements Engine {
 
 	public static final String EXTENSION_POINT_ID = "org.txm.statsengine.core.StatsEngine"; //$NON-NLS-1$
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy	(revision 785)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/CreateCQPListMacro.groovy	(revision 786)
@@ -40,7 +40,7 @@
 import org.txm.Toolbox
 import org.txm.searchengine.cqp.*
 
-def CQI = CQPEngine.getCqiClient();
+def CQI = CQPSearchEngine.getCqiClient();
 if ((CQI instanceof NetCqiClient)) {
 	println "Error: only available in CQP memory mode"
 	return;
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy	(revision 785)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/ExecCQPMacro.groovy	(revision 786)
@@ -50,7 +50,7 @@
 import org.txm.searchengine.cqp.*
 
 // Sanity check - Vérification de cohérence
-def CQI = CQPEngine.getCqiClient();
+def CQI = CQPSearchEngine.getCqiClient();
 if ((CQI instanceof NetCqiClient)) {
 	println "Error: CQP eval only available in CQP memory mode"
 	return;
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy	(revision 785)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/cqp/SetMatchingStrategyMacro.groovy	(revision 786)
@@ -11,7 +11,7 @@
 if (current != null)
 	println "Current strategy is: $current"
 
-def CQI = CQPEngine.getCqiClient();
+def CQI = CQPSearchEngine.getCqiClient();
 if ((CQI instanceof NetCqiClient)) {
 	println "Error: only available in CQP memory mode"
 	return;
Index: tmp/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java
===================================================================
--- tmp/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java	(revision 785)
+++ tmp/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java	(revision 786)
@@ -35,7 +35,7 @@
 import org.txm.rcp.swt.widget.NewNavigationWidget;
 import org.txm.rcp.swt.widget.PropertiesSelector;
 import org.txm.rcp.swt.widget.structures.StructuralUnitsComboViewer;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -364,7 +364,7 @@
 				sup = s;
 				break;
 			}
-			n = CQPEngine.getCqiClient().cpos2Struc(sup.getQualifiedName(), cpos);
+			n = CQPSearchEngine.getCqiClient().cpos2Struc(sup.getQualifiedName(), cpos);
 			return goToPage(n[0]);
 		} catch (Exception e) {
 			System.out.println("Error while internal view go back to " + line);
Index: tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryCooccurrence.java
===================================================================
--- tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryCooccurrence.java	(revision 785)
+++ tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryCooccurrence.java	(revision 786)
@@ -65,7 +65,7 @@
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -137,7 +137,7 @@
 					return Status.CANCEL_STATUS;
 				} catch (Exception e) {
 					Log.printStackTrace(e);
-					try { System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+					try { System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 					} catch (Exception e1) { e1.printStackTrace(); }
 				} finally {
 					monitor.done();
@@ -178,7 +178,7 @@
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
 			Log.printStackTrace(e);
-			try { System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+			try { System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 			} catch (Exception e1) { e1.printStackTrace(); }
 		}
 		return cooc;
Index: tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryAutoCooccurrence.java
===================================================================
--- tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryAutoCooccurrence.java	(revision 785)
+++ tmp/org.txm.querycooccurrences.rcp/src/org/txm/rcp/commands/function/ComputeQueryAutoCooccurrence.java	(revision 786)
@@ -62,7 +62,7 @@
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.StructuralUnit;
@@ -136,7 +136,7 @@
 					return Status.CANCEL_STATUS;
 				} catch (Exception e) {
 					Log.printStackTrace(e);
-					try { System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+					try { System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 					} catch (Exception e1) { e1.printStackTrace(); }
 				} finally {
 					monitor.done();
@@ -187,7 +187,7 @@
 
 		} catch (Exception e) {
 			Log.printStackTrace(e);
-			try { System.out.println(TXMUIMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
+			try { System.out.println(TXMUIMessages.LastCQPError+CQPSearchEngine.getCqiClient().getLastCQPError());
 			} catch (Exception e1) { e1.printStackTrace(); }
 		}
 		return cooc;
Index: tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java
===================================================================
--- tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java	(revision 785)
+++ tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java	(revision 786)
@@ -34,7 +34,7 @@
 import org.txm.rcp.swt.widget.parameters.ParametersDialog;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.AbstractCqiClient;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -219,7 +219,7 @@
 					PrintStream ps = new PrintStream(fos);
 					LinkedHashSet<Integer> positions = new LinkedHashSet<Integer>();
 					Property word = corpus.getProperty("word");
-					AbstractCqiClient CQI = CQPEngine.getCqiClient();
+					AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 					for (Match m : corpus.getMatches()) {
 						for (int i = m.getStart() ; i <= m.getEnd() ; i++) { // end match must be included
 							positions.add(i);
Index: tmp/org.txm.queryindex.rcp/src/org/txm/rcp/editors/queryindex/QueryIndexEditor.java
===================================================================
--- tmp/org.txm.queryindex.rcp/src/org/txm/rcp/editors/queryindex/QueryIndexEditor.java	(revision 785)
+++ tmp/org.txm.queryindex.rcp/src/org/txm/rcp/editors/queryindex/QueryIndexEditor.java	(revision 786)
@@ -89,7 +89,7 @@
 import org.txm.rcp.views.QueriesView;
 import org.txm.rcp.views.corpora.CorporaView;
 import org.txm.rcp.editors.input.QueryIndexEditorInput;
-import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Partition;
@@ -369,7 +369,7 @@
 						System.out.println(e.getLocalizedMessage());
 						try {
 							System.out.println(TXMUIMessages.LastCQPError
-									+ CQPEngine.getCqiClient().getLastCQPError());
+									+ CQPSearchEngine.getCqiClient().getLastCQPError());
 						} catch (Exception e1) {
 							System.out.println(IndexUIMessages.IndexEditor_10
 									+ e1);
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 785)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 786)
@@ -9,6 +9,7 @@
  * @author mdecorde
  *
  */
+//FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
 public class SearchEnginesManager extends EnginesManager<SearchEngine> {
 
 	/**
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 785)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 786)
@@ -2,6 +2,7 @@
 
 import org.txm.core.engines.Engine;
 
+// FIXME: useless class
 public abstract class SearchEngine implements Engine {
 
 	public static final String EXTENSION_POINT_ID = SearchEngine.class.getCanonicalName();
