Index: TXM/trunk/org.txm.libs.saxon/build.properties
===================================================================
--- TXM/trunk/org.txm.libs.saxon/build.properties	(revision 3588)
+++ TXM/trunk/org.txm.libs.saxon/build.properties	(revision 3589)
@@ -2,5 +2,8 @@
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               saxon9he.jar,\
-               OSGI-INF/
+               OSGI-INF/,\
+               lib/jline-2.14.6.jar,\
+               lib/saxon-he-11.3.jar,\
+               lib/xmlresolver-4.2.0-data.jar,\
+               lib/xmlresolver-4.2.0.jar
Index: TXM/trunk/org.txm.libs.saxon/.classpath
===================================================================
--- TXM/trunk/org.txm.libs.saxon/.classpath	(revision 3588)
+++ TXM/trunk/org.txm.libs.saxon/.classpath	(revision 3589)
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	  <classpathentry kind="src" path="src"/>
-	  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	  <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	  <classpathentry exported="true" kind="lib" path="saxon9he.jar"/>
-	  <classpathentry kind="output" path="bin"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" path="src"/>
+	<classpathentry exported="true" kind="lib" path="lib/jline-2.14.6.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/saxon-he-11.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/xmlresolver-4.2.0-data.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/xmlresolver-4.2.0.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Index: TXM/trunk/org.txm.libs.saxon/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/org.txm.libs.saxon/META-INF/MANIFEST.MF	(revision 3588)
+++ TXM/trunk/org.txm.libs.saxon/META-INF/MANIFEST.MF	(revision 3589)
@@ -1,20 +1,73 @@
 Manifest-Version: 1.0
 Bundle-SymbolicName: org.txm.libs.saxon
-Export-Package: javax.xml.xquery,net.sf.saxon,net.sf.saxon.dom,net.sf.
- saxon.event,net.sf.saxon.evpull,net.sf.saxon.expr,net.sf.saxon.expr.f
- lwor,net.sf.saxon.expr.instruct,net.sf.saxon.expr.number,net.sf.saxon
- .expr.parser,net.sf.saxon.expr.sort,net.sf.saxon.functions,net.sf.sax
- on.functions.regex,net.sf.saxon.java,net.sf.saxon.lib,net.sf.saxon.om
- ,net.sf.saxon.pattern,net.sf.saxon.pull,net.sf.saxon.query,net.sf.sax
- on.s9api,net.sf.saxon.serialize,net.sf.saxon.serialize.charcode,net.s
- f.saxon.serialize.codenorm,net.sf.saxon.style,net.sf.saxon.sxpath,net
- .sf.saxon.trace,net.sf.saxon.trans,net.sf.saxon.tree,net.sf.saxon.tre
- e.iter,net.sf.saxon.tree.linked,net.sf.saxon.tree.tiny,net.sf.saxon.t
- ree.util,net.sf.saxon.tree.wrapper,net.sf.saxon.type,net.sf.saxon.val
- ue,net.sf.saxon.xpath,net.sf.saxon.xqj
+Export-Package: net.sf.saxon,
+ net.sf.saxon.data,
+ net.sf.saxon.data.sef,
+ net.sf.saxon.dom,
+ net.sf.saxon.event,
+ net.sf.saxon.expr,
+ net.sf.saxon.expr.accum,
+ net.sf.saxon.expr.compat,
+ net.sf.saxon.expr.flwor,
+ net.sf.saxon.expr.instruct,
+ net.sf.saxon.expr.number,
+ net.sf.saxon.expr.oper,
+ net.sf.saxon.expr.parser,
+ net.sf.saxon.expr.sort,
+ net.sf.saxon.functions,
+ net.sf.saxon.functions.hof,
+ net.sf.saxon.functions.registry,
+ net.sf.saxon.gizmo,
+ net.sf.saxon.java,
+ net.sf.saxon.jaxp,
+ net.sf.saxon.lib,
+ net.sf.saxon.ma,
+ net.sf.saxon.ma.arrays,
+ net.sf.saxon.ma.json,
+ net.sf.saxon.ma.map,
+ net.sf.saxon.ma.parray,
+ net.sf.saxon.ma.trie,
+ net.sf.saxon.ma.zeno,
+ net.sf.saxon.om,
+ net.sf.saxon.pattern,
+ net.sf.saxon.pull,
+ net.sf.saxon.query,
+ net.sf.saxon.regex,
+ net.sf.saxon.regex.charclass,
+ net.sf.saxon.resource,
+ net.sf.saxon.s9api,
+ net.sf.saxon.s9api.push,
+ net.sf.saxon.s9api.streams,
+ net.sf.saxon.sapling,
+ net.sf.saxon.serialize,
+ net.sf.saxon.serialize.charcode,
+ net.sf.saxon.stax,
+ net.sf.saxon.str,
+ net.sf.saxon.style,
+ net.sf.saxon.sxpath,
+ net.sf.saxon.trace,
+ net.sf.saxon.trans,
+ net.sf.saxon.trans.packages,
+ net.sf.saxon.trans.rules,
+ net.sf.saxon.transpile,
+ net.sf.saxon.tree,
+ net.sf.saxon.tree.iter,
+ net.sf.saxon.tree.jiter,
+ net.sf.saxon.tree.linked,
+ net.sf.saxon.tree.tiny,
+ net.sf.saxon.tree.util,
+ net.sf.saxon.tree.wrapper,
+ net.sf.saxon.type,
+ net.sf.saxon.value,
+ net.sf.saxon.xpath,
+ net.sf.saxon.z
 Bundle-Name: Saxon
-Bundle-Version: 9
-Bundle-ClassPath: .,saxon9he.jar
+Bundle-Version: 11
+Bundle-ClassPath: .,
+ lib/jline-2.14.6.jar,
+ lib/saxon-he-11.3.jar,
+ lib/xmlresolver-4.2.0-data.jar,
+ lib/xmlresolver-4.2.0.jar
 Bundle-ManifestVersion: 2
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-Vendor: http://saxon.sourceforge.net/
Index: TXM/trunk/org.txm.libs.saxon/lib/jline-2.14.6.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/org.txm.libs.saxon/lib/jline-2.14.6.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/org.txm.libs.saxon/lib/xmlresolver-4.2.0-data.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/org.txm.libs.saxon/lib/xmlresolver-4.2.0-data.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/org.txm.libs.saxon/lib/xmlresolver-4.2.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/org.txm.libs.saxon/lib/xmlresolver-4.2.0.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/org.txm.libs.saxon/lib/saxon-he-11.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/org.txm.libs.saxon/lib/saxon-he-11.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java
===================================================================
--- TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java	(revision 3588)
+++ TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/InstallGroovyTIGERFiles.java	(revision 3589)
@@ -5,9 +5,11 @@
 
 import org.txm.PostTXMHOMEInstallationStep;
 import org.txm.Toolbox;
+import org.txm.groovy.core.InstallGroovyFiles;
 import org.txm.objects.Workspace;
 import org.txm.utils.BundleUtils;
 import org.txm.utils.DeleteDir;
+import org.txm.utils.logger.Log;
 
 public class InstallGroovyTIGERFiles extends PostTXMHOMEInstallationStep {
 
@@ -34,7 +36,7 @@
 		File tigerDirectory = new File(scriptsPackageDirectory, "tigersearch");
 		if (tigerDirectory.exists()) {
 			File backDirectory = new File(tigerDirectory.getParentFile(), "tigersearch-"+Toolbox.dateformat.format(Calendar.getInstance().getTime()));
-			System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory);
+			//System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory);
 			tigerDirectory.renameTo(backDirectory);
 			DeleteDir.deleteDirectory(tigerDirectory);
 		}
@@ -45,22 +47,25 @@
 		BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/scripts/importer", "", scriptsPackageDirectory2, true);
 		
 		// MACROS
-		scriptsPackageDirectory = new File(userDirectory, "org/txm/macro/tiger");
-		scriptsPackageDirectory2 = new File(systemDirectory, "org/txm/macro/tiger");
+		File macrosPackageDirectory = new File(userDirectory, "org/txm/macro/tiger");
+		File macrosPackageDirectory2 = new File(systemDirectory, "org/txm/macro/tiger");
 		
-		if (scriptsPackageDirectory.exists()) {
-			File backDirectory = new File(scriptsPackageDirectory.getParentFile(), "tiger-"+Toolbox.dateformat.format(Calendar.getInstance().getTime()));
-			System.out.println("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory);
-			scriptsPackageDirectory.renameTo(backDirectory);
-			DeleteDir.deleteDirectory(scriptsPackageDirectory);
+		if (macrosPackageDirectory.exists()) {
+//			File backDirectory = new File(scriptsPackageDirectory.getParentFile(), "tiger-"+Toolbox.dateformat.format(Calendar.getInstance().getTime()));
+//			Log.info("Making a copy of previous TIGER import scripts directory: "+tigerDirectory+" to "+backDirectory);
+//			scriptsPackageDirectory.renameTo(backDirectory);
+			
+			InstallGroovyFiles.backupFiles(macrosPackageDirectory, userDirectory.getParentFile(), bundle_id);
+			
+			DeleteDir.deleteDirectory(macrosPackageDirectory);
 		}
 		
-		scriptsPackageDirectory.mkdirs();
-		scriptsPackageDirectory2.mkdirs();
-		BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory, true);
-		BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", scriptsPackageDirectory2, true);
+		macrosPackageDirectory.mkdirs();
+		macrosPackageDirectory2.mkdirs();
+		BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", macrosPackageDirectory, true);
+		BundleUtils.copyFiles(bundle_id, "groovy", "org/txm/macro/tiger", "", macrosPackageDirectory2, true);
 		
-		return scriptsPackageDirectory.exists();
+		return macrosPackageDirectory.exists();
 	}
 
 	@Override
Index: TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java	(revision 3588)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java	(revision 3589)
@@ -38,6 +38,7 @@
 import java.util.logging.Level;
 import java.util.logging.SimpleFormatter;
 
+import org.apache.commons.lang.StringUtils;
 import org.txm.utils.messages.UtilsCoreMessages;
 
 /**
@@ -59,6 +60,8 @@
 	protected static FileHandler fh;
 
 	public static int MAX_LINE_LENGTH = 1000;
+	
+	public static int MAX_NEWLINES = 10;
 
 	/**
 	 * The CONSOLE flags indicates if messages with level < INFO are printed in
@@ -228,9 +231,10 @@
 		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
 			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
 		}
-		message = message.replace("\n", "⏎");
+		if (StringUtils.countMatches(message, "\n") > MAX_NEWLINES) {
+			message = message.replace("\n", "⏎");
+		}
 
-
 		if (Level.SEVERE.intValue() >= txm.getLevel().intValue()) {
 			System.out.println(message);
 
Index: TXM/trunk/org.txm.utils/src/org/txm/utils/saxon/SaxonNodeSet.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/saxon/SaxonNodeSet.java	(revision 3588)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/saxon/SaxonNodeSet.java	(revision 3589)
@@ -9,7 +9,7 @@
 import net.sf.saxon.expr.XPathContext;
 import net.sf.saxon.lib.ExtensionFunctionCall;
 import net.sf.saxon.lib.ExtensionFunctionDefinition;
-import net.sf.saxon.om.SequenceIterator;
+import net.sf.saxon.om.Sequence;
 import net.sf.saxon.om.StructuredQName;
 import net.sf.saxon.trans.XPathException;
 import net.sf.saxon.value.SequenceType;
@@ -39,9 +39,14 @@
 	@Override
 	public ExtensionFunctionCall makeCallExpression() {
 		return new ExtensionFunctionCall() {
+//			@Override
+//			public SequenceIterator call(final SequenceIterator[] arguments, final XPathContext context) throws XPathException {
+//				return arguments[0];
+//			}
+
 			@Override
-			public SequenceIterator call(final SequenceIterator[] arguments, final XPathContext context) throws XPathException {
-				return arguments[0];
+			public Sequence call(XPathContext arg0, Sequence[] arg1) throws XPathException {
+				return arg1[0];
 			}
 		};
 	}
Index: TXM/trunk/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java	(revision 3588)
+++ TXM/trunk/org.txm.core/src/java/org/txm/PostTXMHOMEInstallationStep.java	(revision 3589)
@@ -36,7 +36,7 @@
 		Log.fine(TXMCoreMessages.bind("{0} installed version: {1}.", getName(), extinstalledVersion));
 		//System.out.println("Toolbox.startWorkspace(): workspace location = " + location);
 		boolean extDoUpdateworkspace = extcurrentVersion.compareTo(extinstalledVersion) > 0;
-		if (needsReinstall(workspace) || extDoUpdateworkspace) {
+		if (needsReinstall(workspace) || extDoUpdateworkspace || "org.txm.groovy.core".equals(bundle_id)) {
 			Log.finer("Installing extension "+getName()+" reasons: workspace or extDoUpdateworkspace="+extDoUpdateworkspace);
 			if (do_install(workspace)) {
 				Toolbox.setPreference(getName(), extcurrentVersion.toString()); // SAVE the installed version
Index: TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 3588)
+++ TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 3589)
@@ -150,6 +150,16 @@
 		return copyFiles(bundle_id, source_relative_directory, file_path, file_name, outputDirectory, true);
 	}
 	
+	public static long getDate(String bundle_id) {
+		
+		File bundleDir = getBundleFile(bundle_id);
+		long l1 = bundleDir.lastModified();
+		
+		Bundle bundle = Platform.getBundle(bundle_id);
+		long l2 = bundle.getLastModified();
+		return Math.max(l1, l2);
+	}
+	
 	/**
 	 * Copy a file from the bundle directory or Jar to @outputDirectory
 	 * 
Index: TXM/trunk/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy
===================================================================
--- TXM/trunk/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy	(revision 3588)
+++ TXM/trunk/org.txm.conllu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy	(revision 3589)
@@ -47,7 +47,7 @@
 				return;
 			}
 		}
-		File metadataFile = Metadatas.findMetadataFile(sourceDirectory)
+		File metadataFile = Metadatas.findMetadataFile(module.sourceDirectory)
 		File srcDirectory = new File(outputDirectory.getParentFile().getParentFile(), "conllu2tei")
 		srcDirectory.deleteDir();
 		srcDirectory.mkdirs();
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java	(revision 3588)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java	(revision 3589)
@@ -9,6 +9,7 @@
 import org.txm.PostTXMHOMEInstallationStep;
 import org.txm.Toolbox;
 import org.txm.annotation.urs.preferences.URSPreferences;
+import org.txm.groovy.core.InstallGroovyFiles;
 import org.txm.objects.Workspace;
 import org.txm.utils.BundleUtils;
 import org.txm.utils.DeleteDir;
@@ -50,16 +51,21 @@
 		File macroDirectory = new File(userDirectory, "org/txm/macro");
 		File URSMacroDirectory = new File(macroDirectory, "urs");
 		
+		String bundle_id = "org.txm.annotation.urs.rcp";
+		
 		if (URSMacroDirectory.exists()) {
-			long time = URSMacroDirectory.lastModified();
-			File backDirectory = new File(macroDirectory, "urs-"+Toolbox.dateformat.format(new Date(time)));
-			Log.warning(NLS.bind("Making a copy of the {0} previous URS macros directory to {1}.", URSMacroDirectory, backDirectory));
+//			long time = URSMacroDirectory.lastModified();
+//			File backDirectory = new File(macroDirectory, "urs-"+Toolbox.dateformat.format(new Date(time)));
+//			Log.info(NLS.bind("Making a copy of the {0} previous URS macros directory to {1}.", URSMacroDirectory, backDirectory));
+//			
+//			URSMacroDirectory.renameTo(backDirectory);
 			
-			URSMacroDirectory.renameTo(backDirectory);
+			InstallGroovyFiles.backupFiles(URSMacroDirectory, userDirectory.getParentFile(), bundle_id);
+			
 			DeleteDir.deleteDirectory(URSMacroDirectory);
 		}
 
-		String bundle_id = "org.txm.annotation.urs.rcp";
+		
 		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory, true);
 
 		// saving current version
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/RenameFilesMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/RenameFilesMacro.groovy	(revision 3588)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/RenameFilesMacro.groovy	(revision 3589)
@@ -1,37 +0,0 @@
-// STANDARD DECLARATIONS
-package org.txm.macroproto
-
-import org.kohsuke.args4j.*
-import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
-
-// BEGINNING OF PARAMETERS
-
-@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt")
-File inputDirectory;
-
-// **change this parameter**
-@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
-def extension = "\\.trs"
-
-// **change this parameter**
-@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’')
-def find = "Bobine"
-
-// **change this parameter**
-@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'')
-def replaceWith = ""
-
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return;
-
-// END OF PARAMETERS
-
-println "In $inputDirectory..."
-inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
-		println " renaming: "+file.getName()
-		String name = file.getName()
-		name = name.replaceAll(find, replaceWith)
-		file.renameTo(new File(file.getParentFile(), name))
-	}
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/misc/RenameFilesMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/misc/RenameFilesMacro.groovy	(revision 3588)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/misc/RenameFilesMacro.groovy	(revision 3589)
@@ -1,36 +0,0 @@
-// STANDARD DECLARATIONS
-package org.txm.macro.misc
-
-import org.kohsuke.args4j.*
-import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
-
-// BEGINNING OF PARAMETERS
-
-@Field @Option(name="inputDirectory",usage="TXT directory", widget="Folder", required=false, def="txt")
-File inputDirectory;
-
-// **change this parameter**
-@Field @Option(name="extension",usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
-def extension = "\\.trs"
-
-// **change this parameter**
-@Field @Option(name="find",usage="Expression régulière", widget="String", required=true, def='’')
-def find = "Bobine"
-
-// **change this parameter**
-@Field @Option(name="replaceWith",usage="Chaîne de remplacement", widget="String", required=false, def='\'')
-def replaceWith = ""
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return;
-
-// END OF PARAMETERS
-
-println "In $inputDirectory..."
-inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
-		println " renaming: "+file.getName()
-		String name = file.getName()
-		name = name.replaceAll(find, replaceWith)
-		file.renameTo(new File(file.getParentFile(), name))
-	}
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/files/RenameFilesMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/files/RenameFilesMacro.groovy	(revision 0)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/files/RenameFilesMacro.groovy	(revision 3589)
@@ -0,0 +1,37 @@
+// STANDARD DECLARATIONS
+package org.txm.macro.files
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcp.swt.widget.parameters.*
+
+// BEGINNING OF PARAMETERS
+
+@Field @Option(name="inputDirectory", usage="TXT directory", widget="Folder", required=false, def="txt")
+File inputDirectory
+
+// **change this parameter**
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+def extension
+
+// **change this parameter**
+@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='’')
+def find
+
+// **change this parameter**
+@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=false, def='\'')
+def replaceWith = ""
+
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+// END OF PARAMETERS
+
+println "In $inputDirectory..."
+inputDirectory.eachFileMatch(~/.*$extension/) { file ->               // for each file matching extension
+		println " renaming: "+file.getName()
+		String name = file.getName()
+		name = name.replaceAll(find, replaceWith)
+		file.renameTo(new File(file.getParentFile(), name))
+	}
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3588)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3589)
@@ -4,8 +4,6 @@
 
 import java.io.File;
 
-import net.sf.saxon.style.XSLParam;
-
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.importer.ApplyXsl2
 import org.txm.scripts.importer.CleanFile
@@ -110,7 +108,7 @@
 		this.doTokenizeStep = project.getDoTokenizerStep()
 		
 		//prepare metadata if any
-		File allMetadataFile = Metadatas.findMetadataFile(sourceDirectory);
+		File allMetadataFile = Metadatas.findMetadataFile(module.sourceDirectory);
 		if (allMetadataFile != null && allMetadataFile.exists()) {
 			File copy = new File(binDir, allMetadataFile.getName())
 			if (!FileCopy.copy(allMetadataFile, copy)) {
Index: TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java	(revision 3588)
+++ TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java	(revision 3589)
@@ -2,12 +2,14 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Date;
 
-import org.osgi.framework.Version;
+import org.eclipse.osgi.util.NLS;
 import org.txm.PostTXMHOMEInstallationStep;
 import org.txm.Toolbox;
 import org.txm.objects.Workspace;
 import org.txm.utils.BundleUtils;
+import org.txm.utils.DeleteDir;
 import org.txm.utils.io.FileCopy;
 import org.txm.utils.logger.Log;
 
@@ -82,8 +84,14 @@
 		// BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "sw/", samplesDirectory);
 		// BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "tal/", samplesDirectory);
 		
+
 		String bundle_id = "org.txm.groovy.core"; //$NON-NLS-1$
+		
+		// copy modified files in the backup directory
+		backupFiles(userDirectory, userDirectory.getParentFile(), bundle_id);
+		
 		BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", userDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", systemDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		
 		bundle_id = "org.txm.core"; //$NON-NLS-1$
 		
@@ -91,11 +99,41 @@
 		scriptsPackageDirectory.mkdirs();
 		BundleUtils.copyFiles(bundle_id, "src/java/", "org/txm/scripts/importer", "", scriptsPackageDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		
+		return scriptsDirectory.exists();
+	}
+	
+	public static void backupFiles(File directorytoBackUp, File parentFiletoUse, String bundle_id) {
 		
+		File backUserDirectory = new File(parentFiletoUse, directorytoBackUp.getName()+"-"+Toolbox.dateformat.format(new Date()));
+		int nBackupedFiles = 0;
+		long updateTime = BundleUtils.getDate(bundle_id);
+		for (File f : DeleteDir.scanDirectory(directorytoBackUp, true, true)) {
+			long t = f.lastModified();
+			
+			if (f.isFile() && f.getName().endsWith(".groovy") && t > updateTime) {
+				
+				String path = f.getAbsolutePath();
+				path = path.substring(directorytoBackUp.getAbsolutePath().length());
+				File backGroovy = new File(backUserDirectory, path);
+				
+				try {
+					Log.fine(NLS.bind("Backing {0} -> {1}", f, backGroovy));
+					backGroovy.getParentFile().mkdirs();
+					FileCopy.copy(f, backGroovy);
+					nBackupedFiles++;
+				}
+				catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+		if (nBackupedFiles > 0) {
+			Log.info(NLS.bind("Modified Groovy files saved in {0} ({1})", backUserDirectory, nBackupedFiles));
+		}
 		
-		return scriptsDirectory.exists();
 	}
-	
+
 	@Override
 	public String getName() {
 		return "Groovy (org.txm.groovy.core)"; //$NON-NLS-1$
Index: TXM/trunk/org.txm.groovy.core/build.properties
===================================================================
--- TXM/trunk/org.txm.groovy.core/build.properties	(revision 3588)
+++ TXM/trunk/org.txm.groovy.core/build.properties	(revision 3589)
@@ -14,4 +14,4 @@
 #qualifier=svn
 sourceFileExtensions=*.java, *.groovy
 compilerAdapter=org.codehaus.groovy.eclipse.ant.GroovyCompilerAdapter
-compilerAdapter.useLog=true  # this ensures that exceptions are logged to the proper log file.
\ No newline at end of file
+compilerAdapter.useLog=true  # this ensures that exceptions are logged to the proper log file.
