Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java	(revision 804)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java	(revision 805)
@@ -69,10 +69,14 @@
 	int nWordProps = 0;
 	
 	/**
+	 * pattern to find structure attributes
+	 */
+	public static final Pattern p = Pattern.compile("(([^= ]+)=\"([^\"]+)\")");
+	
+	/**
 	 * process !!!.
 	 *
-	 * @param cqpfile the xmlfile
-	 * @param wordstag the wordstag
+	 * @param cqpfile the input file in CQP format
 	 * @return true if successful
 	 * @throws XMLStreamException the xML stream exception
 	 * @throws FactoryConfigurationError the factory configuration error
@@ -90,8 +94,6 @@
 		String line = reader.readLine();
 		String localname;
 		
-		
-		Pattern p = Pattern.compile("(([^= ]+)=\"([^\"]+)\")");
 		//for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 		for(; line != null ; line = reader.readLine()) {
 
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 804)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 805)
@@ -221,7 +221,7 @@
 					monitor.worked(5);
 
 					//				if (ExecuteImportScript.gse == null)
-					ExecuteImportScript.gse = ExecuteGroovyScript.buildGSE(scriptRootDir, script);
+					ExecuteImportScript.gse = GSERunner.buildDefaultGSE(scriptRootDir, script);
 					
 
 					Binding binding = new Binding();
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 804)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 805)
@@ -38,6 +38,8 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.control.customizers.ImportCustomizer;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -218,7 +220,7 @@
 		final String relativepath = path.substring(dir.length()+1);
 
 		//if (gse == null) {
-			gse = buildGSE(scriptsRootDirectories, scriptfile);
+			gse = GSERunner.buildDefaultGSE(scriptsRootDirectories, scriptfile);
 			if (gse == null) {
 				System.out.println("Could not create the Groovy script engine. Aborting.");
 				return;
@@ -344,74 +346,4 @@
 		 * {org.txm.rcp.utils.Logger.printStackTrace(e);}
 		 */
 	}
-	
-public static GSERunner buildGSE(String scriptRootDir, File script) {
-		
-		GSERunner gse;
-		
-		String[] roots = new String[] { 
-				scriptRootDir+"/user/", //$NON-NLS-1$
-				scriptRootDir+"/macro/", //$NON-NLS-1$
-				scriptRootDir+"/import/", //$NON-NLS-1$
-				script.getParent(),
-		}; 
-
-//		HashMap<String, Bundle> bundleWithActivators = new HashMap<String, Bundle>();
-//		HashSet<ClassLoader> loaders = new HashSet<ClassLoader>();
-//		BundleContext bundleContext = InternalPlatform.getDefault().getBundleContext();
-//		for (Bundle b : bundleContext.getBundles()) {
-//			String acName = b.getHeaders().get("Bundle-Activator");
-//			//System.out.println(b.getSymbolicName()+":"+b.getHeaders());
-//			if (acName != null) {
-//				if (!bundleWithActivators.containsKey(b.getSymbolicName())) {
-//					bundleWithActivators.put(b.getSymbolicName(),b);
-//				} else {
-//					Bundle b2 = bundleWithActivators.get(b.getSymbolicName());
-//					if (b2.getVersion().compareTo(b.getVersion()) < 0) {
-//						bundleWithActivators.put(b.getSymbolicName(),b);
-//					}
-//				}
-//			}
-//		}
-//		
-//		for (Bundle b : bundleWithActivators.values()) {
-//			try {
-//				String acName = b.getHeaders().get("Bundle-Activator");
-//				Class<?> ac = b.loadClass(acName);
-//				loaders.add(ac.getClassLoader());
-//			} catch (Throwable e) {
-//				System.out.println("Bundle Activator error: "+e);
-//			}
-//		}
-//		Log.info("Initialized TXMClassLoader with "+loaders.size()+ " bundles.");
-//		TXMClassLoader scl = new TXMClassLoader(loaders);
-
-		try {
-			gse = new GSERunner(roots);
-		} catch (IOException e) {
-			e.printStackTrace();
-			return null;
-		}
-
-		File jardir = new File(scriptRootDir,"lib"); //$NON-NLS-1$
-		if (jardir.exists() && jardir.isDirectory()) {
-			for (File f: jardir.listFiles(new FilenameFilter() {
-				@Override
-				public boolean accept(File dir, String name) {
-					return name.endsWith(".jar"); //$NON-NLS-1$
-				}
-			}))
-			{
-				try {
-					gse.getGroovyClassLoader().addURL(f.toURI().toURL());
-				} catch (MalformedURLException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}	
-		gse.getGroovyClassLoader().addClasspath(scriptRootDir); // for the .class files if any
-		
-		return gse;
-	}
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/GSERunner.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/GSERunner.java	(revision 804)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/GSERunner.java	(revision 805)
@@ -1,23 +1,29 @@
 package org.txm.rcp.utils;
 
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+import groovy.util.ResourceException;
+import groovy.util.ScriptException;
+
+import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.control.customizers.ImportCustomizer;
 import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.FileLocator;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.wiring.BundleWiring;
+import org.txm.Toolbox;
 import org.txm.rcp.TXMClassLoader;
 import org.txm.utils.logger.Log;
 
-import groovy.lang.Binding;
-import groovy.util.GroovyScriptEngine;
-import groovy.util.ResourceException;
-import groovy.util.ScriptException;
-
 /**
  * gse wrapper for TXM scripts and macros
  * 
@@ -30,6 +36,84 @@
 		super(urls, getTXMClassLoader());
 	}
 
+	protected static GSERunner defaultGSE;
+	protected static String defaultScriptRootDir = "";
+	
+	public static void clearDefaultGSE() {
+		defaultGSE = null;
+		defaultScriptRootDir = "";
+	}
+	
+	/**
+	 * Build a GSERunner with default paths : user, macro, import and library path
+	 * 
+	 * @param scriptRootDir if null uses Toolbox home directory
+	 * @param script
+	 * @return
+	 */
+	public static GSERunner buildDefaultGSE(String scriptRootDir, File script) {
+		if (defaultScriptRootDir.equals(scriptRootDir) &&  defaultGSE != null) {
+			try {
+				defaultGSE.getGroovyClassLoader().addURL(new URL("file://"+script.getParent()));
+			} catch (MalformedURLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			return defaultGSE;
+		}
+		
+		if (scriptRootDir == null) {
+			scriptRootDir = new File(Toolbox.getTXMHOMEPATH(), "scripts").getAbsolutePath();
+		}
+		String[] roots = new String[] { 
+				scriptRootDir+"/user/", //$NON-NLS-1$
+				scriptRootDir+"/macro/", //$NON-NLS-1$
+				scriptRootDir+"/import/", //$NON-NLS-1$
+				script.getParent(),
+		}; 
+
+		try {
+			defaultScriptRootDir = scriptRootDir;
+			defaultGSE = new GSERunner(roots);
+		} catch (IOException e) {
+			e.printStackTrace();
+			return null;
+		}
+
+		ImportCustomizer imports = new ImportCustomizer();
+		imports.addStarImports("org.txm.rcp.utils", "org.txm.utils", "org.txm", "org.kohsuke.args4j", "org.txm.rcp.swt.widget.parameters");
+		imports.addImports("groovy.transform.Field");
+		CompilerConfiguration configuration = new CompilerConfiguration();
+		configuration.addCompilationCustomizers(imports);
+		
+		defaultGSE.setConfig(configuration);
+		
+		File jardir = new File(scriptRootDir,"lib"); //$NON-NLS-1$
+		if (jardir.exists() && jardir.isDirectory()) {
+			for (File f: jardir.listFiles(new FilenameFilter() {
+				@Override
+				public boolean accept(File dir, String name) {
+					return name.endsWith(".jar"); //$NON-NLS-1$
+				}
+			}))
+			{
+				try {
+					defaultGSE.getGroovyClassLoader().addURL(f.toURI().toURL());
+				} catch (MalformedURLException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}	
+		defaultGSE.getGroovyClassLoader().addClasspath(scriptRootDir); // for the .class files if any
+		
+		return defaultGSE;
+	}
+	
+	/**
+	 * 
+	 * @return a class loader containing all bundles activated in TXM
+	 */
 	protected static ClassLoader getTXMClassLoader() {
 		HashSet<ClassLoader> loaders = new HashSet<ClassLoader>();
 		BundleContext bundleContext = InternalPlatform.getDefault().getBundleContext();
@@ -71,7 +155,7 @@
 
 	/**
 	 * Convenience method exactly the same as calling
-	 * run(class, ["args":args])
+	 * run(clazz, ["args":args])
 	 * 
 	 * @param clazz
 	 * @param args
@@ -88,7 +172,7 @@
 
 	/**
 	 * Convenience method exactly the same as calling
-	 * run(class, ["args":["var":"val, ...]])
+	 * run(clazz, ["args":[:]])
 	 * 
 	 * @param clazz
 	 * @param args
@@ -102,18 +186,4 @@
 		arrangedMap.put("args", new HashMap<String, Object>());
 		return run(clazz.getCanonicalName().replace(".", "/")+".groovy", new Binding(arrangedMap));
 	}
-
-	/**
-	 * Creates a new GSERunner and adds to it the class loaders of all installed bundles of the platform. 
-	 * @return a new GSERunner
-	 */
-	public static GSERunner createGSERunner(String[] urls)	{
-
-		GSERunner gse = null;
-
-
-
-		return gse;
-	}
-
 }
\ No newline at end of file
