Index: tmp/org.txm.utils/src/org/txm/utils/Timer.java
===================================================================
--- tmp/org.txm.utils/src/org/txm/utils/Timer.java	(revision 0)
+++ tmp/org.txm.utils/src/org/txm/utils/Timer.java	(revision 1889)
@@ -0,0 +1,17 @@
+package org.txm.utils;
+
+public class Timer {
+	long start = System.currentTimeMillis();
+	
+	public long ellaspeTime() {
+		return System.currentTimeMillis() - start;
+	}
+	
+	public void reset() {
+		start = System.currentTimeMillis();
+	}
+	
+	public long getStart() {
+		return start;
+	}
+}

Property changes on: tmp/org.txm.utils/src/org/txm/utils/Timer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java	(revision 1889)
@@ -294,7 +294,7 @@
 		params.put(TEXTUALPLANS, true);
 		params.put(OPTIONS, true);
 		allParams.put("xtzLoader.groovy", params); //$NON-NLS-1$
-		names.put("xtzLoader.groovy", "XML-XTZ + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
+		names.put("xtzLoader.groovy", "XML-TEI Zero + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
 	/**
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog.java	(revision 1889)
@@ -33,6 +33,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.Timer;
 import org.txm.utils.logger.Log;
 
 @SuppressWarnings("rawtypes")
@@ -412,7 +413,7 @@
 				script.getBinding().setVariable("args", args);
 			}
 		}
-
+		
 		Display.getDefault().syncExec(new Runnable() {
 			public void run() { 
 				boolean okNames = true;
@@ -447,6 +448,14 @@
 						retOpen = true;
 						errorOpen = false;
 					}
+					
+					if (bean instanceof groovy.lang.Script) { // reset the timer binding if already existing
+						groovy.lang.Script script = (groovy.lang.Script) bean;
+						if (script.getBinding().hasVariable("timer")) {
+							Timer timer = (Timer)script.getBinding().getVariable("timer");
+							timer.reset();
+						}
+					}
 				}
 			}
 		});
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java	(revision 1889)
@@ -10,6 +10,14 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+/**
+ * Composite to select a directory:
+ * 
+ * [optional title] + [text widget] + [button "..."]
+ * 
+ * @author mdecorde
+ *
+ */
 public class SelectDirectoryWidget extends GLComposite {
 
 	Text t;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 1889)
@@ -38,6 +38,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.logging.Handler;
@@ -45,6 +46,7 @@
 import java.util.logging.LogRecord;
 
 import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -62,6 +64,7 @@
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Shell;
@@ -679,22 +682,8 @@
 			try {
 				Log.info(NLS.bind(TXMUIMessages.installPathColonP0, Toolbox.getInstallDirectory()));
 
-				Log.info("Checking TXM user directory...");
-				if (Toolbox.getTxmHomePath().trim().isEmpty()) {
-					Version v = BundleUtils.getBundleVersion("org.txm.rcp");//$NON-NLS-1$
-					if (v == null) {
-						System.out.println("Error: no 'org.txm.rcp' version found.");
-						return false;
-					}
-					String version = v.getMajor()+"."+v.getMinor()+"."+v.getMicro();
-					if (org.eclipse.core.runtime.Platform.inDevelopmentMode()) { //$NON-NLS-1$
-						System.out.println("RUNNING TXM FROM ECLIPSE - DEV MODE ACTIVATED");
-						version += "-dev";
-					}
-					txmhomedir = new File(System.getProperty("user.home"), "TXM-"+version); //$NON-NLS-1$ //$NON-NLS-2$
-				} else {
-					txmhomedir = new File(Toolbox.getTxmHomePath().trim());
-				}
+				txmhomedir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getCanonicalFile();
+				txmhomedir.mkdirs(); // creates the directory if needed
 
 				txmhomedir.mkdirs(); // creates the directory if needed
 
@@ -732,10 +721,10 @@
 	 * @param monitor
 	 */
 	private void installCorporaDirectory(IProgressMonitor monitor) {
-		if (Toolbox.getTxmHomePath().endsWith("-dev")) {
-			System.out.println("DEV MODE: no corpus restored!");
-			return; // dev mode
-		}
+		//		if (org.eclipse.core.runtime.Platform.inDevelopmentMode()) {
+		//			System.out.println("DEV MODE: no corpus restored!");
+		//			return; // dev mode
+		//		}
 		monitor.setTaskName("Restoring corpora...");
 		String installdirpath = Toolbox.getInstallDirectory();
 		File sampleCorporaDirectory = new File(installdirpath, "samples"); //$NON-NLS-1$
@@ -753,13 +742,15 @@
 		String SAMPLES = "1. "+TXMUIMessages.bind(TXMUIMessages.sampleCorporaOfCurrentTXMP0, vv);
 		String V080 = "2. "+TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, vv);
 		String V079 = "3. "+TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.7.9");
-		
-		
+		String OTHER = "4. "+TXMUIMessages.selectAnotherTXMCorporaToRestore;
+
+
 		final ArrayList<Object> corporaDirs = new ArrayList<Object>();
 		corporaDirs.add(SAMPLES);
 		corporaDirs.add(V080);
 		corporaDirs.add(V079);
-		
+		corporaDirs.add(OTHER);
+
 		Display.getDefault().syncExec(new Runnable() {
 			@Override
 			public void run() {
@@ -778,7 +769,7 @@
 				}
 			}
 		});
-		
+
 		// move previous TXM 0.8.0 corpora
 		File backupDir = new File(corporaDir.getAbsolutePath()+"-previous");
 		if (corporaDir.exists()) {
@@ -789,21 +780,21 @@
 				dir.renameTo(bdir);
 			}
 		}
-		
+
 		// load TXM-0.8.0 sample corpora (from the install directory)
-				if (corporaDirs.contains(SAMPLES) && sampleCorporaDirectory.exists()) {
+		if (corporaDirs.contains(SAMPLES) && sampleCorporaDirectory.exists()) {
 
-					Log.info(TXMUIMessages.installingSampleCorpus);
+			Log.info(TXMUIMessages.installingSampleCorpus);
 
-					JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(sampleCorporaDirectory, false, true, false);
-					try {
-						job.join();
-					} catch (InterruptedException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
-				}
-		
+			JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(sampleCorporaDirectory, false, true, false);
+			try {
+				job.join();
+			} catch (InterruptedException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
 		// TXM-0.8.0 previous installation corpora
 		if (corporaDirs.contains(V080) && backupDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory
 			Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.8.0", corporaDir));
@@ -814,7 +805,7 @@
 				e.printStackTrace();
 			}
 		}
-		
+
 		// TXM previous installation corpora
 		if (corporaDirs.contains(V079) && previousCorporaDirectory.exists()) { // new installation (empty corpora directory)
 			Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.7.9", previousCorporaDirectory));
@@ -826,13 +817,40 @@
 			}
 		}
 
+		// TXM previous installation corpora
+		if (corporaDirs.contains(OTHER)) { // new installation (empty corpora directory)
+			final HashMap<String, String> bindings = new HashMap<String, String>();
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					Display display = Display.getDefault();
+					Shell shell = display.getActiveShell();
+					DirectoryDialog dialog = new DirectoryDialog(shell);
+					String path = dialog.open();
+					if (path == null) return;
+
+					bindings.put("path", path);
+				}
+			});
+			if (bindings.containsKey("path")) {
+				File dir = new File(bindings.get("path"));
+				Log.info(NLS.bind("Restoring corpora from the {0} directory...", dir));
+				JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(dir, true, true, true);
+				try {
+					job.join();
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+
 		Display.getDefault().syncExec(new Runnable() {
 			@Override
 			public void run() {
 				RestartTXM.reloadViews();
 			}
 		});
-		
+
 		monitor.setTaskName("");
 	}
 
@@ -915,7 +933,7 @@
 									monitor.setTaskName("Calling Groovy prestart script...");
 									callPreStartScript();
 									monitor.worked(20);
-									
+
 									monitor.setTaskName("Initializing Toolbox (engines and corpora)...");
 									if (Toolbox.initialize(TBXPreferences.class, monitor)) {
 										StatusLine.setMessage(TXMUIMessages.ready);
@@ -928,11 +946,11 @@
 										return;
 									}
 									monitor.worked(20);
-									
+
 									monitor.setTaskName("Calling Groovy start script...");
 									callStartScript();
 									monitor.worked(20);
-									
+
 									// restore corpora if TXMHOME has been created
 									if (txmHomeRestored) {
 										installCorporaDirectory(monitor);
@@ -947,10 +965,10 @@
 							monitor.done(); 
 						}
 					});
-					
+
 					Log.fine(TXMUIMessages.loadingViews);
 					RestartTXM.reloadViews(); // reload views
-					
+
 					setDefaultTheme();
 
 					// CLOSE Empty&Error editors
@@ -966,7 +984,7 @@
 				}
 			}
 		});
-		
+
 		jobHandler.setTaskName("");
 		//TxmPreferences.dump();
 		return true;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java	(revision 1889)
@@ -102,17 +102,21 @@
 		//		} else {
 		// in Release mode only : platform workspace selection on startup
 		// then restart if needed (on workspace error...)
-		Integer ret = openCGU();
-		if (ret == IApplication.EXIT_RESTART) {
-			System.out.println("** Working directory set by user.");
-			return IApplication.EXIT_RESTART;
-		} else if (ret == IApplication.EXIT_OK) {
-			System.out.println("** Fail to open CGU or set working directory.");
-			return IApplication.EXIT_OK; // an error occurred or user canceled
-		} else {
-			// OK
+
+		System.out.println("instance location="+Platform.getInstanceLocation().getURL());
+		if (Platform.getInstanceLocation().getURL() == null) {
+
+			Integer ret = openCGU();
+			if (ret == IApplication.EXIT_RESTART) {
+				System.out.println("** Working directory set by user.");
+				return IApplication.EXIT_RESTART;
+			} else if (ret == IApplication.EXIT_OK) {
+				System.out.println("** Fail to open CGU or set working directory.");
+				return IApplication.EXIT_OK; // an error occurred or user canceled
+			} else {
+				// OK
+			}
 		}
-		//		}
 
 		// Die if platform WS not set (user cancel)
 		// ---------------------------
@@ -250,7 +254,7 @@
 
 	private Integer openCGU() {
 		try {
-			
+
 			Version v = BundleUtils.getBundleVersion("org.txm.rcp");//$NON-NLS-1$
 			if (v == null) {
 				System.out.println("Error: no 'org.txm.rcp' version found.");
@@ -262,11 +266,11 @@
 				version += "-dev";
 			}
 			System.out.println("Version="+version);
-			
+
 			File txmhomedir = new File(System.getProperty("user.home"), "TXM-"+version); //$NON-NLS-1$ //$NON-NLS-2$
 
-			
-			
+
+
 			//System.out.println("CGU="+ConfigurationScope.INSTANCE.getNode(IDEWorkbenchPlugin.IDE_WORKBENCH).getBoolean(RCPPreferences.CGU, false));
 			if (!ConfigurationScope.INSTANCE.getNode(IDEWorkbenchPlugin.IDE_WORKBENCH).getBoolean(RCPPreferences.CGU, false)) {
 				ChooseWorkspaceData launchData = new ChooseWorkspaceData(txmhomedir.getAbsolutePath());
@@ -301,17 +305,17 @@
 				ChooseWorkspaceData launchData = new ChooseWorkspaceData(txmhomedir.getAbsolutePath());
 				String[] recent = launchData.getRecentWorkspaces();
 
-		        // If the selection dialog was not used then the workspace to use is either the
-		        // most recent selection or the initialDefault (if there is no history).
-		        String workspace = null;
-		        if (recent != null && recent.length > 0) {
+				// If the selection dialog was not used then the workspace to use is either the
+				// most recent selection or the initialDefault (if there is no history).
+				String workspace = null;
+				if (recent != null && recent.length > 0) {
 					workspace = recent[0];
 				}
-		        if (workspace == null || workspace.length() == 0) {
+				if (workspace == null || workspace.length() == 0) {
 					workspace = launchData.getInitialDefault();
 				}
-		        launchData.workspaceSelected(TextProcessor.deprocess(workspace));
-				
+				launchData.workspaceSelected(TextProcessor.deprocess(workspace));
+
 				return setInstanceLocation(launchData);
 			}
 		} catch(Exception e) {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 1889)
@@ -56,6 +56,7 @@
 import org.txm.rcp.swt.widget.parameters.UIParameterException;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.utils.Timer;
 import org.txm.utils.logger.Log;
 
 import groovy.lang.Binding;
@@ -250,12 +251,13 @@
 					binding.setProperty("MONITOR", this); //$NON-NLS-1$
 					binding.setProperty("stringArgs", stringArgs); //$NON-NLS-1$
 					binding.setProperty("gse", gse);
+					Timer timer = new Timer();
+					binding.setProperty("timer", timer); //$NON-NLS-1$
 					
 					Log.info(NLS.bind(TXMUIMessages.executingGroovyScript, scriptfile.getName()));
-					long time = System.currentTimeMillis();
+					
 					gse.run(relativepath, binding);
-					
-					Log.info(TXMUIMessages.bind(TXMUIMessages.doneP0Ms, System.currentTimeMillis()-time));
+					Log.info(TXMUIMessages.bind(TXMUIMessages.doneP0Ms, timer.ellaspeTime()));
 				} catch (ThreadDeath td) {
 					return Status.CANCEL_STATUS;
 				} catch (UIParameterException e) {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1889)
@@ -1001,4 +1001,5 @@
 seeTheQuoteSectionIn=(voir la section 'Citer le logiciel TXM' de la page d'accueil du site 
 selectWorkingDirectory=Répertoire de travail
 options=Options...
-firstLaunchOfTXM=Premier lancement de TXM
\ No newline at end of file
+firstLaunchOfTXM=Premier lancement de TXM
+selectAnotherTXMCorporaToRestore=Selectionner un autre répertoire de corpus à récupérer...
\ No newline at end of file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 1889)
@@ -538,6 +538,8 @@
 	public static String selectWorkingDirectory;
 
 	public static String firstLaunchOfTXM;
+
+	public static String selectAnotherTXMCorporaToRestore;
 	
 	static {
 		// initialize resource bundle
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1889)
@@ -1005,4 +1005,5 @@
 seeTheQuoteSectionIn=(see the "How to Cite the Textometry project" section in the textometrie.org web site: 
 selectWorkingDirectory=Working directory
 options=Options...
-firstLaunchOfTXM=First launch of TXM
\ No newline at end of file
+firstLaunchOfTXM=First launch of TXM
+selectAnotherTXMCorporaToRestore=Select another TXM corpora to restore...
\ No newline at end of file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java	(revision 1888)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java	(revision 1889)
@@ -115,9 +115,8 @@
 		launchData.workspaceSelected(path);
 		
 		// Switch workspace :
-		URL url = null;
 		try {
-			url = new URL("file", "", path);
+			URL url = new URL("file", "", path);
 			launchData.writePersistedData();
 			ChooseWorkspaceData.setShowDialogValue(false);
 			PlatformUI.getWorkbench().restart(); // need to restart TXM to apply changes
Index: tmp/org.txm.rcp/build.properties
===================================================================
--- tmp/org.txm.rcp/build.properties	(revision 1888)
+++ tmp/org.txm.rcp/build.properties	(revision 1889)
@@ -16,7 +16,8 @@
                p2.inf,\
                TXM.sh,\
                icons/,\
-               OSGI-INF/
+               OSGI-INF/,\
+               OSGI-INF/l10n/bundle.properties
 source..=src/main/java/
 bin.excludes = lib/batik/
 qualifier=svn
Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 1888)
+++ tmp/org.txm.rcp/plugin.xml	(revision 1889)
@@ -2448,7 +2448,7 @@
             categoryId="org.txm.rcp.category.txm"
             defaultHandler="org.txm.rcp.commands.ChangeTXMWorkspace"
             id="org.txm.rcp.commands.ChangeTXMWorkspace"
-            name="Change working directory...">
+            name="%command.name.64">
       </command>
    </extension>
    <extension
Index: tmp/org.txm.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.rcp/OSGI-INF/l10n/bundle.properties	(revision 1888)
+++ tmp/org.txm.rcp/OSGI-INF/l10n/bundle.properties	(revision 1889)
@@ -515,3 +515,5 @@
 wizard.name          = Corpus
 wizard.name.0        = Corpus
 wizard.name.1        = Corpus
+
+command.name.64 = Change working directory...
\ No newline at end of file
Index: tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 1888)
+++ tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 1889)
@@ -208,7 +208,7 @@
 command.label.9         = XML-TEI Frantext
 command.label.90        = Fermer
 command.label.91        = Afficher les parents cach\u00E9s
-command.label.92        = XML-TEI Z\u00E9ro + CSV
+command.label.92        = XML-TEI Zero + CSV
 command.label.93        = Fermer tout
 command.label.94        = Table lexicale
 command.label.95        = Cacher les parents interm\u00E9diaires
@@ -548,3 +548,5 @@
 wizard.name          = Corpus
 wizard.name.0        = Corpus
 wizard.name.1        = Corpus
+
+command.name.64 = Changer le r�pertoire de travail...
\ No newline at end of file
