Index: tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesParametersTab.java
===================================================================
--- tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesParametersTab.java	(revision 3021)
+++ tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesParametersTab.java	(revision 3022)
@@ -5,7 +5,7 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.TabFolder;
 import org.txm.properties.rcp.Messages;
-import org.txm.rcp.views.cmdparameters.ParametersComposite;
+import org.txm.rcp.views.cmdparameters.TXMResultParametersComposite;
 
 /**
  * Display the Properties parent parameters stored in the preferences 
@@ -13,13 +13,13 @@
  *
  */
 public class PropertiesParametersTab extends PropertiesTab {
-	private ParametersComposite parametersComposite;
+	private TXMResultParametersComposite parametersComposite;
 
 	public PropertiesParametersTab(TabFolder folder, PropertiesPagedEditor editor) {
 		super(folder, editor);
 		tab.setText(Messages.PropertiesParametersTab_1);
 		
-		parametersComposite = new ParametersComposite(parent, SWT.NONE);
+		parametersComposite = new TXMResultParametersComposite(parent, SWT.NONE);
 		parametersComposite.setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).create());
 		parametersComposite.updateEditorParameters(editor.getResult().getParent());
 		
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 3022)
@@ -293,7 +293,7 @@
 		t.setSourceFile(txmFile)
 		t.setTXMFile(txmFile)
 
-		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element);
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, basename, project);
 		Edition edition = new Edition(t)
 		edition.setName("default")
 		edition.setIndex(outdir.getAbsolutePath())
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/pager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/pager.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/pager.groovy	(revision 3022)
@@ -40,6 +40,7 @@
 import org.xml.sax.helpers.DefaultHandler;
 import org.txm.utils.io.FileCopy
 import org.txm.objects.Project
+import org.txm.utils.BundleUtils;
 
 /** Build a simple edition from a xml-tei. 
  * @author mdecorde */
@@ -71,6 +72,7 @@
 	boolean firstWord = true;
 	
 	boolean paginate = true;
+	boolean enableCollapsibles = false;
 
 	/** The wordvalue. */
 	String wordvalue = "";
@@ -133,7 +135,7 @@
 		this.paginationElement = project.getEditionDefinition("default").getPageElement()
 		this.paginate = project.getEditionDefinition("default").getPaginateEdition()
 		this.wordmax = project.getEditionDefinition("default").getWordsPerPage();
-		
+		this.enableCollapsibles = project.getEditionDefinition("default").getEnableCollapsibleMetadata();
 		this.basename = basename;
 		this.txtname = txtname;
 		this.outdir = outdir;
@@ -160,8 +162,9 @@
 					File txmhomeDir = corporaDir.getParentFile()
 					File txmcss = new File(txmhomeDir, "css/txm.css")
 					if (htmlDir.exists() && txmcss.exists()) {
-						FileCopy.copy(txmcss, new File(htmlDir, "txm.css"))
+						FileCopy.copy(txmcss, new File(htmlDir, txmcss.getName()))
 					}
+					BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "js", htmlDir);
 				}
 			}
 		} catch(Exception e) {
@@ -228,6 +231,9 @@
 			pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
 			pagedWriter.writeEndElement(); // </title>
 			pagedWriter.writeCharacters("\n")
+			pagedWriter.writeStartElement("script", ["src":"js/collapsible.js"]);
+			pagedWriter.writeEndElement(); // </script>
+			pagedWriter.writeCharacters("\n")
 			pagedWriter.writeEndElement() // </head>
 			pagedWriter.writeCharacters("\n")
 			pagedWriter.writeStartElement("body") //<body>
@@ -305,9 +311,16 @@
 					switch (localname) {
 						case "text":
 							pagedWriter.write("\n");
-							if (parser.getAttributeValue(null,"id") != null)
+							if (parser.getAttributeValue(null,"id") != null) {
 								pagedWriter.writeElement("h3", parser.getAttributeValue(null,"id"))
+							}
+							if (enableCollapsibles && parser.getAttributeCount() > 2) {
+								pagedWriter.writeStartElement("button", ["class":"collapsible", "onclick":"onCollapsibleClicked(this)"])
+								pagedWriter.writeCharacters("➕");
+								pagedWriter.writeEndElement()
+							}
 							pagedWriter.writeStartElement("table");
+							if (enableCollapsibles && parser.getAttributeCount() > 2) pagedWriter.writeAttribute("class", "collapsiblecontent")
 							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
 								pagedWriter.writeStartElement("tr");
 								pagedWriter.writeElement("td", parser.getAttributeLocalName(i));
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 3022)
@@ -314,15 +314,17 @@
 		t.setName(txtname);
 		t.setSourceFile(txmFile)
 		t.setTXMFile(txmFile)
-
-		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		
+		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, basename, "pb", project);
 		Edition edition = new Edition(t);
 		edition.setName("default");
 		edition.setIndex(outdir.getAbsolutePath());
 		for (i = 0 ; i < ed.getPageFiles().size();) {
 			File f = ed.getPageFiles().get(i);
 			String wordid = "w_0";
-				if (i < ed.getIdx().size()) wordid = ed.getIdx().get(i);
+			if (i < ed.getIdx().size()) {
+				wordid = ed.getIdx().get(i);
+			}
 			edition.addPage(""+(++i), wordid);
 		}
 	}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy	(revision 3022)
@@ -27,27 +27,29 @@
 //
 package org.txm.scripts.importer.doc;
 
-import org.txm.scripts.importer.*;
-import org.xml.sax.Attributes;
-import org.txm.importer.scripts.filters.*;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.stream.*;
-import java.net.URL;
-import org.xml.sax.InputSource;
-import org.xml.sax.helpers.DefaultHandler;
+import org.txm.scripts.importer.*
+import org.xml.sax.Attributes
+import org.txm.importer.scripts.filters.*
+import java.io.File
+import java.io.IOException
+import java.util.ArrayList
+import javax.xml.parsers.SAXParserFactory
+import javax.xml.parsers.ParserConfigurationException
+import javax.xml.parsers.SAXParser
+import javax.xml.stream.*
+import java.net.URL
+import org.xml.sax.InputSource
+import org.xml.sax.helpers.DefaultHandler
+import org.txm.objects.Project
 
-// TODO: Auto-generated Javadoc
 /** 
  * Build edition from xml-tei-odt
+ * 
  * @author mdecorde
  * 
  */
 class pager {
+	
 	List<String> NoSpaceBefore;
 
 	/** The No space after. */
@@ -71,7 +73,9 @@
 	String wordid;
 
 	/** The first word. */
-	boolean firstWord = true;
+	boolean firstWord = true
+	
+	boolean paginate = true
 
 	/** The wordvalue. */
 	String wordvalue;
@@ -80,50 +84,50 @@
 	String interpvalue;
 
 	/** The lastword. */
-	String lastword = " ";
+	String lastword = " "
 
 	/** The wordtype. */
 	String wordtype;
 
 	/** The flagform. */
-	boolean flagform = false;
+	boolean flagform = false
 
 	/** The flaginterp. */
-	boolean flaginterp = false;
+	boolean flaginterp = false
 
 	/** The url. */
-	private def url;
+	private def url
 
 	/** The input data. */
-	private def inputData;
+	private def inputData
 
 	/** The factory. */
-	private def factory;
+	private def factory
 
 	/** The parser. */
-	private XMLStreamReader parser;
+	private XMLStreamReader parser
 
 	/** The writer. */
-	OutputStreamWriter writer;
+	OutputStreamWriter writer
 
 	/** The multiwriter. */
-	OutputStreamWriter multiwriter = null;
+	OutputStreamWriter multiwriter = null
 
 	/** The pagedWriter. */
-	StaxStackWriter pagedWriter = null;
+	StaxStackWriter pagedWriter = null
 
 	/** The infile. */
-	File infile;
+	File infile
 
 	/** The outfile. */
-	File outfile;
+	File outfile
 
 	/** The pages. */
-	ArrayList<File> pages = new ArrayList<File>();
+	ArrayList<File> pages = new ArrayList<File>()
 
 	/** The idxstart. */
-	ArrayList<String> idxstart = new ArrayList<String>();
-	String editionPage;
+	ArrayList<String> idxstart = new ArrayList<String>()
+	String editionPage
 
 	/**
 	 * Instantiates a new pager.
@@ -136,16 +140,17 @@
 	 * @param basename the basename
 	 */
 	pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
-	List<String> NoSpaceAfter, int max, String basename, String editionPage) {
+	List<String> NoSpaceAfter, String basename, String editionPage, Project project) {
 		this.editionPage = editionPage;
 		this.basename = basename;
 		this.txtname = txtname;
 		this.outdir = outdir;
-		this.wordmax = max;
 		this.NoSpaceBefore = NoSpaceBefore;
 		this.NoSpaceAfter = NoSpaceAfter;
 		this.url = infile.toURI().toURL();
 		this.infile = infile;
+		this.wordmax = project.getEditionDefinition("default").getWordsPerPage();
+		this.paginate = project.getEditionDefinition("default").getPaginateEdition()
 
 		inputData = url.openStream();
 		factory = XMLInputFactory.newInstance();
@@ -153,8 +158,7 @@
 		process();
 	}
 
-	private def closeMultiWriter()
-	{
+	private def closeMultiWriter() {
 		if (pagedWriter != null) {
 			def tags = pagedWriter.getTagStack().clone();
 			if (firstWord) { // there was no words
@@ -179,8 +183,7 @@
 	 *
 	 * @return true, if successful
 	 */
-	private boolean createNextOutput()
-	{
+	private boolean createNextOutput() {
 		wordcount = 0;
 		try {
 			def tags = closeMultiWriter()
@@ -276,7 +279,8 @@
 						localname = parser.getLocalName();
 
 						if (localname == editionPage) {
-							createNextOutput();
+							if (paginate) createNextOutput();
+							
 							wordcount=0;
 							if (parser.getAttributeValue(null,"n") != null) {
 								pagedWriter.writeStartElement("p", ["style":"color:red", "align":"center"])
@@ -400,7 +404,7 @@
 							case "q":
 								pagedWriter.writeEndElement(); // p
 								pagedWriter.writeCharacters("\t")
-								if (wordcount >= wordmax) {
+								if (paginate && wordcount >= wordmax) {
 									createNextOutput();
 								}
 								break;
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy	(revision 3022)
@@ -77,6 +77,14 @@
 File newSrcDir = new File(binDir, "src")
 newSrcDir.mkdir();
 File alcesteFile = new File(newSrcDir, srcDir.getName()+".txt");
+
+if (!alcesteFile.exists()) {
+	println "Error: import module was expecting to find the $alcesteFile file to continue. Aborting."
+	return false
+} else {
+	println "Reading $alcesteFile..."
+}
+
 FactivaMail2Alceste converter = new FactivaMail2Alceste(srcDir, alcesteFile, "UTF-8", "UTF-8")
 if (!converter.doparse()) {
 	println "Failed to convert files in $srcDir to one Alceste file"
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/pager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/pager.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/pager.groovy	(revision 3022)
@@ -76,8 +76,8 @@
 	boolean firstWord = true
 	
 	boolean paginate = true
+	boolean enableCollapsibles = false;
 	
-	
 	/** The wordvalue. */
 	String wordvalue;
 	
@@ -162,7 +162,6 @@
 	pager(File txmfile, File htmlDir, String txtname, List<String> NoSpaceBefore,
 	List<String> NoSpaceAfter, String corpusname, String cuttingTag, Metadatas metadatas, Project project) {
 		this.metadatas = metadatas
-		this.wordmax = project.getEditionDefinition("default").getWordsPerPage();
 		this.cuttingTag = cuttingTag;
 		this.corpusname = corpusname;
 		this.NoSpaceBefore = NoSpaceBefore;
@@ -171,7 +170,9 @@
 		this.txmfile = txmfile;
 		this.htmlDir = htmlDir;
 		this.txtname = txtname;
+		this.wordmax = project.getEditionDefinition("default").getWordsPerPage();
 		this.paginate = project.getEditionDefinition("default").getPaginateEdition()
+		this.enableCollapsibles = project.getEditionDefinition("default").getEnableCollapsibleMetadata();
 		
 		inputData = url.openStream();
 		factory = XMLInputFactory.newInstance();
@@ -242,20 +243,34 @@
 		writer.writeAttribute("content", "text/html");
 		writer.writeAttribute("charset", "UTF-8");
 		writer.writeEndElement(); // meta
+		writer.writeCharacters("\n")
 		writer.writeStartElement("head");
 		//<link rel="stylesheet" type="text/css" href="class.css" />
 		writer.writeStartElement("link");
 		writer.writeAttribute("rel", "stylesheet");
 		writer.writeAttribute("type", "text/css");
+		writer.writeAttribute("href", "txm.css");
+		writer.writeEndElement(); // link
+		writer.writeCharacters("\n")
+		writer.writeStartElement("link");
+		writer.writeAttribute("rel", "stylesheet");
+		writer.writeAttribute("type", "text/css");
 		writer.writeAttribute("href", "transcriber.css");
 		writer.writeEndElement(); // link
+		writer.writeCharacters("\n")
 		writer.writeStartElement("link");
 		writer.writeAttribute("rel", "stylesheet");
 		writer.writeAttribute("type", "text/css");
 		writer.writeAttribute("href", corpusname+".css");
 		writer.writeEndElement(); // link
+		writer.writeCharacters("\n")
+		writer.writeStartElement("script");
+		writer.writeAttribute("src", "js/collapsible.js");
+		writer.writeCharacters("\n")
+		writer.writeEndElement(); // link
+		writer.writeCharacters("\n")
 		writer.writeEndElement(); // head
-		
+		writer.writeCharacters("\n")
 		nbBreak++
 		writer.writeStartElement("body");
 		writer.writeAttribute("class", "txmeditionpage")
@@ -283,6 +298,7 @@
 							writeMediaAccess("0.0")
 						
 							writer.writeEndElement(); // h1
+							writer.writeCharacters("\n")
 						
 							String subtitle = parser.getAttributeValue(null, "subtitle");
 							if (subtitle != null && subtitle.length() > 0) {
@@ -290,10 +306,23 @@
 								writer.writeAttribute("class", "subtitle");
 								writer.writeCharacters(subtitle);
 								writer.writeEndElement(); // h2
+								writer.writeCharacters("\n")
 							}
 						
+							if (enableCollapsibles && parser.getAttributeCount() > 2) {
+								writer.writeStartElement("button");
+								writer.writeAttribute("class", "collapsible");
+								writer.writeAttribute("onclick", "onCollapsibleClicked(this)");
+								writer.writeCharacters("➕");
+								writer.writeEndElement()
+								writer.writeCharacters("\n")
+							}
 							writer.writeStartElement("table");
-							writer.writeAttribute("class", "transcription-table");
+							if (enableCollapsibles && parser.getAttributeCount() > 2) {
+								writer.writeAttribute("class", "transcription-table collapsiblecontent")
+							} else {
+								writer.writeAttribute("class", "transcription-table");
+							}
 							boolean grey = false;
 							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
 								String name = parser.getAttributeName(i);
@@ -464,13 +493,26 @@
 						
 						// write metadata HTML
 							if (metadataGroups.keySet().size() > 0) {
-								writer.writeStartElement("p")
-								writer.writeAttribute("class", "section-all-metadata");
+								
+								if (enableCollapsibles && metadataGroups.keySet().size() > 2) {
+									writer.writeStartElement("button");
+									writer.writeAttribute("class", "collapsible");
+									writer.writeAttribute("onclick", "onCollapsibleClicked(this)");
+									writer.writeCharacters("➕");
+									writer.writeEndElement()
+									writer.writeCharacters("\n")
+								}
+								writer.writeStartElement("div");
+								if (enableCollapsibles && metadataGroups.keySet().size() > 2) {
+									writer.writeAttribute("class", "section-all-metadata collapsiblecontent")
+								} else {
+									writer.writeAttribute("class", "section-all-metadata");
+								}
 								for (String groupName : metadataGroups.keySet()) {
 									def group = metadataGroups[groupName]
 									if (group.size() > 0) {
 										if (groupName.equals("text")) {
-											writer.writeStartElement("p")
+											writer.writeStartElement("div")
 											writer.writeAttribute("class", "section-"+groupName);
 											for (String k : group) {
 												writer.writeStartElement("p")
@@ -480,7 +522,9 @@
 												writer.writeEndElement() // h4
 												writer.writeCharacters(metadata[k])
 												writer.writeEndElement() // p
+												writer.writeCharacters("\n")
 											}
+											writer.writeEndElement(); // p
 										} else { // 'metadata' and other groups
 											writer.writeStartElement("ul")
 											writer.writeAttribute("class", "section-"+groupName);
@@ -490,12 +534,13 @@
 												writer.writeCharacters(""+k+": "+metadata[k])
 												writer.writeEndElement() // li
 											}
+											writer.writeEndElement(); // ul
+											writer.writeCharacters("\n")
 										}
-										
-										writer.writeEndElement(); // ul or p
 									}
 								}
 								writer.writeEndElement(); // p
+								writer.writeCharacters("\n")
 								writer.writeEmptyElement("hr")
 							}
 						
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 3022)
@@ -343,9 +343,10 @@
 		File cssfile = new File(Toolbox.getTxmHomePath(), "css/transcriber.css")
 		File cssTXMFile = new File(Toolbox.getTxmHomePath(), "css/txm.css")
 		if (cssfile.exists() && htmlDir.exists()) {
-			FileCopy.copy(cssfile, new File(htmlDir, "default/txm.css"));
+			FileCopy.copy(cssTXMFile, new File(htmlDir, "default/txm.css"));
 			FileCopy.copy(cssfile, new File(htmlDir, "default/transcriber.css"));
 		}
+		BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "js", new File(htmlDir, "default"));
 
 		//copy media files
 		println "Copying media files if any (mp3, wav, mp4 or avi) "+xmltxmFiles.size()+" texts"
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy	(revision 3022)
@@ -29,7 +29,7 @@
 
 import org.txm.scripts.importer.alceste.importer;
 import org.txm.scripts.importer.alceste.compiler;
-import org.txm.scripts.importer.xml.pager_old;
+import org.txm.scripts.importer.xml.pager;
 import org.txm.objects.*;
 import org.txm.utils.*;
 import org.txm.*;
@@ -145,7 +145,7 @@
 		t.setSourceFile(srcfile)
 		t.setTXMFile(srcfile)
 		
-		def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
+		def ed = new pager(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, basename, project);
 		Edition edition = new Edition(t);
 		edition.setName("default");
 		edition.setIndex(outdir.getAbsolutePath());
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperbase/importer.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperbase/importer.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperbase/importer.groovy	(revision 3022)
@@ -2,19 +2,19 @@
 // Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
 // Lyon 2, University of Franche-Comté, University of Nice
 // Sophia Antipolis, University of Paris 3.
-// 
+//
 // The TXM platform is free software: you can redistribute it
 // and/or modify it under the terms of the GNU General Public
 // License as published by the Free Software Foundation,
 // either version 2 of the License, or (at your option) any
 // later version.
-// 
+//
 // The TXM platform is distributed in the hope that it will be
 // useful, but WITHOUT ANY WARRANTY; without even the implied
 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 // PURPOSE. See the GNU General Public License for more
 // details.
-// 
+//
 // You should have received a copy of the GNU General
 // Public License along with the TXM platform. If not, see
 // http://www.gnu.org/licenses.
@@ -57,7 +57,7 @@
  * The Class importer.
  */
 class importer {
-
+	
 	/**
 	 * Run.
 	 *
@@ -70,38 +70,40 @@
 	{
 		String rootDir = srcDir.getAbsolutePath()+"/"
 		//cleaning
-
+		
 		new File(binDir,"ptokenized").deleteDir();
 		new File(binDir,"ptokenized").mkdir();
 		new File(binDir,"tokenized").deleteDir();
 		new File(binDir,"tokenized").mkdir();
 		new File(binDir,"split").deleteDir();
 		new File(binDir,"split").mkdir();
-
+		
 		ArrayList<String> milestones = new ArrayList<String>();//the tags who you want them to stay milestones
 		milestones.add("tagUsage");
 		milestones.add("pb");
 		milestones.add("lb");
-
+		
 		//build xml files
 		if (srcDir.listFiles() == null || srcDir.listFiles().size() == 0 ) {
 			println "No corpus file in: "+srcDir;
 			return false;
 		}
-		File corpusfile = null;
-		for (File f : srcDir.listFiles()) {
-			if (!f.isHidden() && f.canRead() && f.isFile() && f.getName() != "import.xml") {
-				corpusfile = f;
-				break;
+		File corpusfile = new File(srcDir, srcDir.getName());
+		if (!corpusfile.exists()) {
+			for (File f : srcDir.listFiles()) {
+				if (!f.isHidden() && f.canRead() && f.isFile() && f.getName() != "import.xml") {
+					corpusfile = f;
+					break;
+				}
 			}
 		}
-
+		
 		System.out.println("Corpus file: "+corpusfile);
 		if (!new Hyperbase2Xml().run(corpusfile, new File(binDir, "split"), encoding)) {
 			println("Failed to split the corpus file into text: "+corpusfile);
 			return false;
 		}
-
+		
 		//TOKENIZE ALL FILES
 		List<File> srcfiles = new File(binDir, "split").listFiles();
 		println("Tokenizing "+srcfiles.size()+" files");
@@ -109,7 +111,7 @@
 			print "."
 			String filename = pfile.getName().substring(0, pfile.getName().length()-4)
 			File tfile = new File(binDir, "tokenized/"+filename+".xml");
-
+			
 			SimpleTokenizerXml tokenizer = new SimpleTokenizerXml(pfile, tfile, lang);
 			if (!tokenizer.process()) {
 				println("Failed to tokenize file: "+pfile);
@@ -117,7 +119,7 @@
 			}
 		}
 		println ""
-
+		
 		//Tag sentences
 		List<File> stokenfiles = new File(binDir,"tokenized").listFiles()
 		new File(binDir,"stokenized").mkdir();
@@ -135,7 +137,7 @@
 				File infile = new File(binDir, "tokenized/"+f.getName());
 				File xmlfile = new File(binDir, "stokenized/"+f.getName());
 				File headerfile = new File(binDir, "tokenized/"+f.getName()+"header.xml");
-
+				
 				S.SetInFileAndOutFile(infile.getPath(), xmlfile.getPath());
 				S.setEncodages("UTF-8","UTF-8");
 				Object[] arguments1 = [headerfile.getAbsolutePath()];
@@ -148,7 +150,7 @@
 			} catch (Exception e) {println "Failed to sentence file "+f;println e;}
 		}
 		println ""
-
+		
 		//TRANSFORM INTO XML-TEI-TXM
 		List<File> tokenfiles = new File(binDir, "stokenized").listFiles()
 		println("Building xml-txm ("+tokenfiles.size()+" files)")
@@ -156,7 +158,7 @@
 			print "."
 			File file = f;
 			String txmfile = f.getName();
-
+			
 			def correspType = new HashMap<String,String>()
 			def correspRef = new HashMap<String,String>()
 			//il faut lister les id de tous les respStmt
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 3022)
@@ -164,10 +164,14 @@
 		if (cssDirectory.exists()) {
 			FileCopy.copyFiles(cssDirectory, csshtmlDirectory)
 		}
+		
+		BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "js", outputDirectory);
 		if (jsDirectory.exists()) {
 			File jshtmlDirectory = new File(outputDirectory, "js")
 			FileCopy.copyFiles(jsDirectory, jshtmlDirectory)
 		}
+		
+		
 		if (imagesDirectory.exists()) {
 			File imageshtmlDirectory = new File(outputDirectory, "images")
 			FileCopy.copyFiles(imagesDirectory, imageshtmlDirectory)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 3022)
@@ -38,6 +38,8 @@
 	/** The first word. */
 	boolean firstWord = true;
 	
+	boolean enableCollapsibles = false;
+	
 	/** The wordvalue. */
 	String wordvalue = "";
 	
@@ -120,6 +122,7 @@
 		this.infile = infile;
 		this.wordTag= pager.wordTag;
 		outdir.mkdirs()
+		this.enableCollapsibles = pager.getImportModule().getProject().getEditionDefinition("default").getEnableCollapsibleMetadata();
 		
 		inputData = new BufferedInputStream(url.openStream());
 		factory = XMLInputFactory.newInstance();
@@ -225,6 +228,8 @@
 			pagedWriter.writeStartElement("title")
 			pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
 			pagedWriter.writeEndElement(); // </title>
+			pagedWriter.writeStartElement("script", ["src":"js/collapsible.js"]);
+			pagedWriter.writeEndElement(); // </script>
 			pagedWriter.writeEndElement() // </head>
 			pagedWriter.writeCharacters("\n")
 			pagedWriter.writeStartElement("body") //<body>
@@ -345,7 +350,14 @@
 									pagedWriter.writeElement("h3", attributes["id"])
 								}
 							
-								pagedWriter.writeStartElement("table")
+								if (enableCollapsibles && attributes.keySet().size() > 2) {
+									pagedWriter.writeStartElement("button", ["class":"collapsible", "onclick":"onCollapsibleClicked(this)"])
+									pagedWriter.writeCharacters("➕");
+									pagedWriter.writeEndElement()
+								}
+								
+								pagedWriter.writeStartElement("table");
+								if (enableCollapsibles && attributes.keySet().size() > 2) pagedWriter.writeAttribute("class", "collapsiblecontent")
 								for (String k : attributes.keySet()) {
 									if (k == "id") continue;
 									if (k == "rend") continue;
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/RenameSpeaker.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/RenameSpeaker.groovy	(revision 3021)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/transcription/RenameSpeaker.groovy	(revision 3022)
@@ -63,7 +63,6 @@
 			DocumentBuilder builder = domFactory.newDocumentBuilder();
 			doc = builder.parse(transcriptionfile);
 			
-			
 			def expr2 = XPathFactory.newInstance().newXPath().compile("//Speaker");
 			def nodes2 = expr2.evaluate(doc, XPathConstants.NODESET);
 			
@@ -146,6 +145,5 @@
 		File trs2 = new File(homedir, "xml/concattrs/int18_1-renamed.trs")
 		
 		new RenameSpeaker(trs1, trs2, "spk2", null, "spk4", null).process();
-		
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java	(revision 3021)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java	(revision 3022)
@@ -69,6 +69,8 @@
 	
 	public static final String EDITION_DEFINITION_WORDS_PER_PAGE = "edition_definition_words_per_page"; //$NON-NLS-1$
 	
+	public static final String EDITION_DEFINITION_ENABLE_COLLAPSIBLE_METADATA = "edition_definition_enable_collapsible"; //$NON-NLS-1$
+	
 	public static final String EDITION_DEFINITION_PAGE_BREAK_ELEMENT = "edition_definition_page_break_element"; //$NON-NLS-1$
 	
 	public static final String EDITION_DEFINITION_IMAGES_DIRECTORY = "edition_definition_images_directory"; //$NON-NLS-1$
@@ -78,9 +80,11 @@
 	 */
 	public static final String SHOW_ALL_RESULT_NODES = "show_all_result_nodes"; //$NON-NLS-1$
 	
+	/*
+	 * Base URL of TXM update site
+	 */
 	public static final String UPDATESITE = "update_site"; //$NON-NLS-1$
 	
-	
 	/**
 	 * To enable/disable the results persistence (save after a computing and load at Toolbox start).
 	 */
Index: tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java	(revision 3021)
+++ tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java	(revision 3022)
@@ -38,6 +38,10 @@
 		return node.getInt(TBXPreferences.EDITION_DEFINITION_WORDS_PER_PAGE, 500);
 	}
 	
+	public boolean getEnableCollapsibleMetadata() {
+		return node.getBoolean(TBXPreferences.EDITION_DEFINITION_ENABLE_COLLAPSIBLE_METADATA, false);
+	}
+	
 	public String getPageElement() {
 		return node.get(TBXPreferences.EDITION_DEFINITION_PAGE_BREAK_ELEMENT, "pb");
 	}
@@ -78,6 +82,10 @@
 		}
 	}
 	
+	public void setEnableCollapsible(boolean enable) {
+		node.putBoolean(TBXPreferences.EDITION_DEFINITION_ENABLE_COLLAPSIBLE_METADATA, enable);
+	}
+	
 	public void setWordsPerPage(int words_per_page) {
 		node.putInt(TBXPreferences.EDITION_DEFINITION_WORDS_PER_PAGE, words_per_page);
 	}
@@ -118,8 +126,8 @@
 		}
 		return buffer.toString();
 	}
-
+	
 	public void setPaginateEdition(boolean paginate) {
-		node.putBoolean(TBXPreferences.EDITION_DEFINITION_PAGINATE, paginate);		
+		node.putBoolean(TBXPreferences.EDITION_DEFINITION_PAGINATE, paginate);
 	}
 }
Index: tmp/org.txm.core/res/org/txm/css/txm.css
===================================================================
--- tmp/org.txm.core/res/org/txm/css/txm.css	(revision 3021)
+++ tmp/org.txm.core/res/org/txm/css/txm.css	(revision 3022)
@@ -84,4 +84,25 @@
 
 td[rend="table-cell-align-center"] {
 	text-align: center;
-}
\ No newline at end of file
+}
+
+/* collapsible objects styling */
+.collapsible {
+  background-color: #777;
+  color: white;
+  cursor: pointer;
+  width: 100%;
+  border: none;
+  text-align: left;
+  font-weight: bold;
+  outline: none;
+}
+
+.active, .collapsible:hover {
+  background-color: #555;
+}
+
+.collapsiblecontent {
+  display: none;
+  overflow: hidden;
+}
Index: tmp/org.txm.core/res/org/txm/js/test_sel.html
===================================================================
--- tmp/org.txm.core/res/org/txm/js/test_sel.html	(revision 3021)
+++ tmp/org.txm.core/res/org/txm/js/test_sel.html	(revision 3022)
@@ -1,28 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Demo</title>
-</head>
-<body>
-	<button>TEST SELECTION</button>
-	<script src="http://code.jquery.com/jquery-latest.js"></script>
-	<script src="jquery.selection.js"></script>
-	<script>
-$( document ).ready(function() {
-$( "button" ).click(function( event ) {
-var sel = window.getSelection()
-alert( $(sel).find("span");
-event.preventDefault();
-
-
-});
-});
-</script>
-
-	<p>
-		<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span>
-		<span id="w_2" title="mot">mot</span>
-	</p>
-</body>
-</html>
Index: tmp/org.txm.core/res/org/txm/js/jquery.selection.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/jquery.selection.js	(revision 3021)
+++ tmp/org.txm.core/res/org/txm/js/jquery.selection.js	(revision 3022)
@@ -1,354 +0,0 @@
-/*!
- * jQuery.selection - jQuery Plugin
- *
- * Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
- * http://blog.madapaja.net/
- * Under The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-(function($, win, doc) {
-    /**
-     * get caret status of the selection of the element
-     *
-     * @param   {Element}   element         target DOM element
-     * @return  {Object}    return
-     * @return  {String}    return.text     selected text
-     * @return  {Number}    return.start    start position of the selection
-     * @return  {Number}    return.end      end position of the selection
-     */
-    var _getCaretInfo = function(element){
-        var res = {
-            text: '',
-            start: 0,
-            end: 0
-        };
-
-        if (!element.value) {
-            /* no value or empty string */
-            return res;
-        }
-
-        try {
-            if (win.getSelection) {
-                /* except IE */
-                res.start = element.selectionStart;
-                res.end = element.selectionEnd;
-                res.text = element.value.slice(res.start, res.end);
-            } else if (doc.selection) {
-                /* for IE */
-                element.focus();
-
-                var range = doc.selection.createRange(),
-                    range2 = doc.body.createTextRange();
-
-                res.text = range.text;
-
-                try {
-                    range2.moveToElementText(element);
-                    range2.setEndPoint('StartToStart', range);
-                } catch (e) {
-                    range2 = element.createTextRange();
-                    range2.setEndPoint('StartToStart', range);
-                }
-
-                res.start = element.value.length - range2.text.length;
-                res.end = res.start + range.text.length;
-            }
-        } catch (e) {
-            /* give up */
-        }
-
-        return res;
-    };
-
-    /**
-     * caret operation for the element
-     * @type {Object}
-     */
-    var _CaretOperation = {
-        /**
-         * get caret position
-         *
-         * @param   {Element}   element         target element
-         * @return  {Object}    return
-         * @return  {Number}    return.start    start position for the selection
-         * @return  {Number}    return.end      end position for the selection
-         */
-        getPos: function(element) {
-            var tmp = _getCaretInfo(element);
-            return {start: tmp.start, end: tmp.end};
-        },
-
-        /**
-         * set caret position
-         *
-         * @param   {Element}   element         target element
-         * @param   {Object}    toRange         caret position
-         * @param   {Number}    toRange.start   start position for the selection
-         * @param   {Number}    toRange.end     end position for the selection
-         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
-         */
-        setPos: function(element, toRange, caret) {
-            caret = this._caretMode(caret);
-
-            if (caret === 'start') {
-                toRange.end = toRange.start;
-            } else if (caret === 'end') {
-                toRange.start = toRange.end;
-            }
-
-            element.focus();
-            try {
-                if (element.createTextRange) {
-                    var range = element.createTextRange();
-
-                    if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
-                        toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
-                        toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
-                    }
-
-                    range.collapse(true);
-                    range.moveStart('character', toRange.start);
-                    range.moveEnd('character', toRange.end - toRange.start);
-
-                    range.select();
-                } else if (element.setSelectionRange) {
-                    element.setSelectionRange(toRange.start, toRange.end);
-                }
-            } catch (e) {
-                /* give up */
-            }
-        },
-
-        /**
-         * get selected text
-         *
-         * @param   {Element}   element         target element
-         * @return  {String}    return          selected text
-         */
-        getText: function(element) {
-            return _getCaretInfo(element).text;
-        },
-
-        /**
-         * get caret mode
-         *
-         * @param   {String}    caret           caret mode
-         * @return  {String}    return          any of the following: "keep" | "start" | "end"
-         */
-        _caretMode: function(caret) {
-            caret = caret || "keep";
-            if (caret === false) {
-                caret = 'end';
-            }
-
-            switch (caret) {
-                case 'keep':
-                case 'start':
-                case 'end':
-                    break;
-
-                default:
-                    caret = 'keep';
-            }
-
-            return caret;
-        },
-
-        /**
-         * replace selected text
-         *
-         * @param   {Element}   element         target element
-         * @param   {String}    text            replacement text
-         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
-         */
-        replace: function(element, text, caret) {
-            var tmp = _getCaretInfo(element),
-                orig = element.value,
-                pos = $(element).scrollTop(),
-                range = {start: tmp.start, end: tmp.start + text.length};
-
-            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
-
-            $(element).scrollTop(pos);
-            this.setPos(element, range, caret);
-        },
-
-        /**
-         * insert before the selected text
-         *
-         * @param   {Element}   element         target element
-         * @param   {String}    text            insertion text
-         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
-         */
-        insertBefore: function(element, text, caret) {
-            var tmp = _getCaretInfo(element),
-                orig = element.value,
-                pos = $(element).scrollTop(),
-                range = {start: tmp.start + text.length, end: tmp.end + text.length};
-
-            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
-
-            $(element).scrollTop(pos);
-            this.setPos(element, range, caret);
-        },
-
-        /**
-         * insert after the selected text
-         *
-         * @param   {Element}   element         target element
-         * @param   {String}    text            insertion text
-         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
-         */
-        insertAfter: function(element, text, caret) {
-            var tmp = _getCaretInfo(element),
-                orig = element.value,
-                pos = $(element).scrollTop(),
-                range = {start: tmp.start, end: tmp.end};
-
-            element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
-
-            $(element).scrollTop(pos);
-            this.setPos(element, range, caret);
-        }
-    };
-
-    /* add jQuery.selection */
-    $.extend({
-        /**
-         * get selected text on the window
-         *
-         * @param   {String}    mode            selection mode: any of the following: "text" | "html"
-         * @return  {String}    return
-         */
-        selection: function(mode) {
-            var getText = ((mode || 'text').toLowerCase() === 'text');
-
-            try {
-                if (win.getSelection) {
-                    if (getText) {
-                        // get text
-                        return win.getSelection().toString();
-                    } else {
-                        // get html
-                        var sel = win.getSelection(), range;
-
-                        if (sel.getRangeAt) {
-                            range = sel.getRangeAt(0);
-                        } else {
-                            range = doc.createRange();
-                            range.setStart(sel.anchorNode, sel.anchorOffset);
-                            range.setEnd(sel.focusNode, sel.focusOffset);
-                        }
-
-                        return $('<div></div>').append(range.cloneContents()).html();
-                    }
-                } else if (doc.selection) {
-                    if (getText) {
-                        // get text
-                        return doc.selection.createRange().text;
-                    } else {
-                        // get html
-                        return doc.selection.createRange().htmlText;
-                    }
-                }
-            } catch (e) {
-                /* give up */
-            }
-
-            return '';
-        }
-    });
-
-    /* add selection */
-    $.fn.extend({
-        selection: function(mode, opts) {
-            opts = opts || {};
-
-            switch (mode) {
-                /**
-                 * selection('getPos')
-                 * get caret position
-                 *
-                 * @return  {Object}    return
-                 * @return  {Number}    return.start    start position for the selection
-                 * @return  {Number}    return.end      end position for the selection
-                 */
-                case 'getPos':
-                    return _CaretOperation.getPos(this[0]);
-
-                /**
-                 * selection('setPos', opts)
-                 * set caret position
-                 *
-                 * @param   {Number}    opts.start      start position for the selection
-                 * @param   {Number}    opts.end        end position for the selection
-                 */
-                case 'setPos':
-                    return this.each(function() {
-                        _CaretOperation.setPos(this, opts);
-                    });
-
-                /**
-                 * selection('replace', opts)
-                 * replace the selected text
-                 *
-                 * @param   {String}    opts.text            replacement text
-                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
-                 */
-                case 'replace':
-                    return this.each(function() {
-                        _CaretOperation.replace(this, opts.text, opts.caret);
-                    });
-
-                /**
-                 * selection('insert', opts)
-                 * insert before/after the selected text
-                 *
-                 * @param   {String}    opts.text            insertion text
-                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
-                 * @param   {String}    opts.mode            insertion mode: any of the following: "before" | "after"
-                 */
-                case 'insert':
-                    return this.each(function() {
-                        if (opts.mode === 'before') {
-                            _CaretOperation.insertBefore(this, opts.text, opts.caret);
-                        } else {
-                            _CaretOperation.insertAfter(this, opts.text, opts.caret);
-                        }
-                    });
-
-                /**
-                 * selection('get')
-                 * get selected text
-                 *
-                 * @return  {String}    return
-                 */
-                case 'get':
-                    /* falls through */
-                default:
-                    return _CaretOperation.getText(this[0]);
-            }
-
-            return this;
-        }
-    });
-})(jQuery, window, window.document);
Index: tmp/org.txm.core/res/org/txm/js/testjquery.html
===================================================================
--- tmp/org.txm.core/res/org/txm/js/testjquery.html	(revision 3021)
+++ tmp/org.txm.core/res/org/txm/js/testjquery.html	(revision 3022)
@@ -1,28 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Demo</title>
-</head>
-<body>
-	<button>TEST SELECTION</button>
-	<script src="http://code.jquery.com/jquery-latest.js"></script>
-	<script src="jquery.selection.js"></script>
-	<script>
-$( document ).ready(function() {
-$( "button" ).click(function( event ) {
-var sel = window.getSelection()
-alert( $(sel).find("span");
-event.preventDefault();
-
-
-});
-});
-</script>
-
-	<p>
-		<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span>
-		<span id="w_2" title="mot">mot</span>
-	</p>
-</body>
-</html>
Index: tmp/org.txm.core/res/org/txm/js/collapsible.js
===================================================================
--- tmp/org.txm.core/res/org/txm/js/collapsible.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/js/collapsible.js	(revision 3022)
@@ -0,0 +1,15 @@
+// add a click listeners to all 'collapsible' class objects when the page is loaded
+
+
+function onCollapsibleClicked(node) {
+
+    node.classList.toggle("active");
+    var content = node.nextElementSibling;
+    if (content.style.display === "block") {
+      content.style.display = "none";
+	node.textContent="➕"
+    } else {
+      content.style.display = "block";
+node.textContent="➖"
+    }
+}
\ No newline at end of file

Property changes on: tmp/org.txm.core/res/org/txm/js/collapsible.js
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/jstest/testjquery.html
===================================================================
--- tmp/org.txm.core/res/org/txm/jstest/testjquery.html	(revision 0)
+++ tmp/org.txm.core/res/org/txm/jstest/testjquery.html	(revision 3022)
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Demo</title>
+</head>
+<body>
+	<button>TEST SELECTION</button>
+	<script src="http://code.jquery.com/jquery-latest.js"></script>
+	<script src="jquery.selection.js"></script>
+	<script>
+$( document ).ready(function() {
+$( "button" ).click(function( event ) {
+var sel = window.getSelection()
+alert( $(sel).find("span");
+event.preventDefault();
+
+
+});
+});
+</script>
+
+	<p>
+		<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span>
+		<span id="w_2" title="mot">mot</span>
+	</p>
+</body>
+</html>

Property changes on: tmp/org.txm.core/res/org/txm/jstest/testjquery.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/jstest/test_sel.html
===================================================================
--- tmp/org.txm.core/res/org/txm/jstest/test_sel.html	(revision 0)
+++ tmp/org.txm.core/res/org/txm/jstest/test_sel.html	(revision 3022)
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Demo</title>
+</head>
+<body>
+	<button>TEST SELECTION</button>
+	<script src="http://code.jquery.com/jquery-latest.js"></script>
+	<script src="jquery.selection.js"></script>
+	<script>
+$( document ).ready(function() {
+$( "button" ).click(function( event ) {
+var sel = window.getSelection()
+alert( $(sel).find("span");
+event.preventDefault();
+
+
+});
+});
+</script>
+
+	<p>
+		<span id="w_0" title="un">un</span> <span id="w_1" title="premier">premier</span>
+		<span id="w_2" title="mot">mot</span>
+	</p>
+</body>
+</html>

Property changes on: tmp/org.txm.core/res/org/txm/jstest/test_sel.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/res/org/txm/jstest/jquery.selection.js
===================================================================
--- tmp/org.txm.core/res/org/txm/jstest/jquery.selection.js	(revision 0)
+++ tmp/org.txm.core/res/org/txm/jstest/jquery.selection.js	(revision 3022)
@@ -0,0 +1,354 @@
+/*!
+ * jQuery.selection - jQuery Plugin
+ *
+ * Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
+ * http://blog.madapaja.net/
+ * Under The MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+(function($, win, doc) {
+    /**
+     * get caret status of the selection of the element
+     *
+     * @param   {Element}   element         target DOM element
+     * @return  {Object}    return
+     * @return  {String}    return.text     selected text
+     * @return  {Number}    return.start    start position of the selection
+     * @return  {Number}    return.end      end position of the selection
+     */
+    var _getCaretInfo = function(element){
+        var res = {
+            text: '',
+            start: 0,
+            end: 0
+        };
+
+        if (!element.value) {
+            /* no value or empty string */
+            return res;
+        }
+
+        try {
+            if (win.getSelection) {
+                /* except IE */
+                res.start = element.selectionStart;
+                res.end = element.selectionEnd;
+                res.text = element.value.slice(res.start, res.end);
+            } else if (doc.selection) {
+                /* for IE */
+                element.focus();
+
+                var range = doc.selection.createRange(),
+                    range2 = doc.body.createTextRange();
+
+                res.text = range.text;
+
+                try {
+                    range2.moveToElementText(element);
+                    range2.setEndPoint('StartToStart', range);
+                } catch (e) {
+                    range2 = element.createTextRange();
+                    range2.setEndPoint('StartToStart', range);
+                }
+
+                res.start = element.value.length - range2.text.length;
+                res.end = res.start + range.text.length;
+            }
+        } catch (e) {
+            /* give up */
+        }
+
+        return res;
+    };
+
+    /**
+     * caret operation for the element
+     * @type {Object}
+     */
+    var _CaretOperation = {
+        /**
+         * get caret position
+         *
+         * @param   {Element}   element         target element
+         * @return  {Object}    return
+         * @return  {Number}    return.start    start position for the selection
+         * @return  {Number}    return.end      end position for the selection
+         */
+        getPos: function(element) {
+            var tmp = _getCaretInfo(element);
+            return {start: tmp.start, end: tmp.end};
+        },
+
+        /**
+         * set caret position
+         *
+         * @param   {Element}   element         target element
+         * @param   {Object}    toRange         caret position
+         * @param   {Number}    toRange.start   start position for the selection
+         * @param   {Number}    toRange.end     end position for the selection
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        setPos: function(element, toRange, caret) {
+            caret = this._caretMode(caret);
+
+            if (caret === 'start') {
+                toRange.end = toRange.start;
+            } else if (caret === 'end') {
+                toRange.start = toRange.end;
+            }
+
+            element.focus();
+            try {
+                if (element.createTextRange) {
+                    var range = element.createTextRange();
+
+                    if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
+                        toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
+                        toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
+                    }
+
+                    range.collapse(true);
+                    range.moveStart('character', toRange.start);
+                    range.moveEnd('character', toRange.end - toRange.start);
+
+                    range.select();
+                } else if (element.setSelectionRange) {
+                    element.setSelectionRange(toRange.start, toRange.end);
+                }
+            } catch (e) {
+                /* give up */
+            }
+        },
+
+        /**
+         * get selected text
+         *
+         * @param   {Element}   element         target element
+         * @return  {String}    return          selected text
+         */
+        getText: function(element) {
+            return _getCaretInfo(element).text;
+        },
+
+        /**
+         * get caret mode
+         *
+         * @param   {String}    caret           caret mode
+         * @return  {String}    return          any of the following: "keep" | "start" | "end"
+         */
+        _caretMode: function(caret) {
+            caret = caret || "keep";
+            if (caret === false) {
+                caret = 'end';
+            }
+
+            switch (caret) {
+                case 'keep':
+                case 'start':
+                case 'end':
+                    break;
+
+                default:
+                    caret = 'keep';
+            }
+
+            return caret;
+        },
+
+        /**
+         * replace selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            replacement text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        replace: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start, end: tmp.start + text.length};
+
+            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        },
+
+        /**
+         * insert before the selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            insertion text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        insertBefore: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start + text.length, end: tmp.end + text.length};
+
+            element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        },
+
+        /**
+         * insert after the selected text
+         *
+         * @param   {Element}   element         target element
+         * @param   {String}    text            insertion text
+         * @param   {String}    caret           caret mode: any of the following: "keep" | "start" | "end"
+         */
+        insertAfter: function(element, text, caret) {
+            var tmp = _getCaretInfo(element),
+                orig = element.value,
+                pos = $(element).scrollTop(),
+                range = {start: tmp.start, end: tmp.end};
+
+            element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
+
+            $(element).scrollTop(pos);
+            this.setPos(element, range, caret);
+        }
+    };
+
+    /* add jQuery.selection */
+    $.extend({
+        /**
+         * get selected text on the window
+         *
+         * @param   {String}    mode            selection mode: any of the following: "text" | "html"
+         * @return  {String}    return
+         */
+        selection: function(mode) {
+            var getText = ((mode || 'text').toLowerCase() === 'text');
+
+            try {
+                if (win.getSelection) {
+                    if (getText) {
+                        // get text
+                        return win.getSelection().toString();
+                    } else {
+                        // get html
+                        var sel = win.getSelection(), range;
+
+                        if (sel.getRangeAt) {
+                            range = sel.getRangeAt(0);
+                        } else {
+                            range = doc.createRange();
+                            range.setStart(sel.anchorNode, sel.anchorOffset);
+                            range.setEnd(sel.focusNode, sel.focusOffset);
+                        }
+
+                        return $('<div></div>').append(range.cloneContents()).html();
+                    }
+                } else if (doc.selection) {
+                    if (getText) {
+                        // get text
+                        return doc.selection.createRange().text;
+                    } else {
+                        // get html
+                        return doc.selection.createRange().htmlText;
+                    }
+                }
+            } catch (e) {
+                /* give up */
+            }
+
+            return '';
+        }
+    });
+
+    /* add selection */
+    $.fn.extend({
+        selection: function(mode, opts) {
+            opts = opts || {};
+
+            switch (mode) {
+                /**
+                 * selection('getPos')
+                 * get caret position
+                 *
+                 * @return  {Object}    return
+                 * @return  {Number}    return.start    start position for the selection
+                 * @return  {Number}    return.end      end position for the selection
+                 */
+                case 'getPos':
+                    return _CaretOperation.getPos(this[0]);
+
+                /**
+                 * selection('setPos', opts)
+                 * set caret position
+                 *
+                 * @param   {Number}    opts.start      start position for the selection
+                 * @param   {Number}    opts.end        end position for the selection
+                 */
+                case 'setPos':
+                    return this.each(function() {
+                        _CaretOperation.setPos(this, opts);
+                    });
+
+                /**
+                 * selection('replace', opts)
+                 * replace the selected text
+                 *
+                 * @param   {String}    opts.text            replacement text
+                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
+                 */
+                case 'replace':
+                    return this.each(function() {
+                        _CaretOperation.replace(this, opts.text, opts.caret);
+                    });
+
+                /**
+                 * selection('insert', opts)
+                 * insert before/after the selected text
+                 *
+                 * @param   {String}    opts.text            insertion text
+                 * @param   {String}    opts.caret           caret mode: any of the following: "keep" | "start" | "end"
+                 * @param   {String}    opts.mode            insertion mode: any of the following: "before" | "after"
+                 */
+                case 'insert':
+                    return this.each(function() {
+                        if (opts.mode === 'before') {
+                            _CaretOperation.insertBefore(this, opts.text, opts.caret);
+                        } else {
+                            _CaretOperation.insertAfter(this, opts.text, opts.caret);
+                        }
+                    });
+
+                /**
+                 * selection('get')
+                 * get selected text
+                 *
+                 * @return  {String}    return
+                 */
+                case 'get':
+                    /* falls through */
+                default:
+                    return _CaretOperation.getText(this[0]);
+            }
+
+            return this;
+        }
+    });
+})(jQuery, window, window.document);
Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 3021)
+++ tmp/org.txm.rcp/plugin.xml	(revision 3022)
@@ -142,7 +142,7 @@
       </view>
       <view
             category="org.txm.rcp.debug"
-            class="org.txm.rcp.views.cmdparameters.ParametersView"
+            class="org.txm.rcp.views.cmdparameters.TXMResultParametersView"
             icon="icons/functions/Properties.png"
             id="org.txm.rcp.views.cmdparameters.ParametersView"
             name="Parameters panel"
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 3022)
@@ -27,19 +27,27 @@
 import org.w3c.dom.Element;
 
 public class EditionSection extends ImportEditorSection {
-
+	
 	String ID = "org.txm.rcp.editors.imports.sections.EditionSection";
-
+	
 	private static final int SECTION_SIZE = 1;
+	
 	Button buildDefaultEditionButton;
+	
 	Button paginateDefaultEditionButton;
+	
+	Button collapsibleMetadataDefaultEditionButton;
+	
 	Text wordsPerPageText;
+	
 	Text pageBreakText;
+	
 	Button buildFacsEditionCheckButton;
+	
 	Text imageDirectoryText;
-
+	
 	private Text defaultEditions;
-
+	
 	/**
 	 * 
 	 * @param toolkit2
@@ -52,7 +60,7 @@
 	 */
 	public EditionSection(FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style, HashMap<String, Boolean> moduleParams, String scriptName) {
 		super(toolkit2, form2, parent, style);
-
+		
 		this.section.setText(TXMUIMessages.editions);
 		TableWrapLayout layout = new TableWrapLayout();
 		layout.makeColumnsEqualWidth = true;
@@ -60,43 +68,52 @@
 		this.section.setLayout(layout);
 		this.section.setLayoutData(getSectionGridData(SECTION_SIZE));
 		this.section.setEnabled(false);
-
+		
 		this.section.addExpansionListener(new ExpansionAdapter() {
+			
 			@Override
-			public void expansionStateChanged(ExpansionEvent e) {form.layout(true);}
+			public void expansionStateChanged(ExpansionEvent e) {
+				form.layout(true);
+			}
 		});
-
-		//filesection.setDescription("Select how to find source files");
+		
+		// filesection.setDescription("Select how to find source files");
 		Composite sectionClient = toolkit.createComposite(this.section);
 		TableWrapLayout slayout = new TableWrapLayout();
 		slayout.numColumns = 4;
 		sectionClient.setLayout(slayout);
 		this.section.setClient(sectionClient);
-
+		
 		// build text edition or not button
 		buildDefaultEditionButton = toolkit.createButton(sectionClient, TXMUIMessages.buildEdition, SWT.CHECK);
 		buildDefaultEditionButton.setSelection(true);
 		TableWrapData gdata2 = getButtonLayoutData();
 		gdata2.colspan = 4; // one line
 		buildDefaultEditionButton.setLayoutData(gdata2);
-
+		
 		paginateDefaultEditionButton = toolkit.createButton(sectionClient, "Paginate", SWT.CHECK);
 		paginateDefaultEditionButton.setSelection(true);
 		gdata2 = getButtonLayoutData();
 		gdata2.colspan = 4; // one line
 		paginateDefaultEditionButton.setLayoutData(gdata2);
 		
+		collapsibleMetadataDefaultEditionButton = toolkit.createButton(sectionClient, "Enable collapsible metadata", SWT.CHECK);
+		collapsibleMetadataDefaultEditionButton.setSelection(true);
+		gdata2 = getButtonLayoutData();
+		gdata2.colspan = 4; // one line
+		collapsibleMetadataDefaultEditionButton.setLayoutData(gdata2);
+		
 		// words per page -> pageSize
 		Label tmpLabel = null;
 		if (moduleParams.get(ImportModuleCustomization.EDITIONS_WORDSPERPAGE)) {
 			tmpLabel = toolkit.createLabel(sectionClient, TXMUIMessages.wordsPerPage);
 			tmpLabel.setLayoutData(getLabelGridData());
-
+			
 			wordsPerPageText = toolkit.createText(sectionClient, "500", SWT.BORDER); //$NON-NLS-1$
 			TableWrapData gdata = getTextGridData();
 			wordsPerPageText.setLayoutData(gdata);
 		}
-
+		
 		if (moduleParams.get(ImportModuleCustomization.EDITIONS_PAGEELEMENT)) {
 			// page break tag
 			tmpLabel = toolkit.createLabel(sectionClient, TXMUIMessages.pageBreakTag);
@@ -104,9 +121,9 @@
 			pageBreakText = toolkit.createText(sectionClient, "pb", SWT.BORDER); //$NON-NLS-1$
 			TableWrapData gdata = getTextGridData();
 			pageBreakText.setLayoutData(gdata);
-
+			
 			if ("xtzLoader.groovy".equals(scriptName)) {
-
+				
 				// build text edition or not button
 				buildFacsEditionCheckButton = toolkit.createButton(sectionClient, "Build 'facs' edition", SWT.CHECK);
 				buildFacsEditionCheckButton.setSelection(false);
@@ -114,11 +131,12 @@
 				gdata22.colspan = 4; // one line
 				buildFacsEditionCheckButton.setLayoutData(gdata22);
 				buildFacsEditionCheckButton.addSelectionListener(new SelectionListener() {
+					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
 						imageDirectoryText.setEnabled(buildFacsEditionCheckButton.getSelection());
 					}
-
+					
 					@Override
 					public void widgetDefaultSelected(SelectionEvent e) {}
 				});
@@ -130,17 +148,19 @@
 				gdata.colspan = 2;
 				imageDirectoryText.setLayoutData(gdata);
 				imageDirectoryText.setEnabled(false);
-
+				
 				Button selectImageDirectoryButton = toolkit.createButton(sectionClient, "...", SWT.PUSH);
 				gdata = getButtonLayoutData();
 				selectImageDirectoryButton.setLayoutData(gdata);
 				selectImageDirectoryButton.addSelectionListener(new SelectionListener() {
+					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
 						DirectoryDialog dialog = new DirectoryDialog(form.getShell(), SWT.OPEN);
 						if (LastOpened.getFile(ID) != null) {
 							dialog.setFilterPath(LastOpened.getFolder(ID));
-						} else {
+						}
+						else {
 							dialog.setFilterPath(Toolbox.getTxmHomePath());
 						}
 						if (dialog.open() != null) {
@@ -149,9 +169,9 @@
 							imageDirectoryText.setText(imgDirectory.getAbsolutePath());
 						}
 					}
-
+					
 					@Override
-					public void widgetDefaultSelected(SelectionEvent e) { }
+					public void widgetDefaultSelected(SelectionEvent e) {}
 				});
 			}
 		}
@@ -166,104 +186,106 @@
 			gdata.colspan = 2;
 			defaultEditions.setLayoutData(gdata);
 		}
-
+		
 		//// First draft of interface to add editions to a corpus
-		//		Button addButton = toolkit.createButton(sectionClient, Messages.CorpusPage_1, SWT.PUSH);
-		//		addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
-		//		addButton.addSelectionListener(new SelectionListener() {
-		//			@Override
-		//			public void widgetDefaultSelected(SelectionEvent e) {
-		//			}
+		// Button addButton = toolkit.createButton(sectionClient, Messages.CorpusPage_1, SWT.PUSH);
+		// addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
+		// addButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) {
+		// }
 		//
-		//			@Override
-		//			public void widgetSelected(SelectionEvent e) {
-		//				if (params == null) return;
-		//				LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
-		//				values.put("name", ""); //$NON-NLS-1$ //$NON-NLS-2$
-		//				values.put("mode", "groovy"); //$NON-NLS-1$ //$NON-NLS-2$
-		//				values.put("script", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// if (params == null) return;
+		// LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
+		// values.put("name", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		// values.put("mode", "groovy"); //$NON-NLS-1$ //$NON-NLS-2$
+		// values.put("script", ""); //$NON-NLS-1$ //$NON-NLS-2$
 		//
-		//				MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_1, values);
-		//				if (dlg.open() == Window.OK) {
-		//					params.addEditionDefinition(params.getCorpusElement(), values.get("name"), values.get("mode"), values.get("script")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		//					updateEditionsSection();
-		//				}
-		//			}
-		//		});
+		// MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_1, values);
+		// if (dlg.open() == Window.OK) {
+		// params.addEditionDefinition(params.getCorpusElement(), values.get("name"), values.get("mode"), values.get("script")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		// updateEditionsSection();
+		// }
+		// }
+		// });
 		//
-		//		Button removeButton = toolkit.createButton(sectionClient, Messages.CorpusPage_2, SWT.PUSH);
-		//		removeButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
-		//		removeButton.addSelectionListener(new SelectionListener() {
-		//			@Override
-		//			public void widgetDefaultSelected(SelectionEvent e) {
-		//			}
+		// Button removeButton = toolkit.createButton(sectionClient, Messages.CorpusPage_2, SWT.PUSH);
+		// removeButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
+		// removeButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) {
+		// }
 		//
-		//			@Override
-		//			public void widgetSelected(SelectionEvent e) {
-		//				if (params == null) return;
-		//				ISelection sel = editionsViewer.getSelection();
-		//				IStructuredSelection ssel = (IStructuredSelection) sel;
-		//				Object obj = ssel.getFirstElement();
-		//				if (obj instanceof Element) {
-		//					Element query = (Element) obj;
-		//					params.getEditionsElement(params.getCorpusElement()).removeChild(query);
-		//					updateEditionsSection();
-		//				}
-		//			}
-		//		});
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// if (params == null) return;
+		// ISelection sel = editionsViewer.getSelection();
+		// IStructuredSelection ssel = (IStructuredSelection) sel;
+		// Object obj = ssel.getFirstElement();
+		// if (obj instanceof Element) {
+		// Element query = (Element) obj;
+		// params.getEditionsElement(params.getCorpusElement()).removeChild(query);
+		// updateEditionsSection();
+		// }
+		// }
+		// });
 		//
-		//		Table table = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
-		//		editionsViewer = new TableViewer(table);
-		//		editionsViewer.getTable().addKeyListener(new TableKeyListener(editionsViewer));
-		//		GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
-		//		gd.heightHint = 150;
-		//		editionsViewer.getTable().setLayoutData(gd);
-		//		editionsViewer.setContentProvider(new NodeListContentProvider());
-		//		editionsViewer.getTable().setHeaderVisible(true);
-		//		editionsViewer.getTable().setLinesVisible(true);
+		// Table table = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
+		// editionsViewer = new TableViewer(table);
+		// editionsViewer.getTable().addKeyListener(new TableKeyListener(editionsViewer));
+		// GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
+		// gd.heightHint = 150;
+		// editionsViewer.getTable().setLayoutData(gd);
+		// editionsViewer.setContentProvider(new NodeListContentProvider());
+		// editionsViewer.getTable().setHeaderVisible(true);
+		// editionsViewer.getTable().setLinesVisible(true);
 		//
-		//		String[] cols = {"name", "mode", "script"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		//		for (String col : cols) {
-		//			TableViewerColumn columnViewer = new TableViewerColumn(editionsViewer, SWT.NONE);
-		//			TableColumn column = columnViewer.getColumn();
-		//			column.setText(col);
-		//			column.setWidth(100);
-		//			columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
-		//		}		
+		// String[] cols = {"name", "mode", "script"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		// for (String col : cols) {
+		// TableViewerColumn columnViewer = new TableViewerColumn(editionsViewer, SWT.NONE);
+		// TableColumn column = columnViewer.getColumn();
+		// column.setText(col);
+		// column.setWidth(100);
+		// columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
+		// }
 	}
-
+	
 	@Override
 	public void update(Project project) {
 		if (this.section.isDisposed()) return;
 		if (project == null) return;
-
+		
 		buildDefaultEditionButton.setSelection(!project.hasEditionDefinition("default"));
 		
 		if (project.hasEditionDefinition("default")) {
-
+			
 			EditionDefinition edition_params = project.getEditionDefinition("default");
 			boolean be = edition_params.getBuildEdition();
 			buildDefaultEditionButton.setSelection(be);
-
+			
 			boolean pe = edition_params.getPaginateEdition();
 			paginateDefaultEditionButton.setSelection(pe);
-
 			
-			int wppt = edition_params.getWordsPerPage(); //$NON-NLS-1$
-			wordsPerPageText.setText(""+wppt); //$NON-NLS-1$
-
-			String pbt = edition_params.getPageElement(); //$NON-NLS-1$
+			boolean ecm = edition_params.getEnableCollapsibleMetadata();
+			collapsibleMetadataDefaultEditionButton.setSelection(ecm);
+			
+			int wppt = edition_params.getWordsPerPage();
+			wordsPerPageText.setText("" + wppt); //$NON-NLS-1$
+			
+			String pbt = edition_params.getPageElement();
 			if (pageBreakText != null)
-				pageBreakText.setText(pbt);	
+				pageBreakText.setText(pbt);
 		}
-
+		
 		EditionDefinition edition_params = project.getEditionDefinition("facs");
 		boolean bfe = edition_params.getBuildEdition();
 		if (buildFacsEditionCheckButton != null && edition_params != null) {
 			buildFacsEditionCheckButton.setSelection(bfe);
 			imageDirectoryText.setEnabled(buildFacsEditionCheckButton.getSelection());
-
-			String imageDirectory = edition_params.getImagesDirectory(); //$NON-NLS-1$
+			
+			String imageDirectory = edition_params.getImagesDirectory();
 			if (imageDirectoryText != null && imageDirectory != null)
 				imageDirectoryText.setText(imageDirectory);
 		}
@@ -273,42 +295,45 @@
 			defaultEditions.setText(defaults);
 		}
 	}
-
+	
 	@Override
 	public boolean save(Project project) {
 		if (this.section != null && !this.section.isDisposed()) {
-
+			
 			String page_break_tag = "pb";
-
+			
 			if (pageBreakText != null) {
-				page_break_tag =  pageBreakText.getText(); //$NON-NLS-1$
+				page_break_tag = pageBreakText.getText();
 			}
 			int words_per_page = 500;
 			if (wordsPerPageText != null) {
-				words_per_page =  Integer.parseInt(wordsPerPageText.getText()); //$NON-NLS-1$
+				words_per_page = Integer.parseInt(wordsPerPageText.getText());
 			}
-
+			
 			boolean build = buildDefaultEditionButton.getSelection();
 			boolean paginate = paginateDefaultEditionButton.getSelection();
+			boolean collapsible = collapsibleMetadataDefaultEditionButton.getSelection();
 			EditionDefinition edition_params = project.getEditionDefinition("default");
 			edition_params.setName("default");
 			edition_params.setPageBreakTag(page_break_tag);
 			edition_params.setWordsPerPage(words_per_page);
 			edition_params.setBuildEdition(build);
 			edition_params.setPaginateEdition(paginate);
-
+			edition_params.setEnableCollapsible(collapsible);
+			
 			if (buildFacsEditionCheckButton != null) {
-
+				
 				String images_directory = "";
 				if (imageDirectoryText != null)
 					images_directory = imageDirectoryText.getText();
-
+				
 				build = buildFacsEditionCheckButton.getSelection();
-
+				
 				EditionDefinition edition_params2 = project.getEditionDefinition("facs");
 				edition_params2.setBuildEdition(build);
 				edition_params2.setImagesDirectory(images_directory);
-			} else {
+			}
+			else {
 				EditionDefinition edition_params2 = project.getEditionDefinition("facs");
 				edition_params2.setBuildEdition(false);
 			}
@@ -322,14 +347,14 @@
 		}
 		return true;
 	}
-
+	
 	@Override
 	public boolean checkFields() {
 		return true;
 	}
-
+	
 	@Override
 	public int getSectionSize() {
 		return SECTION_SIZE;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog2.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog2.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog2.java	(revision 3022)
@@ -0,0 +1,200 @@
+package org.txm.rcp.swt.widget.parameters;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.NamedOptionDef;
+import org.kohsuke.args4j.spi.OptionHandler;
+import org.txm.Toolbox;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.GLComposite;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.Timer;
+import org.txm.utils.logger.Log;
+
+@SuppressWarnings("rawtypes")
+public class ParametersDialog2 extends Dialog {
+	
+	// protected ArrayList<NamedOptionDef> parameters;
+	
+	protected String title;
+	
+	protected ParametersManager manager;
+	
+	protected ParametersGLComposite columns;
+	
+	/**
+	 * Don't forget to call init(...) to setup the parameters to show
+	 * 
+	 * @param parentShell
+	 */
+	public ParametersDialog2(Shell parentShell) {
+		super(parentShell);
+		
+		// init(allParameters, defaultParameters);
+	}
+	
+	/**
+	 * 
+	 * @param parentShell
+	 * @param bean
+	 * @param allParameters all the scripts annotations
+	 * @param args pre-filled fields
+	 */
+	public ParametersDialog2(Shell parentShell, List<OptionHandler> allParameters, Map<String, Object> defaultParameters) {
+		super(parentShell);
+		
+		init(allParameters, defaultParameters);
+	}
+	
+	public void init(List<OptionHandler> allParameters, Map<String, Object> defaultParameters) {
+		
+		setShellStyle(getShellStyle() | SWT.RESIZE);
+		
+		manager = new ParametersManager();
+		ArrayList<NamedOptionDef> parameters = new ArrayList<>();
+		if (allParameters != null) {
+			for (OptionHandler opt : allParameters) {
+				if (opt.option instanceof NamedOptionDef) {
+					parameters.add((NamedOptionDef) opt.option);
+				}
+			}
+		}
+		
+		manager.setParametersOptions(parameters);
+		
+		manager.updateDefaultValues(defaultParameters);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+	 */
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		
+		newShell.setText(title);
+		newShell.setMinimumSize(250, 450);
+	}
+	
+	public ParametersManager getParameterManager() {
+		return manager;
+	}
+	
+	public ParametersGLComposite getParameterWidgets() {
+		return columns;
+	}
+	
+	@Override
+	protected boolean isResizable() {
+		return true;
+	}
+	
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		// create the reset button (hack of the Back button)
+		// Button propButton = createButton(parent, IDialogConstants.BACK_ID,
+		// "...", false);
+		// propButton.removeListener(SWT.Selection, propButton.getListeners(SWT.Selection)[0]);
+		//
+		// propButton.addSelectionListener(new SelectionAdapter() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// FileDialog dialog = new FileDialog(e.display.getActiveShell());
+		// dialog.setFilterPath(propFile.getParent());
+		// dialog.setFilterExtensions(new String[] {"*.properties"});
+		// dialog.setFileName(propFile.getName());
+		// String path = dialog.open();
+		// if (path != null) {
+		// propFile = new File(path);
+		// loadDefaultValuesFromPropFile();
+		// }
+		// }
+		// });
+		
+		Button button = createButton(parent, IDialogConstants.BACK_ID, "Reset values", false);
+		button.removeListener(SWT.Selection, button.getListeners(SWT.Selection)[0]);
+		
+		button.addSelectionListener(new SelectionAdapter() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				columns.resetWidgets();
+			}
+		});
+		button.setEnabled(columns.getNumberOfFields() > 0);
+		
+		super.createButtonsForButtonBar(parent);
+		this.getButton(IDialogConstants.OK_ID).setText(TXMUIMessages.run);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite composite) {
+		// this.parent = composite;
+		super.createDialogArea(composite);
+		
+		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+		GridLayout layout = new GridLayout(1, true);
+		composite.setLayout(layout);
+		
+		columns = new ParametersGLComposite(composite, SWT.NONE, "parameters", this.manager);
+		
+		new Label(composite, SWT.NONE).setText(TXMUIMessages.mandatoryFields);
+		
+		return composite;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		ArrayList<String> missing = columns.getNonSetFields();
+		if (missing.size() > 0) {
+			System.out.println(TXMUIMessages.errorColonMissingValueColon + StringUtils.join(missing, ", "));
+			return; // abort
+		}
+		
+		super.okPressed();
+	}
+	
+	public HashMap<String, Object> getValues() {
+		return manager.getFinalValues();
+	}
+	
+	public boolean getMustShowDialog() {
+		return columns != null && columns.mustShowDialog;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/MacroParametersDialog.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/MacroParametersDialog.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/MacroParametersDialog.java	(revision 3022)
@@ -0,0 +1,224 @@
+package org.txm.rcp.swt.widget.parameters;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.NamedOptionDef;
+import org.kohsuke.args4j.spi.OptionHandler;
+import org.txm.Toolbox;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.utils.Timer;
+import org.txm.utils.logger.Log;
+
+public class MacroParametersDialog extends ParametersDialog2 {
+	
+	Object bean;
+	
+	File propFile;
+	
+	/**
+	 * 
+	 * @param parentShell
+	 * @param bean
+	 * @param allParameters all the scripts annotations
+	 * @param args pre-filled fields
+	 */
+	public MacroParametersDialog(Shell parentShell, Object bean) {
+		super(parentShell);
+		
+		if (bean != null) {
+			this.bean = bean;
+			CmdLineParser parser = new CmdLineParser(bean);
+			List<OptionHandler> options = parser.getOptions();
+			
+			Object oArgs = null;
+			if (bean instanceof groovy.lang.Script) {
+				groovy.lang.Script script = (groovy.lang.Script) bean;
+				
+				// if the "args" variable exists then use its values. Can be used to set a default value by another Macro
+				if (script.getBinding().hasVariable("args")) {
+					oArgs = script.getBinding().getVariable("args"); //$NON-NLS-1$
+				}
+			}
+			
+			Map<String, Object> args;
+			if (oArgs == null || !(oArgs instanceof Map)) {
+				args = new LinkedHashMap<>();
+			}
+			else {
+				args = (Map) oArgs;
+			}
+			
+			if (bean instanceof groovy.lang.Script) { // create the args binding if not already existing
+				groovy.lang.Script script = (groovy.lang.Script) bean;
+				if (!script.getBinding().hasVariable("args")) {
+					script.getBinding().setVariable("args", args);
+				}
+			}
+			
+			String script = bean.getClass().getName();
+			
+			int idx2 = script.lastIndexOf("Macro");
+			if (idx2 < 0) idx2 = script.length();
+			title = TXMUIMessages.bind(TXMUIMessages.p0ParametersInput, script.substring(script.lastIndexOf(".") + 1, idx2));
+			
+			// initialize the properties file default values store
+			String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts/groovy/user"; //$NON-NLS-1$
+			
+			propFile = new File(scriptRootDir, script.replace(".", "/") + ".properties");
+			Properties defaultValuesProperties = loadDefaultValuesFromPropFile();
+			for (Object k : defaultValuesProperties.keySet()) {
+				if (!args.containsKey(k)) {
+					args.put(k.toString(), defaultValuesProperties.get(k));
+				}
+			}
+			
+			init(options, args);
+		}
+	}
+	
+	
+	public boolean saveDefaultParameters() {
+		try {
+			propFile.getParentFile().mkdirs();
+			manager.finalToProperties().store(new FileWriter(propFile), "");
+			return true;
+		}
+		catch (IOException e) {
+			System.out.println("Warning: failed to store default macro valuesin " + propFile + ": " + e);
+			Log.printStackTrace(e);
+			return false;
+		}
+	}
+	
+	public Properties loadDefaultValuesFromPropFile() {
+		Properties defaultValues = new Properties();
+		if (propFile.exists()) {
+			try {
+				defaultValues.load(new FileReader(propFile));
+				Log.info("Retrieving previous macro parameters from " + propFile + " values=" + defaultValues.entrySet() + "...");
+			}
+			catch (Exception e) {
+				Log.severe("Failed to load previous values from " + propFile + ": " + e);
+				Log.printStackTrace(e);
+			}
+		}
+		return defaultValues;
+	}
+	
+	/**
+	 * Conveniance method to initialize the parameters dialog.
+	 * Can detect the "args" Groovy binding and use it to set variables
+	 * If all variables are set by "args" then don't show the dialog box
+	 * 
+	 * @param bean
+	 * @return true if the user has clicked on the "OK" button
+	 */
+	public static boolean open(final Object bean) {
+		
+		Callable<Boolean> r = new Callable<Boolean>() {
+			
+			Boolean called = null;
+			
+			boolean errorOpen = true;
+			
+			boolean retOpen = false;
+			
+			public boolean returnCode() {
+				called = retOpen && !errorOpen;
+				return called;
+			}
+			
+			@Override
+			public Boolean call() throws Exception {
+				if (called != null) return called; // exit if already called
+				
+				MacroParametersDialog dialog = new MacroParametersDialog(Display.getCurrent().getActiveShell(), bean);
+				if (dialog.getShell() != null) {
+					dialog.getShell().setActive();
+				}
+				
+				List<String> errors = dialog.columns.getManager().validateParametersDefinition();
+				if (errors.size() > 0) {
+					errorOpen = true;
+				}
+				else {
+					if (dialog.getMustShowDialog()) {
+						retOpen = dialog.open() == ParametersDialog2.OK;
+					}
+					else { // fields initialized by 'args'
+						
+						if (!dialog.initializeMacroVariables()) {
+							Log.severe(NLS.bind("{0} fields not updated correctly with {1}", bean, dialog.getParameterManager().getFinalValues()));
+							retOpen = false;
+							return returnCode();
+						}
+						
+						if (!dialog.saveDefaultParameters()) {
+							Log.warning("Could not save parameters for next call");
+						}
+						
+						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();
+						}
+					}
+				}
+				
+				return returnCode();
+			}
+		};
+		
+		Display.getDefault().syncExec(new Runnable() {
+			
+			@Override
+			public void run() {
+				try {
+					r.call();
+				}
+				catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		});
+		
+		try {
+			return r.call();
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * can use the args map to initialize variable not set with the dialog box
+	 */
+	protected boolean initializeMacroVariables() {
+		
+		// System.out.println("Initialize macro variables of "+fieldNames);
+		if (bean == null) return false;
+		
+		return manager.finalToBean(bean);
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/MacroParametersDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AtestClass.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AtestClass.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AtestClass.java	(revision 3022)
@@ -0,0 +1,46 @@
+package org.txm.rcp.swt.widget.parameters;
+
+import java.io.File;
+import java.util.Date;
+
+import org.kohsuke.args4j.Option;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+
+public class AtestClass {
+	
+	@Option(name = "file", usage = "a file", widget = "File", required = true, def = "aFile.ext")
+	File file;
+	
+	@Option(name = "dir", usage = "a directory", widget = "Folder", def = "TEMP")
+	File dir;
+	
+	@Option(name = "ii", usage = "an integer", widget = "Integer", def = "42")
+	Integer ii;
+	
+	@Option(name = "f", usage = "a float", widget = "Float", def = "42.42")
+	Float f;
+	
+	@Option(name = "shs", usage = "a one line string", widget = "String", def = "default value")
+	String shs;
+	
+	@Option(name = "ls", usage = "a very long string with carriage return and stuffs", widget = "Text", def = "default\nvalue")
+	String ls;
+	
+	@Option(name = "q", usage = "a CQL", widget = "Query", def = "\"je\"")
+	CQLQuery q;
+	
+	@Option(name = "date", usage = "a date", widget = "Date", def = "1984-09-01")
+	Date date;
+	
+	@Option(name = "bool", usage = "a boolean", widget = "Boolean", def = "true")
+	Boolean bool;
+	
+	public AtestClass() {
+		
+	}
+	
+	@Override
+	public String toString() {
+		return "file=" + file + " dir=" + dir + " ii=" + ii;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AtestClass.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AScript.groovy
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AScript.groovy	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/AScript.groovy	(revision 3022)
@@ -1,7 +1,7 @@
 package org.txm.rcp.swt.widget.parameters;
 import org.kohsuke.args4j.*
+
 import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.ParametersDialog
 
 @Field @Option(name="file", usage="a file", widget="File", required=true, def="aFile.ext")
 def file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersGLComposite.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersGLComposite.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersGLComposite.java	(revision 3022)
@@ -0,0 +1,255 @@
+package org.txm.rcp.swt.widget.parameters;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.kohsuke.args4j.NamedOptionDef;
+import org.kohsuke.args4j.spi.OptionHandler;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.GLComposite;
+
+/**
+ * Display parameters in specialized widget
+ * 
+ * @author mdecorde
+ *
+ */
+public class ParametersGLComposite extends GLComposite {
+	
+	ParametersManager manager;
+	
+	LinkedHashMap<String, ParameterField> widgets = new LinkedHashMap<>();
+	
+	public int MAX_PARAMETERS_PER_LINE = 10;
+	
+	public boolean mustShowDialog = true;
+	
+	private GLComposite columns;
+	
+	private int numberOfParameters;
+	
+	private int numberOfMandatoryFields;
+	
+	public ParametersGLComposite(Composite parent, int style, String name, ParametersManager manager) {
+		super(parent, style, name);
+		this.manager = manager;
+		
+		// Button propButton = createButton(this, IDialogConstants.BACK_ID,
+		// "...", false);
+		// propButton.removeListener(SWT.Selection, propButton.getListeners(SWT.Selection)[0]);
+		//
+		// propButton.addSelectionListener(new SelectionAdapter() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// FileDialog dialog = new FileDialog(e.display.getActiveShell());
+		// dialog.setFilterPath(propFile.getParent());
+		// dialog.setFilterExtensions(new String[] {"*.properties"});
+		// dialog.setFileName(propFile.getName());
+		// String path = dialog.open();
+		// if (path != null) {
+		// propFile = new File(path);
+		// loadDefaultValuesFromPropFile();
+		// }
+		// }
+		// });
+		
+		buildFields();
+		
+		Button button = new Button(parent, SWT.PUSH);
+		button.removeListener(SWT.Selection, button.getListeners(SWT.Selection)[0]);
+		
+		button.addSelectionListener(new SelectionAdapter() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				resetWidgets();
+			}
+		});
+	}
+	
+	public ParametersManager getManager() {
+		return manager;
+	}
+	
+	public void resetWidgets() {
+		// System.out.println("Reseting fields to default values");
+		for (String k : widgets.keySet()) {
+			widgets.get(k).resetToDefault();
+		}
+	}
+	
+	/**
+	 * Build the fields depending on the values parameters and default values
+	 * 
+	 * @param parent
+	 */
+	public void buildFields() {
+		
+		if (columns != null && !columns.isDisposed()) {
+			columns.dispose();
+			widgets.clear();
+		}
+		
+		columns = new GLComposite(this, SWT.NONE, "columns");
+		columns.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+		columns.getLayout().numColumns = 1;
+		
+		// scrolledComposite.setContent(columns);
+		// scrolledComposite.addListener( SWT.Resize, event -> {
+		// int width = scrolledComposite.getClientArea().width;
+		// scrolledComposite.setMinSize( composite.computeSize( width, SWT.DEFAULT ) );
+		// } );
+		
+		// count the number of fields to show. If "0" then don't show the dialog, see the "open()" function
+		// and select only the NamedOptionDef annotations
+		numberOfParameters = 0; // number of parameters not set by args
+		numberOfMandatoryFields = 0;
+		LinkedHashMap<String, Object> defaultValues = manager.getDefaultValues();
+		for (NamedOptionDef option : manager.parameters.values()) {
+			if (defaultValues.containsKey(option.name())) {
+				continue; // don't show the field
+			}
+			
+			// count number of mandatory fields set AND add exception for "Separator" widget types
+			if (option.required() || "Separator".equals(option.widget())) numberOfMandatoryFields++;
+			numberOfParameters++;
+		}
+		
+		mustShowDialog = numberOfMandatoryFields > 0 || (defaultValues.size() == 0 && numberOfParameters > 0);
+		
+		if (numberOfParameters > MAX_PARAMETERS_PER_LINE) {
+			columns.getLayout().numColumns = 1 + (numberOfParameters / MAX_PARAMETERS_PER_LINE);
+		}
+		
+		GLComposite column = new GLComposite(columns, SWT.NONE, "column");
+		GridData gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
+		gdata.minimumWidth = 200;
+		column.setLayoutData(gdata);
+		column.getLayout().makeColumnsEqualWidth = false;
+		
+		// initialize each widget + default value *of the widget*
+		int n = 0;
+		for (NamedOptionDef option : manager.getParameters().values()) {
+			n++;
+			if (n % MAX_PARAMETERS_PER_LINE == 0) {
+				column = new GLComposite(columns, SWT.NONE, "column");
+				gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
+				gdata.minimumWidth = 200;
+				column.setLayoutData(gdata);
+				column.getLayout().makeColumnsEqualWidth = false;
+			}
+			
+			// each widget is initialized with de default value set in @Field@def attribute
+			String widgetName = option.widget();
+			ParameterField widget = null;
+			if ("File".equals(widgetName) || "FileOpen".equals(widgetName)) { //$NON-NLS-1$
+				widget = new FileField(column, SWT.NONE, option);
+			}
+			else if ("CreateFile".equals(widgetName) || "FileSave".equals(widgetName)) { //$NON-NLS-1$
+				widget = new CreateFileField(column, SWT.NONE, option);
+			}
+			else if ("Folder".equals(widgetName)) { //$NON-NLS-1$
+				widget = new FolderField(column, SWT.NONE, option);
+			}
+			else if ("Query".equals(widgetName)) { //$NON-NLS-1$
+				widget = new QueryField(column, SWT.NONE, option);
+			}
+			else if ("Date".equals(widgetName)) { //$NON-NLS-1$
+				widget = new DateField(column, SWT.NONE, option);
+			}
+			else if ("Time".equals(widgetName)) { //$NON-NLS-1$
+				widget = new TimeField(column, SWT.NONE, option);
+			}
+			else if ("Separator".equals(widgetName)) { //$NON-NLS-1$
+				widget = new SeparatorField(column, SWT.NONE, option);
+			}
+			else if ("String".equals(widgetName)) { //$NON-NLS-1$
+				widget = new StringField(column, SWT.NONE, option);
+			}
+			else if ("Password".equals(widgetName)) { //$NON-NLS-1$
+				widget = new PasswordField(column, SWT.NONE, option);
+			}
+			else if ("StringArray".equals(widgetName)) { //$NON-NLS-1$
+				widget = new StringArrayField(column, SWT.NONE, option);
+			}
+			else if ("StringArrayMultiple".equals(widgetName)) { //$NON-NLS-1$
+				widget = new StringArrayMultipleField(column, SWT.NONE, option);
+			}
+			else if ("StructuralUnits".equals(widgetName)) { //$NON-NLS-1$
+				widget = new CospusStructuresField(column, SWT.NONE, option);
+			}
+			else if ("Text".equals(widgetName)) { //$NON-NLS-1$
+				widget = new LongStringField(column, SWT.NONE, option);
+			}
+			else if ("Integer".equals(widgetName)) { //$NON-NLS-1$
+				widget = new IntegerField(column, SWT.NONE, option);
+			}
+			else if ("Float".equals(widgetName)) { //$NON-NLS-1$
+				widget = new FloatField(column, SWT.NONE, option);
+			}
+			else if ("Boolean".equals(widgetName)) { //$NON-NLS-1$
+				widget = new BooleanField(column, SWT.NONE, option);
+			}
+			else {
+				System.out.println(TXMUIMessages.unknowedWidgetNameColon + widgetName + TXMUIMessages.FileTreeContentProvider_4);
+			}
+			
+			if (widget != null) {
+				widgets.put(option.name(), widget);
+				
+				// set default value in the fields, not enough if args contains the value
+				Object value = defaultValues.get(option.name());
+				if (value != null) { // set the default value using the properties stored
+					widget.setDefault(value.toString());
+				}
+			}
+		}
+	}
+	
+	/**
+	 * 
+	 * @return the number of fields after the buildWidgets is called
+	 */
+	public int getNumberOfParameters() {
+		return numberOfParameters;
+	}
+	
+	/**
+	 * 
+	 * @return the number of mandatory fields after the buildWidgets is called
+	 */
+	public int getNumberOfMandatoryFields() {
+		return numberOfMandatoryFields;
+	}
+	
+	/**
+	 * 
+	 * @return the number of fields after the buildWidgets is called
+	 */
+	public int getNumberOfFields() {
+		return widgets.size();
+	}
+	
+	public ArrayList<String> getNonSetFields() {
+		ArrayList<String> missing = new ArrayList<>();
+		
+		if (manager.getParameters() == null) return missing; // no constraint
+		
+		LinkedHashMap<String, Object> finalValues = manager.getFinalValues();
+		
+		for (NamedOptionDef p : manager.getParameters().values()) {
+			if (p.required() && finalValues.get(p.name()) == null) {
+				missing.add(p.name());
+			}
+		}
+		return missing;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersGLComposite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersDialog.java	(revision 3022)
@@ -17,13 +17,8 @@
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -44,39 +39,39 @@
 
 @SuppressWarnings("rawtypes")
 public class ParametersDialog extends Dialog {
-
+	
 	public int MAX_PARAMETERS_PER_LINE = 10;
-
+	
 	Object bean;
-
+	
 	String script;
-
+	
 	String title;
-
+	
 	List<NamedOptionDef> parameters;
-
+	
 	List<String> fieldNames = new ArrayList<>(); // store all the declared parameters names
-
+	
 	LinkedHashMap<String, ParameterField> widgets = new LinkedHashMap<>();
-
+	
 	protected boolean error = false;
-
+	
 	protected Map args; // store values given by another Macro, if contains all the needed values, no dialog is shown
-
+	
 	protected int numberOfParameters; // number of parameters to show in the dialog box (not set by 'args'), if 0 parameters no dialog is shown
-
+	
 	protected boolean mustShowDialog; // show dialog if args.size == 0 OR if there is at least one mandatory field to set
-
+	
 	HashMap<String, Object> values = new HashMap<>(); // store the values of the parameters (may not contains all the values needed
-
+	
 	Properties defaultValues; // default values set by the .properties file
-
+	
 	Properties defaultScriptValues = new Properties(); // default values set by the Groovy script @Field@def annotation attribute
-
+	
 	File propFile;
 	// private int titleWidth;
 	// private Composite parent;
-
+	
 	/**
 	 * 
 	 * @param parentShell
@@ -93,7 +88,7 @@
 		this.bean = bean;
 		this.args = args;
 		setShellStyle(getShellStyle() | SWT.RESIZE);
-
+		
 		// count the number of fields to show. If "0" then don't show the dialog, see the "open()" function
 		// and select only the NamedOptionDef annotations
 		numberOfParameters = 0; // number of parameters not set by args
@@ -106,25 +101,25 @@
 				if (args.containsKey(option.name())) {
 					continue; // don't show the field
 				}
-
+				
 				// count number of mandatory fields set AND add exception for "Separator" widget types
 				if (option.required() || "Separator".equals(option.widget())) numberOfMandatoryFields++;
 				numberOfParameters++;
 			}
 		}
-
+		
 		mustShowDialog = numberOfMandatoryFields > 0 || (args.size() == 0 && numberOfParameters > 0);
-
+		
 		// initialize the properties file default values store
 		defaultValues = new Properties();
 		String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts/groovy/user"; //$NON-NLS-1$
-
+		
 		propFile = new File(scriptRootDir, this.script.replace(".", "/") + ".properties");
-
+		
 		loadDefaultValuesFromPropFile();
 	}
-
-
+	
+	
 	private void loadDefaultValuesFromPropFile() {
 		if (propFile.exists()) {
 			try {
@@ -136,7 +131,7 @@
 				Log.printStackTrace(e);
 			}
 		}
-
+		
 		// initialize the script default values
 		for (NamedOptionDef option : this.parameters) {
 			String widgetName = option.widget();
@@ -201,7 +196,7 @@
 			}
 		}
 	}
-
+	
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
@@ -214,41 +209,41 @@
 		title = TXMUIMessages.bind(TXMUIMessages.p0ParametersInput, script.substring(script.lastIndexOf(".") + 1, idx2));
 		newShell.setText(title);
 		newShell.setMinimumSize(250, 450);
-
-//		newShell.addControlListener(new ControlAdapter() {
-//			public void controlResized(ControlEvent e) {
-//				Rectangle area = newShell.getClientArea();
-//				Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-//				int width = area.width - 2*table.getBorderWidth();
-//				if (preferredSize.y > area.height + table.getHeaderHeight()) {
-//					// Subtract the scrollbar width from the total column width
-//					// if a vertical scrollbar will be required
-//					Point vBarSize = table.getVerticalBar().getSize();
-//					width -= vBarSize.x;
-//				}
-//				Point oldSize = table.getSize();
-//				if (oldSize.x > area.width) {
-//					// table is getting smaller so make the columns // smaller first and then resize the table to
-//					// match the client area width
-//					column1.setWidth(width/3);
-//					column2.setWidth(width - column1.getWidth());
-//					table.setSize(area.width, area.height);
-//				} else {
-//					// table is getting bigger so make the table // bigger first and then make the columns wider
-//					// to match the client area width
-//					table.setSize(area.width, area.height);
-//					column1.setWidth(width/3);
-//					column2.setWidth(width - column1.getWidth());
-//				}
-//			}
-//		});
+		
+		// newShell.addControlListener(new ControlAdapter() {
+		// public void controlResized(ControlEvent e) {
+		// Rectangle area = newShell.getClientArea();
+		// Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+		// int width = area.width - 2*table.getBorderWidth();
+		// if (preferredSize.y > area.height + table.getHeaderHeight()) {
+		// // Subtract the scrollbar width from the total column width
+		// // if a vertical scrollbar will be required
+		// Point vBarSize = table.getVerticalBar().getSize();
+		// width -= vBarSize.x;
+		// }
+		// Point oldSize = table.getSize();
+		// if (oldSize.x > area.width) {
+		// // table is getting smaller so make the columns // smaller first and then resize the table to
+		// // match the client area width
+		// column1.setWidth(width/3);
+		// column2.setWidth(width - column1.getWidth());
+		// table.setSize(area.width, area.height);
+		// } else {
+		// // table is getting bigger so make the table // bigger first and then make the columns wider
+		// // to match the client area width
+		// table.setSize(area.width, area.height);
+		// column1.setWidth(width/3);
+		// column2.setWidth(width - column1.getWidth());
+		// }
+		// }
+		// });
 	}
 	
 	@Override
 	protected boolean isResizable() {
-	    return true;
+		return true;
 	}
-
+	
 	@Override
 	protected void createButtonsForButtonBar(Composite parent) {
 		// create the reset button (hack of the Back button)
@@ -270,12 +265,12 @@
 		// }
 		// }
 		// });
-
+		
 		Button button = createButton(parent, IDialogConstants.BACK_ID, "Reset values", false);
 		button.removeListener(SWT.Selection, button.getListeners(SWT.Selection)[0]);
-
+		
 		button.addSelectionListener(new SelectionAdapter() {
-
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				// System.out.println("Reseting fields to default values");
@@ -285,24 +280,24 @@
 			}
 		});
 		if (numberOfParameters == 0) button.setEnabled(false);
-
+		
 		super.createButtonsForButtonBar(parent);
 		this.getButton(IDialogConstants.OK_ID).setText(TXMUIMessages.run);
 	}
-
+	
 	@Override
 	protected Control createButtonBar(Composite parent) {
 		Control c = super.createButtonBar(parent);
-
+		
 		// int barWidth = c.getSize().x;
 		// if (barWidth > titleWidth) {
 		// GridData cdata = (GridData)(this.parent.getLayoutData());
 		// cdata.widthHint = barWidth;
 		// }
-
+		
 		return c;
 	}
-
+	
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
@@ -311,30 +306,30 @@
 	protected Control createDialogArea(Composite composite) {
 		// this.parent = composite;
 		super.createDialogArea(composite);
-
+		
 		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 		GridLayout layout = new GridLayout(1, true);
 		composite.setLayout(layout);
-
-//		ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.BORDER| SWT.H_SCROLL | SWT.V_SCROLL);
-//		scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-//		scrolledComposite.setLayout(new GridLayout(1, true));
-
+		
+		// ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.BORDER| SWT.H_SCROLL | SWT.V_SCROLL);
+		// scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+		// scrolledComposite.setLayout(new GridLayout(1, true));
+		
 		GLComposite columns = new GLComposite(composite, SWT.NONE, "columns");
 		columns.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 		columns.getLayout().numColumns = 1;
-
-//		scrolledComposite.setContent(columns);
-//		scrolledComposite.addListener( SWT.Resize, event -> {
-//			  int width = scrolledComposite.getClientArea().width;
-//			  scrolledComposite.setMinSize( composite.computeSize( width, SWT.DEFAULT ) );
-//			} );
-
-
+		
+		// scrolledComposite.setContent(columns);
+		// scrolledComposite.addListener( SWT.Resize, event -> {
+		// int width = scrolledComposite.getClientArea().width;
+		// scrolledComposite.setMinSize( composite.computeSize( width, SWT.DEFAULT ) );
+		// } );
+		
+		
 		if (numberOfParameters > MAX_PARAMETERS_PER_LINE) {
 			columns.getLayout().numColumns = 1 + (numberOfParameters / MAX_PARAMETERS_PER_LINE);
 		}
-
+		
 		GLComposite column = new GLComposite(columns, SWT.NONE, "column");
 		GridData gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
 		gdata.minimumWidth = 200;
@@ -352,7 +347,7 @@
 				column.setLayoutData(gdata);
 				column.getLayout().makeColumnsEqualWidth = false;
 			}
-
+			
 			// each widget is initialized with de default value set in @Field@def attribute
 			String widgetName = option.widget();
 			ParameterField widget = null;
@@ -407,10 +402,10 @@
 			else {
 				System.out.println(TXMUIMessages.unknowedWidgetNameColon + widgetName + TXMUIMessages.FileTreeContentProvider_4);
 			}
-
+			
 			if (widget != null) {
 				widgets.put(option.name(), widget);
-
+				
 				// set default value in the fields, not enough if args contains the value
 				String value = defaultValues.getProperty(option.name());
 				if (value != null) { // set the default value using the properties stored
@@ -419,10 +414,10 @@
 			}
 		}
 		new Label(composite, SWT.NONE).setText(TXMUIMessages.mandatoryFields);
-
+		
 		return composite;
 	}
-
+	
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
@@ -430,12 +425,12 @@
 	@Override
 	protected void okPressed() {
 		error = false;
-
+		
 		// get widget values
 		for (String field : widgets.keySet()) {
 			ParameterField w = widgets.get(field);
 			Object value = w.getWidgetValue();
-
+			
 			// is widget set if mandatory EXCEPT "Separator" widgets
 			if (w.isWidgetMandatory() && value == null && !("Separator".equals(w.getWidgetType()))) {
 				System.out.println(TXMUIMessages.errorColonMissingValueColon + field);
@@ -446,18 +441,18 @@
 				// System.out.println(""+field+"\t"+values.get(field));
 			} // else value is not filled
 		}
-
+		
 		// initialize variables
 		if (!error) {
 			initializeMacroVariables();
 			saveParameters();
-
+			
 			if (!error) {
 				super.okPressed();
 			}
 		}
 	}
-
+	
 	private void saveParameters() {
 		if (!error) {
 			try {
@@ -470,15 +465,15 @@
 			}
 		}
 	}
-
-
+	
+	
 	/**
 	 * can use the args map to initialize variable not set with the dialog box
 	 */
 	private void initializeMacroVariables() {
 		// System.out.println("Initialize macro variables of "+fieldNames);
 		if (bean == null) return;
-
+		
 		Class c = bean.getClass();
 		for (String name : fieldNames) {
 			Object value = values.get(name);
@@ -497,7 +492,7 @@
 					defaultValues.setProperty(name, value.toString());
 				}
 			}
-
+			
 			try {
 				// System.out.println("setting "+name+ " with "+values.get(name));
 				Field field = c.getDeclaredField(name);
@@ -509,21 +504,21 @@
 				Log.printStackTrace(e);
 				error = true;
 			}
-
+			
 		}
 	}
-
-
+	
+	
 	protected boolean isError() {
 		return error;
 	}
-
+	
 	public HashMap<String, Object> getValues() {
 		return values;
 	}
-
+	
 	static boolean errorOpen, retOpen;
-
+	
 	/**
 	 * Conveniance method to initialize the parameters dialog.
 	 * Can detect the "args" Groovy binding and use it to set variables
@@ -535,22 +530,22 @@
 	public static boolean open(final Object bean) {
 		errorOpen = true;
 		retOpen = false;
-
+		
 		// if (!(bean instanceof groovy.lang.Script)) {
 		// System.out.println(Messages.ParametersDialog_15);
 		// return false;
 		// }
-
+		
 		Object oArgs = null;
 		if (bean instanceof groovy.lang.Script) {
 			groovy.lang.Script script = (groovy.lang.Script) bean;
-
+			
 			// if the "args" variable exists then use its values. Can be used to set a default value by another Macro
 			if (script.getBinding().hasVariable("args")) {
 				oArgs = script.getBinding().getVariable("args"); //$NON-NLS-1$
 			}
 		}
-
+		
 		final Map args;
 		if (oArgs == null || !(oArgs instanceof Map)) {
 			args = new HashMap<String, Object>();
@@ -558,24 +553,24 @@
 		else {
 			args = (Map) oArgs;
 		}
-
+		
 		if (bean instanceof groovy.lang.Script) { // create the args binding if not already existing
 			groovy.lang.Script script = (groovy.lang.Script) bean;
 			if (!script.getBinding().hasVariable("args")) {
 				script.getBinding().setVariable("args", args);
 			}
 		}
-
+		
 		Display.getDefault().syncExec(new Runnable() {
-
+			
 			@Override
 			public void run() {
 				boolean okNames = true;
 				CmdLineParser parser = new CmdLineParser(bean);
-
+				
 				Display display = Display.getCurrent();
 				Shell shell = display.getActiveShell();
-
+				
 				// check names
 				Class c = bean.getClass();
 				for (OptionHandler opt : parser.getOptions()) {
@@ -604,7 +599,7 @@
 						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")) {
@@ -617,15 +612,15 @@
 		});
 		return retOpen && !errorOpen;
 	}
-
+	
 	public boolean getMustShowDialog() {
 		return mustShowDialog;
 	}
-
+	
 	protected int getNumberOfFields() {
 		return numberOfParameters;
 	}
-
+	
 	// TODO: uncomment this to enable "args" detection
 	// public int open() {
 	// System.out.println("Number of parameters: "+numberOfParameters);
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersManager.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersManager.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersManager.java	(revision 3022)
@@ -0,0 +1,435 @@
+package org.txm.rcp.swt.widget.parameters;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.NamedOptionDef;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+/**
+ * Manages parameter and default parameters.
+ * 
+ * Store parameters history
+ * 
+ * export to properties or LinkedHashMap.
+ * 
+ * @author mdecorde
+ *
+ */
+public class ParametersManager {
+	
+	/**
+	 * parameters informations to manage the values
+	 */
+	LinkedHashMap<String, NamedOptionDef> parameters;
+	
+	/**
+	 * values set by default
+	 */
+	LinkedHashMap<String, Object> defaultValues = new LinkedHashMap<>();
+	
+	/**
+	 * values set by the user
+	 */
+	LinkedHashMap<String, Object> chosenValues = new LinkedHashMap<>();
+	
+	ArrayList<LinkedHashMap<String, Object>> history = new ArrayList<>();
+	
+	int MAX_HISTORY = 10;
+	
+	/**
+	 * Default history size = 10
+	 */
+	public ParametersManager() {
+		
+	}
+	
+	/**
+	 * 
+	 * @param history_size 0 or + ; 0 deactivate history
+	 */
+	public ParametersManager(int history_size) {
+		if (history_size >= 0) {
+			MAX_HISTORY = history_size;
+		}
+	}
+	
+	public boolean setParametersOptions(List<NamedOptionDef> parameters) {
+		this.parameters = new LinkedHashMap<>();
+		for (NamedOptionDef def : parameters) {
+			this.parameters.put(def.name(), def);
+		}
+		
+		return validateParametersDefinition().size() == 0;
+	}
+	
+	public List<String> validateParametersDefinition() {
+		if (parameters == null) return new ArrayList<>();
+		
+		ArrayList<String> errors = new ArrayList<>();
+		for (NamedOptionDef p : parameters.values()) {
+			if (!CmdLineParser.widgets.contains(p.widget())) {
+				errors.add(p.name());
+			}
+		}
+		return errors;
+	}
+	
+	/**
+	 * 
+	 * @return true if ALL mandatory parameters are set
+	 */
+	public boolean validate() {
+		for (NamedOptionDef def : parameters.values()) {
+			String key = def.name();
+			if (!defaultValues.containsKey(key) && !chosenValues.containsKey(key)) {
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	/**
+	 * 
+	 * @return true if chosen values are restored
+	 */
+	public boolean historyBack() {
+		if (MAX_HISTORY <= 0) { // no history
+			return false;
+		}
+		
+		if (history.size() > 0) {
+			
+			history.remove(history.size() - 1); // remove current
+			
+			chosenValues = history.get(history.size() - 1);
+			System.out.println("restore: " + chosenValues);
+			return true;
+		}
+		else {
+			return false;
+		}
+	}
+	
+	// /**
+	// *
+	// * @return true if chosen values are forwarded
+	// */
+	// public boolean historyForward() {
+	// if (MAX_HISTORY <= 0) { // no history
+	// return false;
+	// }
+	// if (historyPointer < MAX_HISTORY) {
+	// historyPointer++;
+	// chosenValues = history.get(historyPointer);
+	// return true;
+	// }
+	// else {
+	// return false;
+	// }
+	// }
+	
+	/**
+	 * update history if MAX_HISTORY > 0
+	 */
+	protected void historyUpdate() {
+		if (MAX_HISTORY <= 0) { // no history
+			return;
+		}
+		LinkedHashMap<String, Object> clone = (LinkedHashMap<String, Object>) chosenValues.clone();
+		// for (String k : clone) { clone.put(k, clone.get(k).clone())
+		history.add(clone);
+		
+		if (history.size() > MAX_HISTORY) {
+			history.remove(0);
+		}
+	}
+	
+	
+	public ParametersManager(LinkedHashMap<String, Object> initialValues) {
+		updateChosenValues(initialValues);
+	}
+	
+	public ParametersManager(LinkedHashMap<String, Object> initialValues, LinkedHashMap<String, Object> defaultValues) {
+		updateChosenValues(initialValues);
+		updateDefaultValues(defaultValues);
+	}
+	
+	
+	public void clearChosenValue() {
+		chosenValues.clear();
+		
+		historyUpdate();
+	}
+	
+	public void updateChosenValue(String key, Object value) {
+		chosenValues.put(key, value);
+		
+		historyUpdate();
+	}
+	
+	public void updateChosenValues(LinkedHashMap<String, Object> newChosenValues) {
+		for (String key : newChosenValues.keySet()) {
+			chosenValues.put(key, newChosenValues.get(key));
+		}
+		
+		historyUpdate();
+	}
+	
+	public void removeChosenValue(String key) {
+		chosenValues.remove(key);
+		
+		historyUpdate();
+	}
+	
+	public void removeChosenValues(Collection<String> keys) {
+		for (String key : keys) {
+			chosenValues.remove(key);
+		}
+		
+		historyUpdate();
+	}
+	
+	public void clearDefaultValues(LinkedHashMap<String, Object> newDefaultValues) {
+		defaultValues.clear();
+	}
+	
+	public void updateDefaultValues(Map<String, Object> newDefaultValues) {
+		for (String key : newDefaultValues.keySet()) {
+			defaultValues.put(key, newDefaultValues.get(key));
+		}
+	}
+	
+	public void updateDefaultValue(String key, Object value) {
+		defaultValues.put(key, value);
+	}
+	
+	public void removeDefaultValue(String key) {
+		defaultValues.remove(key);
+	}
+	
+	public void removeDefaultValue(Collection<String> keys) {
+		for (String key : keys) {
+			defaultValues.remove(key);
+		}
+	}
+	
+	/**
+	 * compile default and chosen values
+	 * 
+	 * @return
+	 */
+	public LinkedHashMap<String, Object> getFinalValues() {
+		LinkedHashMap<String, Object> finalValues = new LinkedHashMap<>(defaultValues);
+		for (String key : chosenValues.keySet()) {
+			finalValues.put(key, chosenValues.get(key));
+		}
+		return finalValues;
+	}
+	
+	/**
+	 * compile and export values to a Properties object
+	 * 
+	 * @return
+	 */
+	public Properties finalToProperties() {
+		Properties props = new Properties();
+		LinkedHashMap<String, Object> values = getFinalValues();
+		for (String k : values.keySet()) {
+			if (values.get(k).toString() != null) {
+				props.setProperty(k, values.get(k).toString());
+			}
+		}
+		return props;
+	}
+	
+	/**
+	 * read parameters from a Properties object.
+	 * Values are casted to specific object if the parameters informations are set
+	 * 
+	 * @return a hashmap of values (Object)
+	 */
+	public LinkedHashMap<String, Object> propertiesToValues(Properties props) {
+		LinkedHashMap<String, Object> newChosenValues = new LinkedHashMap<>();
+		for (Object okey : props.keySet()) {
+			String key = okey.toString();
+			String stringValue = props.getProperty(key);
+			
+			Object value = stringToValue(stringValue, key);
+			
+			newChosenValues.put(key, value);
+		}
+		
+		return newChosenValues;
+	}
+	
+	/**
+	 * read parameters from a HashMap<String, String> object.
+	 * Values are casted to specific object if the parameters informations are set
+	 * 
+	 * @return
+	 */
+	public LinkedHashMap<String, Object> hashToValues(Map<String, String> map) {
+		LinkedHashMap<String, Object> newChosenValues = new LinkedHashMap<>();
+		for (String key : map.keySet()) {
+			String stringValue = map.get(key);
+			
+			Object value = stringToValue(stringValue, key);
+			
+			newChosenValues.put(key, value);
+		}
+		
+		return newChosenValues;
+	}
+	
+	private Object stringToValue(String stringValue, String key) {
+		if (stringValue == null) return null;
+		
+		String widgetName = getParameterType(key);
+		
+		Object value = null;
+		if ("File".equals(widgetName) || "FileOpen".equals(widgetName)) { //$NON-NLS-1$
+			value = new File(stringValue);
+		}
+		else if ("CreateFile".equals(widgetName) || "FileSave".equals(widgetName)) { //$NON-NLS-1$
+			value = new File(stringValue);
+		}
+		else if ("Folder".equals(widgetName)) { //$NON-NLS-1$
+			value = new File(stringValue);
+		}
+		else if ("Query".equals(widgetName)) { //$NON-NLS-1$
+			value = new CQLQuery(stringValue);
+		}
+		else if ("Date".equals(widgetName)) { //$NON-NLS-1$
+			try {
+				value = DateField.formater.parse(stringValue);
+			}
+			catch (ParseException e) {
+				Log.severe("Wrong default date format: " + stringValue + ". Waiting for: " + DateField.STRINGFORMAT + ". Error = " + e + ".");
+				value = new Date();
+			}
+		}
+		else if ("Time".equals(widgetName)) { //$NON-NLS-1$
+			value = Integer.parseInt(stringValue);
+		}
+		else if ("String".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("Separator".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("Password".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("StringArray".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("StringArrayMultiple".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("StructuralUnits".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("Text".equals(widgetName)) { //$NON-NLS-1$
+			value = stringValue;
+		}
+		else if ("Integer".equals(widgetName)) { //$NON-NLS-1$
+			value = Integer.parseInt(stringValue);
+		}
+		else if ("Float".equals(widgetName)) { //$NON-NLS-1$
+			value = Float.parseFloat(stringValue);
+		}
+		else if ("Boolean".equals(widgetName)) { //$NON-NLS-1$
+			value = Boolean.parseBoolean(stringValue);
+		}
+		else {
+			value = stringValue;
+		}
+		
+		return value;
+	}
+	
+	private String getParameterType(String key) {
+		if (key == null || parameters == null || !parameters.containsKey(key)) {
+			return "String";
+		}
+		
+		return parameters.get(key).widget();
+	}
+	
+	/**
+	 * compile and export values to a Properties object
+	 * 
+	 * @return true if bean fields have been updated
+	 */
+	public boolean finalToBean(Object bean) {
+		if (bean == null) return false;
+		boolean ok = true;
+		LinkedHashMap<String, Object> values = getFinalValues();
+		
+		Class<?> c = bean.getClass();
+		for (String name : values.keySet()) {
+			
+			try {
+				// System.out.println("setting "+name+ " with "+values.get(name));
+				Field field = c.getDeclaredField(name);
+				field.setAccessible(true); // enable
+				field.set(bean, values.get(name));
+			}
+			catch (Exception e) {
+				System.out.println(TXMUIMessages.errorInAtOptionNameDeclarationColon + e.getMessage());
+				Log.printStackTrace(e);
+				ok = false;
+			}
+		}
+		return ok;
+	}
+	
+	/**
+	 * compile and export values to a Properties object
+	 * 
+	 * @return
+	 * @throws IOException
+	 */
+	public void finalToFile(File propFile) throws IOException {
+		Properties props = finalToProperties();
+		PrintWriter writer = IOUtils.getWriter(propFile);
+		props.store(writer, "TXM parameters");
+		writer.close();
+		return;
+	}
+	
+	public static void main(String[] args) {
+		AtestClass atc = new AtestClass();
+		ParametersManager pm = new ParametersManager();
+		pm.updateChosenValue("file", new File("testfile"));
+		pm.updateChosenValue("dir", new File("testdir"));
+		pm.updateChosenValue("ii", 1);
+		pm.historyBack();
+		pm.historyBack();
+		pm.finalToBean(atc);
+		System.out.println("atc=" + atc);
+	}
+	
+	public LinkedHashMap<String, Object> getDefaultValues() {
+		return defaultValues;
+	}
+	
+	public LinkedHashMap<String, NamedOptionDef> getParameters() {
+		return parameters;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/ParametersManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 3022)
@@ -642,7 +642,7 @@
 
 loadingTheP0BinaryCorpusAsATXM079Corpus = Loading the {0} binary corpus as a TXM 0.7.9 corpus...
 
-loadingTheP0BinaryCorpusAsATXM080Corpus = Loading the {0} binary corpus as a TXM 0.8.0 corpus...
+theP0BinaryCorpusVersionIsP1=The {0} binary corpus version is {1}.
 
 loadingViews = Loading views
 
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 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 3022)
@@ -608,10 +608,8 @@
 
 loadingTheCorpusInThePlatform = Chargement du corpus dans la plateforme...
 
-loadingTheP0BinaryCorpusAsATXM079Corpus = Chargement du corpus binaire au format 0.7.9 {0}...
+theP0BinaryCorpusVersionIsP1=La version du corpus binaire {0} est {1}.
 
-loadingTheP0BinaryCorpusAsATXM080Corpus = Chargement du corpus binaire au format 0.8.0 {0}...
-
 loadingViews = Chargement des vues
 
 lockRCPWorkspace = Verrouiller l'espace de travail RCP
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 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 3022)
@@ -602,7 +602,7 @@
 	
 	public static String loadingTheP0BinaryCorpusAsATXM079Corpus;
 	
-	public static String loadingTheP0BinaryCorpusAsATXM080Corpus;
+	public static String theP0BinaryCorpusVersionIsP1;
 	
 	public static String loadingViews;
 	
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 3022)
@@ -102,6 +102,7 @@
 		// Hacking p2 profile to be able to update installation directory even if
 		// -configuration is set
 		try {
+			Log.info("Looking for TXM updates...");
 			ProvisioningUI pui = ProvisioningUI.getDefaultUI();
 			
 			String profileId = pui.getProfileId();
@@ -158,7 +159,6 @@
 			// add alpha and beta repos if needed
 			// from bundle org.eclipse.equinox.p2.console
 			
-			Log.info("Looking for TXM updates...");
 			Object ret = super.execute(event);
 			Log.info("Done.");
 			
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersComposite.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersComposite.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersComposite.java	(revision 3022)
@@ -1,265 +0,0 @@
-package org.txm.rcp.views.cmdparameters;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
-import org.txm.objects.Project;
-import org.txm.rcp.IImageKeys;
-import org.txm.rcp.preferences.RCPPreferences;
-import org.txm.rcp.swt.GLComposite;
-
-public class ParametersComposite extends GLComposite {
-	
-	private TreeViewer tv;
-	
-	private TreeViewerColumn nameColumn;
-	
-	private TreeViewerColumn valueColumn;
-	
-	private TextCellEditor cellEditor;
-	
-	public static String DEFAULT_REFS = "class,user_name";
-	
-	private String[] references = DEFAULT_REFS.split(",");
-	
-	public ParametersComposite(Composite parent, int style) {
-		super(parent, style, "Parameters");
-		
-		tv = new TreeViewer(this, SWT.VIRTUAL);
-		tv.getTree().setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).create());
-		tv.getTree().setHeaderVisible(true);
-		tv.getTree().setLinesVisible(true);
-		tv.setContentProvider(new ITreeContentProvider() {
-			
-			@Override
-			public Object[] getElements(Object inputElement) {
-				if (inputElement instanceof String) {
-					String npath = inputElement.toString();
-					Object[] children = getChildren(TXMPreferences.preferencesRootNode.node(npath));
-					return children;
-				}
-				else if (inputElement instanceof Project) {
-					Project project = (Project) inputElement;
-					IEclipsePreferences prefs = project.getPreferencesScope().getNode("/project/" + project.getName());
-					return getChildren(prefs);
-				}
-				else if (inputElement instanceof TXMResult) {
-					TXMResult result = (TXMResult) inputElement;
-					// return new Object[] {TXMPreferences.preferencesRootNode.node(result.getParametersNodePath())};
-					return getChildren(TXMPreferences.preferencesRootNode.node(result.getParametersNodePath()));
-				}
-				else if (inputElement instanceof IProject) {
-					IProject project = (IProject) inputElement;
-					return getChildren(TXMPreferences.preferencesRootNode.node("/" + project.getName()));
-				}
-				
-				return new Object[0];
-			}
-			
-			@Override
-			public Object[] getChildren(Object parentElement) {
-				if (parentElement instanceof Preferences) {
-					Preferences prefs = (Preferences) parentElement;
-					try {
-						ArrayList<Object> children = new ArrayList<>();
-						String[] nodes = prefs.childrenNames();
-						Arrays.sort(nodes);
-						for (String n : nodes) {
-							children.add(prefs.node(n));
-						}
-						
-						String[] attributes = null;
-						// FIXME: SJ => MD, I commented this atm
-						// if (RCPPreferences.getInstance().getBoolean(RCPPreferences.EXPERT_USER)) {
-						//
-						// } else {
-						attributes = prefs.keys();
-						// }
-						Arrays.sort(attributes);
-						for (String name : attributes) {
-							children.add(new Object[] { prefs, name });
-						}
-						return children.toArray();
-					}
-					catch (BackingStoreException e) {
-						e.printStackTrace();
-					}
-				}
-				return null;
-			}
-			
-			@Override
-			public Object getParent(Object element) {
-				if (element instanceof Preferences) {
-					Preferences prefs = (Preferences) element;
-					return prefs.parent();
-				}
-				return null;
-			}
-			
-			@Override
-			public boolean hasChildren(Object element) {
-				if (element instanceof Preferences) {
-					Preferences prefs = (Preferences) element;
-					try {
-						return prefs.childrenNames().length > 0 || prefs.keys().length > 0;
-					}
-					catch (BackingStoreException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
-				}
-				return false;
-			}
-			
-		});
-		
-		nameColumn = new TreeViewerColumn(tv, SWT.NONE);
-		nameColumn.getColumn().setText("node");
-		nameColumn.getColumn().pack();
-		nameColumn.setLabelProvider(new CellLabelProvider() {
-			
-			@Override
-			public void update(ViewerCell cell) {
-				Object element = cell.getElement();
-				
-				if (element instanceof Preferences) {
-					Preferences c = (Preferences) element;
-					if (references != null && references.length > 0) {
-						ArrayList<String> values = new ArrayList<>();
-						for (String k : references) {
-							if (c.get(k, null) != null) {
-								values.add(c.get(k, null));
-							}
-						}
-						
-						if (values.size() == 0) values.add(c.name());
-						cell.setText(StringUtils.join(values, ", "));
-					}
-					else {
-						cell.setText(c.name());
-					}
-					
-					if (c.get("class", null) != null && c.get("class", null).startsWith("org.txm")) {
-						cell.setImage(IImageKeys.getImage(IImageKeys.PROJECT));
-					}
-				}
-				else if (element instanceof Object[]) {
-					Object[] c = (Object[]) element;
-					
-					cell.setText(c[1].toString());
-				}
-				else {
-					cell.setText(element.toString());
-				}
-			}
-			
-		});
-		valueColumn = new TreeViewerColumn(tv, SWT.NONE);
-		valueColumn.getColumn().setText("value");
-		valueColumn.getColumn().pack();
-		valueColumn.setLabelProvider(new CellLabelProvider() {
-			
-			@Override
-			public void update(ViewerCell cell) {
-				Object element = cell.getElement();
-				
-				if (element instanceof Preferences) {
-					Preferences c = (Preferences) element;
-					cell.setText("");
-				}
-				else if (element instanceof Object[]) {
-					Object[] c = (Object[]) element;
-					Preferences p = (Preferences) c[0];
-					cell.setText(p.get(c[1].toString(), ""));
-				}
-				else {
-					cell.setText(element.toString());
-				}
-			}
-		});
-		
-		cellEditor = new TextCellEditor(tv.getTree());
-		valueColumn.setEditingSupport(new EditingSupport(tv) {
-			
-			@Override
-			protected void setValue(Object element, Object value) {
-				if (element instanceof Object[]) {
-					Object[] data = (Object[]) element;
-					Preferences prefs = (Preferences) data[0];
-					String key = data[1].toString();
-					prefs.put(key, value.toString());
-					tv.refresh(element);
-					
-				}
-				return;
-			}
-			
-			@Override
-			protected Object getValue(Object element) {
-				if (element instanceof Object[]) {
-					Object[] data = (Object[]) element;
-					Preferences prefs = (Preferences) data[0];
-					String key = data[1].toString();
-					return prefs.get(key, "");
-				}
-				return null;
-			}
-			
-			@Override
-			protected TextCellEditor getCellEditor(Object element) {
-				return cellEditor;
-			}
-			
-			@Override
-			protected boolean canEdit(Object element) {
-				return element instanceof Object[];
-			}
-		});
-	}
-	
-	
-	
-	public void updateEditorParameters(Object input) {
-		tv.setInput(input);
-		nameColumn.getColumn().pack();
-		valueColumn.getColumn().pack();
-	}
-	
-	
-	
-	public void refresh() {
-		tv.refresh();
-	}
-	
-	public void setReferences(String[] split) {
-		references = split;
-	}
-	
-	public TreeViewer getTreeViewer() {
-		return tv;
-	}
-	
-	public Object getInput() {
-		return tv.getInput();
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersView.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersView.java	(revision 3022)
@@ -1,708 +0,0 @@
-// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
-// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
-// Lyon 2, University of Franche-Comté, University of Nice
-// Sophia Antipolis, University of Paris 3.
-// 
-// The TXM platform is free software: you can redistribute it
-// and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation,
-// either version 2 of the License, or (at your option) any
-// later version.
-// 
-// The TXM platform is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-// PURPOSE. See the GNU General Public License for more
-// details.
-// 
-// You should have received a copy of the GNU General
-// Public License along with the TXM platform. If not, see
-// http://www.gnu.org/licenses.
-// 
-// 
-// 
-// $LastChangedDate:$
-// $LastChangedRevision:$
-// $LastChangedBy:$ 
-//
-package org.txm.rcp.views.cmdparameters;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.TypeVariable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.part.ViewPart;
-import org.txm.core.results.Parameter;
-import org.txm.core.results.TXMResult;
-import org.txm.rcp.IImageKeys;
-import org.txm.rcp.editors.TXMEditor;
-import org.txm.rcp.swt.widget.PropertiesSelector;
-import org.txm.rcp.swt.widget.QueryWidget;
-import org.txm.rcp.swt.widget.ReferencePatternSelector;
-import org.txm.searchengine.core.IQuery;
-import org.txm.searchengine.cqp.ReferencePattern;
-import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
-import org.txm.searchengine.cqp.corpus.CQPCorpus;
-import org.txm.searchengine.cqp.corpus.Property;
-import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
-import org.txm.searchengine.cqp.corpus.WordProperty;
-
-/**
- * Alternative display of the TXMEditor form fields
- * 
- * @author mdecorde.
- */
-public class ParametersView extends ViewPart implements IPartListener, IPropertyListener {
-	
-	/** The ID. */
-	public static String ID = ParametersView.class.getName(); // $NON-NLS-1$
-	
-	/**
-	 * Instantiates a new queries view.
-	 */
-	public ParametersView() {
-		
-		IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
-		service.addPartListener(this);
-	}
-	
-	@Override
-	public void dispose() {
-		
-		IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
-		service.removePartListener(this);
-	}
-	
-	/**
-	 * Refresh.
-	 */
-	public static void refresh() {
-		
-	}
-	
-	TXMEditor<? extends TXMResult> activated;
-	
-	private Composite panel;
-	
-	private ScrolledComposite scrollC;
-	
-	private Button recompute;
-	
-	public void updateEditorParameters() throws Exception {
-		
-		EditorPart editor = activated;
-		
-		for (Control c : panel.getChildren()) {
-			c.dispose();
-		}
-		
-		if (editor == null) {
-			new Label(panel, SWT.NONE).setText("No editor selected.");
-			recompute.setEnabled(false);
-			return;
-		}
-		
-		if (!(editor instanceof TXMEditor)) {
-			new Label(panel, SWT.NONE).setText("Editor is not a TXMPartEditor: " + editor);
-			return;
-		}
-		recompute.setEnabled(true);
-		TXMEditor reditor = (TXMEditor) editor;
-		final TXMResult result = reditor.getResult();
-		
-		List<Field> allfields = result.getAllFields();
-		List<Field> fields = new ArrayList<>();
-		for (Field f : allfields) {
-			Parameter parameter = f.getAnnotation(Parameter.class);
-			if (parameter == null) {
-				continue;
-			}
-			fields.add(f);
-		}
-		
-		Collections.sort(fields, new Comparator<Field>() {
-			
-			@Override
-			public int compare(Field o1, Field o2) {
-				
-				Parameter parameter1 = o1.getAnnotation(Parameter.class);
-				Parameter parameter2 = o2.getAnnotation(Parameter.class);
-				
-				if (parameter1.type() == parameter2.type()) {
-					return o1.getName().compareTo(o2.getName());
-				}
-				else {
-					return parameter1.type() - parameter2.type();
-				}
-			}
-		});
-		
-		for (final Field f : fields) {
-			Parameter parameter = f.getAnnotation(Parameter.class);
-			if (parameter == null) {
-				continue;
-			}
-			
-			String name;
-			if (!parameter.key().isEmpty()) {
-				name = parameter.key();
-			}
-			else {
-				name = f.getName();
-			}
-			Class<?> clazz = f.getType();
-			f.setAccessible(true);
-			final Object value = f.get(result);
-			
-			new Label(panel, SWT.NONE).setText(name);
-			clazz.equals(Integer.class);
-			Control c = null;
-			if (clazz.equals(Integer.class)) {
-				final Spinner sp = new Spinner(panel, SWT.BORDER);
-				if (value != null) {
-					sp.setSelection((Integer) value);
-				}
-				sp.addSelectionListener(new SelectionListener() {
-					
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						
-						try {
-							f.set(result, sp.getSelection());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							// TODO Auto-generated catch block
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void widgetDefaultSelected(SelectionEvent e) {}
-				});
-				c = sp;
-			}
-			else if (clazz.equals(String.class)) {
-				final Text t = new Text(panel, SWT.BORDER);
-				if (value != null) {
-					t.setText(value.toString());
-				}
-				t.addKeyListener(new org.eclipse.swt.events.KeyListener() {
-					
-					@Override
-					public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
-						
-						try {
-							f.set(result, t.getText());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							// TODO Auto-generated catch block
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
-						// TODO Auto-generated method stub
-						
-					}
-				});
-				c = t;
-			}
-			else if (clazz.equals(Float.class)) {
-				final Spinner sp = new Spinner(panel, SWT.BORDER);
-				sp.setSelection((int) ((Float) value * 2));
-				sp.addSelectionListener(new SelectionListener() {
-					
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						
-						try {
-							f.set(result, sp.getSelection());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void widgetDefaultSelected(SelectionEvent e) {}
-				});
-				c = sp;
-				((Spinner) c).setDigits(2);
-			}
-			else if (clazz.equals(Boolean.class)) {
-				final Button sp = new Button(panel, SWT.CHECK);
-				sp.addSelectionListener(new SelectionListener() {
-					
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						
-						try {
-							f.set(result, sp.getSelection());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void widgetDefaultSelected(SelectionEvent e) {}
-				});
-				c = sp;
-			}
-			else if (clazz.equals(IQuery.class)) {
-				final QueryWidget qw = new QueryWidget(panel, SWT.NONE);
-				if (value != null) {
-					qw.setText(((IQuery) value).getQueryString());
-				}
-				qw.addSelectionListener(new SelectionListener() {
-					
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						
-						try {
-							f.set(result, qw.getQuery());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							// TODO Auto-generated catch block
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void widgetDefaultSelected(SelectionEvent e) {}
-				});
-				qw.addKeyListener(new org.eclipse.swt.events.KeyListener() {
-					
-					@Override
-					public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
-						
-						if (e.keyCode != SWT.KEYPAD_CR && e.keyCode != SWT.CR) {
-							return;
-						}
-						try {
-							f.set(result, qw.getQuery());
-							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-								activated.compute(false);
-							}
-						}
-						catch (Exception e1) {
-							// TODO Auto-generated catch block
-							e1.printStackTrace();
-						}
-					}
-					
-					@Override
-					public void keyPressed(org.eclipse.swt.events.KeyEvent e) {}
-				});
-				c = qw;
-			}
-			else if (clazz.equals(File.class)) {
-				final Button b = new Button(panel, SWT.PUSH);
-				if (value != null) {
-					b.setText(value.toString());
-					
-				}
-				
-				b.addSelectionListener(new SelectionListener() {
-					
-					@Override
-					public void widgetSelected(SelectionEvent e) {
-						
-						File file = (File) value;
-						if (file.isDirectory()) {
-							DirectoryDialog dialog = new DirectoryDialog(panel.getDisplay().getActiveShell());
-							dialog.setText("Choose directory");
-							dialog.setFilterPath(file.getAbsolutePath());
-							String path = dialog.open();
-							if (path != null) {
-								try {
-									f.set(result, path);
-									b.setText(path);
-									if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-										activated.compute(false);
-									}
-								}
-								catch (IllegalArgumentException e1) {
-									// TODO Auto-generated catch block
-									e1.printStackTrace();
-								}
-								catch (IllegalAccessException e1) {
-									// TODO Auto-generated catch block
-									e1.printStackTrace();
-								}
-							}
-						}
-						else {
-							FileDialog dialog = new FileDialog(panel.getDisplay().getActiveShell());
-							dialog.setText("Choose directory");
-							dialog.setFilterPath(file.getAbsolutePath());
-							String path = dialog.open();
-							if (path != null) {
-								try {
-									f.set(result, path);
-									b.setText(path);
-									if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-										activated.compute(false);
-									}
-								}
-								catch (IllegalArgumentException e1) {
-									// TODO Auto-generated catch block
-									e1.printStackTrace();
-								}
-								catch (IllegalAccessException e1) {
-									// TODO Auto-generated catch block
-									e1.printStackTrace();
-								}
-							}
-						}
-					}
-					
-					@Override
-					public void widgetDefaultSelected(SelectionEvent e) {}
-				});
-			}
-			else if (clazz.equals(List.class)) {
-				List list = (List) value;
-				if (list.isEmpty()) {
-					Label l3 = new Label(panel, SWT.NONE);
-					l3.setText("no value");
-					c = l3;
-				}
-				else {
-					Object first = list.get(0);
-					if (first instanceof WordProperty) {
-						c = createWordPropertyField(f, result, list);
-					}
-					else if (first instanceof StructuralUnitProperty) {
-						c = createStructuralUnitPropertyField(f, result, list);
-					}
-				}
-				// } else if (value instanceof StructuralUnit) {
-			}
-			else if (clazz.equals(WordProperty.class)) {
-				ArrayList<WordProperty> selected = new ArrayList<>();
-				selected.add((WordProperty) value);
-				c = createWordPropertyField(f, result, selected);
-				// } else if (value instanceof StructuralUnit) {
-				// Label l2 = new Label(panel,
-				// SWT.NONE).setText("="+value.toString());
-			}
-			else if (clazz.equals(StructuralUnitProperty.class)) {
-				ArrayList<StructuralUnitProperty> selected = new ArrayList<>();
-				selected.add((StructuralUnitProperty) value);
-				c = createStructuralUnitPropertyField(f, result, selected);
-				// } else if (value instanceof ReferencePattern) {
-				// c = new Label(panel, SWT.NONE).setText("="+value.toString());
-			}
-			else if (clazz.equals(ReferencePattern.class)) {
-				c = createReferencePatternField(f, result, (ReferencePattern) value);
-				// } else if (value instanceof ReferencePattern) {
-				// c = new Label(panel, SWT.NONE).setText("="+value.toString());
-			}
-			else {
-				Label l2 = new Label(panel, SWT.NONE);
-				if (value != null) {
-					TypeVariable<?>[] pp = value.getClass().getTypeParameters();
-					l2.setText(clazz.getSimpleName() + "=" + value);
-				}
-				else {
-					l2.setText(clazz.getSimpleName() + "=" + value);
-				}
-				c = l2;
-			}
-			
-			if (c != null) {
-				c.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
-			}
-		}
-		scrollC.setContent(panel);
-		scrollC.setMinSize(panel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-		scrollC.setExpandHorizontal(true);
-		scrollC.setExpandVertical(true);
-		scrollC.layout(true);
-	}
-	
-	private Control createReferencePatternField(final Field f, final TXMResult result, ReferencePattern value) throws Exception {
-		
-		final List<Property> selected = new ArrayList<>();
-		selected.addAll(value.getProperties());
-		CQPCorpus corpus = value.getCorpus();
-		ReferencePatternSelector selector = new ReferencePatternSelector(panel, SWT.NONE);
-		if (corpus != null) {
-			List<Property> availables = new ArrayList<>();
-			availables.addAll(corpus.getOrderedProperties());
-			availables.addAll(corpus.getOrderedStructuralUnitProperties());
-			availables.removeAll(selected);
-			selector.setPattern(value.getPattern());
-			selector.setProperties(availables, selected);
-		}
-		selector.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				
-				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-					ReferencePattern p = new ReferencePattern(selected);
-					try {
-						f.set(result, p);
-					}
-					catch (IllegalArgumentException e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-					catch (IllegalAccessException e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-					activated.compute(false);
-				}
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		// selector.setLayoutData(layoutData);
-		return selector;
-	}
-	
-	protected PropertiesSelector<WordProperty> createWordPropertyField(final Field f, final TXMResult result, final List<WordProperty> selected) throws CqiClientException {
-		
-		WordProperty value = selected.get(0);
-		CQPCorpus corpus = value.getCorpus();
-		
-		ArrayList<WordProperty> availables = new ArrayList<>(corpus.getOrderedProperties());
-		availables.addAll(corpus.getVirtualProperties());
-		availables.remove(value);
-		
-		PropertiesSelector<WordProperty> selector = new PropertiesSelector<>(panel, SWT.NONE);
-		selector.setProperties(availables, selected);
-		selector.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				
-				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-					try {
-						f.set(result, selected);
-					}
-					catch (Exception e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-					activated.compute(false);
-				}
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		// selector.setLayoutData(layoutData);
-		return selector;
-	}
-	
-	private PropertiesSelector<StructuralUnitProperty> createStructuralUnitPropertyField(final Field f, final TXMResult result, final List<StructuralUnitProperty> selected) throws CqiClientException {
-		
-		StructuralUnitProperty value = selected.get(0);
-		CQPCorpus corpus = value.getCorpus();
-		ArrayList<StructuralUnitProperty> availables = new ArrayList<>();
-		availables.addAll(corpus.getOrderedStructuralUnitProperties());
-		availables.remove(value);
-		PropertiesSelector<StructuralUnitProperty> selector = new PropertiesSelector<>(panel, SWT.NONE);
-		selector.setProperties(availables, selected);
-		selector.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				
-				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-					try {
-						f.set(result, selected);
-					}
-					catch (Exception e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-					activated.compute(false);
-				}
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		return selector;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * @see
-	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
-	 * .Composite)
-	 */
-	@Override
-	public void createPartControl(Composite parent) {
-		
-		parent.setLayout(new GridLayout(1, true));
-		
-		recompute = new Button(parent, SWT.PUSH);
-		recompute.setImage(IImageKeys.getImage(IImageKeys.START));
-		recompute.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				
-				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
-					activated.compute(false);
-				}
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		recompute.setLayoutData(GridDataFactory.fillDefaults().align(GridData.BEGINNING, GridData.BEGINNING).grab(false, false).create());
-		recompute.setEnabled(false);
-		
-		scrollC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
-		scrollC.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
-		
-		panel = new Composite(scrollC, SWT.NONE);
-		panel.setLayout(new GridLayout(2, true));
-		
-		try {
-			updateEditorParameters();
-		}
-		catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	
-	@Override
-	public void partActivated(IWorkbenchPart part) {
-		
-		if (part == null)
-			return;
-		// System.out.println("partActivated: "+part);
-		if (part instanceof TXMEditor)
-			activated = (TXMEditor) part;
-		if (activated == null)
-			return;
-		activated.addPropertyListener(this);
-		recompute.setEnabled(true);
-		// activated.addPartPropertyListener(this);
-		try {
-			updateEditorParameters();
-		}
-		catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	
-	@Override
-	public void partBroughtToTop(IWorkbenchPart part) {
-		
-		if (part == null)
-			return;
-	}
-	
-	@Override
-	public void partClosed(IWorkbenchPart part) {
-		
-		if (part == null)
-			return;
-		if (part == activated) {
-			activated = null;
-			try {
-				updateEditorParameters();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-	
-	@Override
-	public void partDeactivated(IWorkbenchPart part) {
-		
-		if (part == null)
-			return;
-		// System.out.println("partDeactivated: "+part);
-		// if (part instanceof TXMEditor)
-		// activated = null;
-		// try {
-		// updateEditorParameters();
-		// } catch (Exception e) {
-		// // TODO Auto-generated catch block
-		// e.printStackTrace();
-		// }
-	}
-	
-	@Override
-	public void propertyChanged(Object source, int propId) {
-		
-		// System.out.println("Editor property changed: "+propId);
-		if (propId == EditorPart.PROP_DIRTY) {
-			try {
-				updateEditorParameters();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-	
-	@Override
-	public void partOpened(IWorkbenchPart part) {
-		
-		if (part == null)
-			return;
-	}
-	
-	@Override
-	public void setFocus() {
-		// TODO Auto-generated method stub
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultPreferencesView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultPreferencesView.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultPreferencesView.java	(revision 3022)
@@ -28,9 +28,7 @@
 package org.txm.rcp.views.cmdparameters;
 
 import java.lang.reflect.Field;
-import java.util.Arrays;
 import java.util.HashSet;
-import java.util.List;
 
 import org.eclipse.core.internal.resources.ProjectPreferences;
 import org.eclipse.jface.dialogs.InputDialog;
@@ -54,14 +52,13 @@
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
 import org.txm.core.results.Parameter;
 import org.txm.core.results.TXMResult;
 import org.txm.rcp.views.corpora.CorporaView;
 import org.txm.utils.logger.Log;
 
 /**
- * Alternative display of the TXMEditor form fields
+ * Provide an access to the TXMResult RCP preferences values
  * 
  * @author mdecorde.
  */
@@ -72,7 +69,7 @@
 	
 	private Text refs;
 	
-	private ParametersComposite parametersComposite;
+	private TXMResultParametersComposite parametersComposite;
 	
 	static HashSet<String> txmResultEntries = new HashSet<>();
 	static {
@@ -163,7 +160,7 @@
 		new Label(parent, SWT.NONE).setText("properties");
 		
 		refs = new Text(parent, SWT.BORDER);
-		refs.setText(ParametersComposite.DEFAULT_REFS);
+		refs.setText(TXMResultParametersComposite.DEFAULT_REFS);
 		refs.addKeyListener(new KeyListener() {
 			
 			@Override
@@ -243,7 +240,7 @@
 		
 		refresh.setLayoutData(GridDataFactory.fillDefaults().align(GridData.BEGINNING, GridData.BEGINNING).grab(false, false).create());
 		
-		parametersComposite = new ParametersComposite(parent, SWT.NONE);
+		parametersComposite = new TXMResultParametersComposite(parent, SWT.NONE);
 		parametersComposite.setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).span(8, 1).create());
 	}
 	
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersView.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersView.java	(revision 3022)
@@ -0,0 +1,708 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.rcp.views.cmdparameters;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPartService;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.part.ViewPart;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.swt.widget.PropertiesSelector;
+import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.rcp.swt.widget.ReferencePatternSelector;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.cqp.ReferencePattern;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+
+/**
+ * Alternative display of the TXMEditor form fields
+ * 
+ * @author mdecorde.
+ */
+public class TXMResultParametersView extends ViewPart implements IPartListener, IPropertyListener {
+	
+	/** The ID. */
+	public static String ID = TXMResultParametersView.class.getName(); // $NON-NLS-1$
+	
+	/**
+	 * Instantiates a new queries view.
+	 */
+	public TXMResultParametersView() {
+		
+		IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
+		service.addPartListener(this);
+	}
+	
+	@Override
+	public void dispose() {
+		
+		IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
+		service.removePartListener(this);
+	}
+	
+	/**
+	 * Refresh.
+	 */
+	public static void refresh() {
+		
+	}
+	
+	TXMEditor<? extends TXMResult> activated;
+	
+	private Composite panel;
+	
+	private ScrolledComposite scrollC;
+	
+	private Button recompute;
+	
+	public void updateEditorParameters() throws Exception {
+		
+		EditorPart editor = activated;
+		
+		for (Control c : panel.getChildren()) {
+			c.dispose();
+		}
+		
+		if (editor == null) {
+			new Label(panel, SWT.NONE).setText("No editor selected.");
+			recompute.setEnabled(false);
+			return;
+		}
+		
+		if (!(editor instanceof TXMEditor)) {
+			new Label(panel, SWT.NONE).setText("Editor is not a TXMPartEditor: " + editor);
+			return;
+		}
+		recompute.setEnabled(true);
+		TXMEditor reditor = (TXMEditor) editor;
+		final TXMResult result = reditor.getResult();
+		
+		List<Field> allfields = result.getAllFields();
+		List<Field> fields = new ArrayList<>();
+		for (Field f : allfields) {
+			Parameter parameter = f.getAnnotation(Parameter.class);
+			if (parameter == null) {
+				continue;
+			}
+			fields.add(f);
+		}
+		
+		Collections.sort(fields, new Comparator<Field>() {
+			
+			@Override
+			public int compare(Field o1, Field o2) {
+				
+				Parameter parameter1 = o1.getAnnotation(Parameter.class);
+				Parameter parameter2 = o2.getAnnotation(Parameter.class);
+				
+				if (parameter1.type() == parameter2.type()) {
+					return o1.getName().compareTo(o2.getName());
+				}
+				else {
+					return parameter1.type() - parameter2.type();
+				}
+			}
+		});
+		
+		for (final Field f : fields) {
+			Parameter parameter = f.getAnnotation(Parameter.class);
+			if (parameter == null) {
+				continue;
+			}
+			
+			String name;
+			if (!parameter.key().isEmpty()) {
+				name = parameter.key();
+			}
+			else {
+				name = f.getName();
+			}
+			Class<?> clazz = f.getType();
+			f.setAccessible(true);
+			final Object value = f.get(result);
+			
+			new Label(panel, SWT.NONE).setText(name);
+			clazz.equals(Integer.class);
+			Control c = null;
+			if (clazz.equals(Integer.class)) {
+				final Spinner sp = new Spinner(panel, SWT.BORDER);
+				if (value != null) {
+					sp.setSelection((Integer) value);
+				}
+				sp.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						try {
+							f.set(result, sp.getSelection());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+				c = sp;
+			}
+			else if (clazz.equals(String.class)) {
+				final Text t = new Text(panel, SWT.BORDER);
+				if (value != null) {
+					t.setText(value.toString());
+				}
+				t.addKeyListener(new org.eclipse.swt.events.KeyListener() {
+					
+					@Override
+					public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
+						
+						try {
+							f.set(result, t.getText());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
+						// TODO Auto-generated method stub
+						
+					}
+				});
+				c = t;
+			}
+			else if (clazz.equals(Float.class)) {
+				final Spinner sp = new Spinner(panel, SWT.BORDER);
+				sp.setSelection((int) ((Float) value * 2));
+				sp.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						try {
+							f.set(result, sp.getSelection());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+				c = sp;
+				((Spinner) c).setDigits(2);
+			}
+			else if (clazz.equals(Boolean.class)) {
+				final Button sp = new Button(panel, SWT.CHECK);
+				sp.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						try {
+							f.set(result, sp.getSelection());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+				c = sp;
+			}
+			else if (clazz.equals(IQuery.class)) {
+				final QueryWidget qw = new QueryWidget(panel, SWT.NONE);
+				if (value != null) {
+					qw.setText(((IQuery) value).getQueryString());
+				}
+				qw.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						try {
+							f.set(result, qw.getQuery());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+				qw.addKeyListener(new org.eclipse.swt.events.KeyListener() {
+					
+					@Override
+					public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
+						
+						if (e.keyCode != SWT.KEYPAD_CR && e.keyCode != SWT.CR) {
+							return;
+						}
+						try {
+							f.set(result, qw.getQuery());
+							if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+								activated.compute(false);
+							}
+						}
+						catch (Exception e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+					}
+					
+					@Override
+					public void keyPressed(org.eclipse.swt.events.KeyEvent e) {}
+				});
+				c = qw;
+			}
+			else if (clazz.equals(File.class)) {
+				final Button b = new Button(panel, SWT.PUSH);
+				if (value != null) {
+					b.setText(value.toString());
+					
+				}
+				
+				b.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						File file = (File) value;
+						if (file.isDirectory()) {
+							DirectoryDialog dialog = new DirectoryDialog(panel.getDisplay().getActiveShell());
+							dialog.setText("Choose directory");
+							dialog.setFilterPath(file.getAbsolutePath());
+							String path = dialog.open();
+							if (path != null) {
+								try {
+									f.set(result, path);
+									b.setText(path);
+									if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+										activated.compute(false);
+									}
+								}
+								catch (IllegalArgumentException e1) {
+									// TODO Auto-generated catch block
+									e1.printStackTrace();
+								}
+								catch (IllegalAccessException e1) {
+									// TODO Auto-generated catch block
+									e1.printStackTrace();
+								}
+							}
+						}
+						else {
+							FileDialog dialog = new FileDialog(panel.getDisplay().getActiveShell());
+							dialog.setText("Choose directory");
+							dialog.setFilterPath(file.getAbsolutePath());
+							String path = dialog.open();
+							if (path != null) {
+								try {
+									f.set(result, path);
+									b.setText(path);
+									if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+										activated.compute(false);
+									}
+								}
+								catch (IllegalArgumentException e1) {
+									// TODO Auto-generated catch block
+									e1.printStackTrace();
+								}
+								catch (IllegalAccessException e1) {
+									// TODO Auto-generated catch block
+									e1.printStackTrace();
+								}
+							}
+						}
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+			}
+			else if (clazz.equals(List.class)) {
+				List list = (List) value;
+				if (list.isEmpty()) {
+					Label l3 = new Label(panel, SWT.NONE);
+					l3.setText("no value");
+					c = l3;
+				}
+				else {
+					Object first = list.get(0);
+					if (first instanceof WordProperty) {
+						c = createWordPropertyField(f, result, list);
+					}
+					else if (first instanceof StructuralUnitProperty) {
+						c = createStructuralUnitPropertyField(f, result, list);
+					}
+				}
+				// } else if (value instanceof StructuralUnit) {
+			}
+			else if (clazz.equals(WordProperty.class)) {
+				ArrayList<WordProperty> selected = new ArrayList<>();
+				selected.add((WordProperty) value);
+				c = createWordPropertyField(f, result, selected);
+				// } else if (value instanceof StructuralUnit) {
+				// Label l2 = new Label(panel,
+				// SWT.NONE).setText("="+value.toString());
+			}
+			else if (clazz.equals(StructuralUnitProperty.class)) {
+				ArrayList<StructuralUnitProperty> selected = new ArrayList<>();
+				selected.add((StructuralUnitProperty) value);
+				c = createStructuralUnitPropertyField(f, result, selected);
+				// } else if (value instanceof ReferencePattern) {
+				// c = new Label(panel, SWT.NONE).setText("="+value.toString());
+			}
+			else if (clazz.equals(ReferencePattern.class)) {
+				c = createReferencePatternField(f, result, (ReferencePattern) value);
+				// } else if (value instanceof ReferencePattern) {
+				// c = new Label(panel, SWT.NONE).setText("="+value.toString());
+			}
+			else {
+				Label l2 = new Label(panel, SWT.NONE);
+				if (value != null) {
+					TypeVariable<?>[] pp = value.getClass().getTypeParameters();
+					l2.setText(clazz.getSimpleName() + "=" + value);
+				}
+				else {
+					l2.setText(clazz.getSimpleName() + "=" + value);
+				}
+				c = l2;
+			}
+			
+			if (c != null) {
+				c.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
+			}
+		}
+		scrollC.setContent(panel);
+		scrollC.setMinSize(panel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+		scrollC.setExpandHorizontal(true);
+		scrollC.setExpandVertical(true);
+		scrollC.layout(true);
+	}
+	
+	private Control createReferencePatternField(final Field f, final TXMResult result, ReferencePattern value) throws Exception {
+		
+		final List<Property> selected = new ArrayList<>();
+		selected.addAll(value.getProperties());
+		CQPCorpus corpus = value.getCorpus();
+		ReferencePatternSelector selector = new ReferencePatternSelector(panel, SWT.NONE);
+		if (corpus != null) {
+			List<Property> availables = new ArrayList<>();
+			availables.addAll(corpus.getOrderedProperties());
+			availables.addAll(corpus.getOrderedStructuralUnitProperties());
+			availables.removeAll(selected);
+			selector.setPattern(value.getPattern());
+			selector.setProperties(availables, selected);
+		}
+		selector.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				
+				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+					ReferencePattern p = new ReferencePattern(selected);
+					try {
+						f.set(result, p);
+					}
+					catch (IllegalArgumentException e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+					catch (IllegalAccessException e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+					activated.compute(false);
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		// selector.setLayoutData(layoutData);
+		return selector;
+	}
+	
+	protected PropertiesSelector<WordProperty> createWordPropertyField(final Field f, final TXMResult result, final List<WordProperty> selected) throws CqiClientException {
+		
+		WordProperty value = selected.get(0);
+		CQPCorpus corpus = value.getCorpus();
+		
+		ArrayList<WordProperty> availables = new ArrayList<>(corpus.getOrderedProperties());
+		availables.addAll(corpus.getVirtualProperties());
+		availables.remove(value);
+		
+		PropertiesSelector<WordProperty> selector = new PropertiesSelector<>(panel, SWT.NONE);
+		selector.setProperties(availables, selected);
+		selector.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				
+				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+					try {
+						f.set(result, selected);
+					}
+					catch (Exception e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+					activated.compute(false);
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		// selector.setLayoutData(layoutData);
+		return selector;
+	}
+	
+	private PropertiesSelector<StructuralUnitProperty> createStructuralUnitPropertyField(final Field f, final TXMResult result, final List<StructuralUnitProperty> selected) throws CqiClientException {
+		
+		StructuralUnitProperty value = selected.get(0);
+		CQPCorpus corpus = value.getCorpus();
+		ArrayList<StructuralUnitProperty> availables = new ArrayList<>();
+		availables.addAll(corpus.getOrderedStructuralUnitProperties());
+		availables.remove(value);
+		PropertiesSelector<StructuralUnitProperty> selector = new PropertiesSelector<>(panel, SWT.NONE);
+		selector.setProperties(availables, selected);
+		selector.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				
+				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+					try {
+						f.set(result, selected);
+					}
+					catch (Exception e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+					activated.compute(false);
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		return selector;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		
+		parent.setLayout(new GridLayout(1, true));
+		
+		recompute = new Button(parent, SWT.PUSH);
+		recompute.setImage(IImageKeys.getImage(IImageKeys.START));
+		recompute.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				
+				if (activated != null && !activated.getParametersGroupsComposite().isDisposed()) {
+					activated.compute(false);
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		recompute.setLayoutData(GridDataFactory.fillDefaults().align(GridData.BEGINNING, GridData.BEGINNING).grab(false, false).create());
+		recompute.setEnabled(false);
+		
+		scrollC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+		scrollC.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
+		
+		panel = new Composite(scrollC, SWT.NONE);
+		panel.setLayout(new GridLayout(2, true));
+		
+		try {
+			updateEditorParameters();
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	@Override
+	public void partActivated(IWorkbenchPart part) {
+		
+		if (part == null)
+			return;
+		// System.out.println("partActivated: "+part);
+		if (part instanceof TXMEditor)
+			activated = (TXMEditor) part;
+		if (activated == null)
+			return;
+		activated.addPropertyListener(this);
+		recompute.setEnabled(true);
+		// activated.addPartPropertyListener(this);
+		try {
+			updateEditorParameters();
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	@Override
+	public void partBroughtToTop(IWorkbenchPart part) {
+		
+		if (part == null)
+			return;
+	}
+	
+	@Override
+	public void partClosed(IWorkbenchPart part) {
+		
+		if (part == null)
+			return;
+		if (part == activated) {
+			activated = null;
+			try {
+				updateEditorParameters();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	@Override
+	public void partDeactivated(IWorkbenchPart part) {
+		
+		if (part == null)
+			return;
+		// System.out.println("partDeactivated: "+part);
+		// if (part instanceof TXMEditor)
+		// activated = null;
+		// try {
+		// updateEditorParameters();
+		// } catch (Exception e) {
+		// // TODO Auto-generated catch block
+		// e.printStackTrace();
+		// }
+	}
+	
+	@Override
+	public void propertyChanged(Object source, int propId) {
+		
+		// System.out.println("Editor property changed: "+propId);
+		if (propId == EditorPart.PROP_DIRTY) {
+			try {
+				updateEditorParameters();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	@Override
+	public void partOpened(IWorkbenchPart part) {
+		
+		if (part == null)
+			return;
+	}
+	
+	@Override
+	public void setFocus() {
+		// TODO Auto-generated method stub
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersView.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersComposite.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersComposite.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersComposite.java	(revision 3022)
@@ -0,0 +1,265 @@
+package org.txm.rcp.views.cmdparameters;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.Project;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.preferences.RCPPreferences;
+import org.txm.rcp.swt.GLComposite;
+
+public class TXMResultParametersComposite extends GLComposite {
+	
+	private TreeViewer tv;
+	
+	private TreeViewerColumn nameColumn;
+	
+	private TreeViewerColumn valueColumn;
+	
+	private TextCellEditor cellEditor;
+	
+	public static String DEFAULT_REFS = "class,user_name";
+	
+	private String[] references = DEFAULT_REFS.split(",");
+	
+	public TXMResultParametersComposite(Composite parent, int style) {
+		super(parent, style, "Parameters");
+		
+		tv = new TreeViewer(this, SWT.VIRTUAL);
+		tv.getTree().setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).create());
+		tv.getTree().setHeaderVisible(true);
+		tv.getTree().setLinesVisible(true);
+		tv.setContentProvider(new ITreeContentProvider() {
+			
+			@Override
+			public Object[] getElements(Object inputElement) {
+				if (inputElement instanceof String) {
+					String npath = inputElement.toString();
+					Object[] children = getChildren(TXMPreferences.preferencesRootNode.node(npath));
+					return children;
+				}
+				else if (inputElement instanceof Project) {
+					Project project = (Project) inputElement;
+					IEclipsePreferences prefs = project.getPreferencesScope().getNode("/project/" + project.getName());
+					return getChildren(prefs);
+				}
+				else if (inputElement instanceof TXMResult) {
+					TXMResult result = (TXMResult) inputElement;
+					// return new Object[] {TXMPreferences.preferencesRootNode.node(result.getParametersNodePath())};
+					return getChildren(TXMPreferences.preferencesRootNode.node(result.getParametersNodePath()));
+				}
+				else if (inputElement instanceof IProject) {
+					IProject project = (IProject) inputElement;
+					return getChildren(TXMPreferences.preferencesRootNode.node("/" + project.getName()));
+				}
+				
+				return new Object[0];
+			}
+			
+			@Override
+			public Object[] getChildren(Object parentElement) {
+				if (parentElement instanceof Preferences) {
+					Preferences prefs = (Preferences) parentElement;
+					try {
+						ArrayList<Object> children = new ArrayList<>();
+						String[] nodes = prefs.childrenNames();
+						Arrays.sort(nodes);
+						for (String n : nodes) {
+							children.add(prefs.node(n));
+						}
+						
+						String[] attributes = null;
+						// FIXME: SJ => MD, I commented this atm
+						// if (RCPPreferences.getInstance().getBoolean(RCPPreferences.EXPERT_USER)) {
+						//
+						// } else {
+						attributes = prefs.keys();
+						// }
+						Arrays.sort(attributes);
+						for (String name : attributes) {
+							children.add(new Object[] { prefs, name });
+						}
+						return children.toArray();
+					}
+					catch (BackingStoreException e) {
+						e.printStackTrace();
+					}
+				}
+				return null;
+			}
+			
+			@Override
+			public Object getParent(Object element) {
+				if (element instanceof Preferences) {
+					Preferences prefs = (Preferences) element;
+					return prefs.parent();
+				}
+				return null;
+			}
+			
+			@Override
+			public boolean hasChildren(Object element) {
+				if (element instanceof Preferences) {
+					Preferences prefs = (Preferences) element;
+					try {
+						return prefs.childrenNames().length > 0 || prefs.keys().length > 0;
+					}
+					catch (BackingStoreException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+				return false;
+			}
+			
+		});
+		
+		nameColumn = new TreeViewerColumn(tv, SWT.NONE);
+		nameColumn.getColumn().setText("node");
+		nameColumn.getColumn().pack();
+		nameColumn.setLabelProvider(new CellLabelProvider() {
+			
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+				
+				if (element instanceof Preferences) {
+					Preferences c = (Preferences) element;
+					if (references != null && references.length > 0) {
+						ArrayList<String> values = new ArrayList<>();
+						for (String k : references) {
+							if (c.get(k, null) != null) {
+								values.add(c.get(k, null));
+							}
+						}
+						
+						if (values.size() == 0) values.add(c.name());
+						cell.setText(StringUtils.join(values, ", "));
+					}
+					else {
+						cell.setText(c.name());
+					}
+					
+					if (c.get("class", null) != null && c.get("class", null).startsWith("org.txm")) {
+						cell.setImage(IImageKeys.getImage(IImageKeys.PROJECT));
+					}
+				}
+				else if (element instanceof Object[]) {
+					Object[] c = (Object[]) element;
+					
+					cell.setText(c[1].toString());
+				}
+				else {
+					cell.setText(element.toString());
+				}
+			}
+			
+		});
+		valueColumn = new TreeViewerColumn(tv, SWT.NONE);
+		valueColumn.getColumn().setText("value");
+		valueColumn.getColumn().pack();
+		valueColumn.setLabelProvider(new CellLabelProvider() {
+			
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+				
+				if (element instanceof Preferences) {
+					Preferences c = (Preferences) element;
+					cell.setText("");
+				}
+				else if (element instanceof Object[]) {
+					Object[] c = (Object[]) element;
+					Preferences p = (Preferences) c[0];
+					cell.setText(p.get(c[1].toString(), ""));
+				}
+				else {
+					cell.setText(element.toString());
+				}
+			}
+		});
+		
+		cellEditor = new TextCellEditor(tv.getTree());
+		valueColumn.setEditingSupport(new EditingSupport(tv) {
+			
+			@Override
+			protected void setValue(Object element, Object value) {
+				if (element instanceof Object[]) {
+					Object[] data = (Object[]) element;
+					Preferences prefs = (Preferences) data[0];
+					String key = data[1].toString();
+					prefs.put(key, value.toString());
+					tv.refresh(element);
+					
+				}
+				return;
+			}
+			
+			@Override
+			protected Object getValue(Object element) {
+				if (element instanceof Object[]) {
+					Object[] data = (Object[]) element;
+					Preferences prefs = (Preferences) data[0];
+					String key = data[1].toString();
+					return prefs.get(key, "");
+				}
+				return null;
+			}
+			
+			@Override
+			protected TextCellEditor getCellEditor(Object element) {
+				return cellEditor;
+			}
+			
+			@Override
+			protected boolean canEdit(Object element) {
+				return element instanceof Object[];
+			}
+		});
+	}
+	
+	
+	
+	public void updateEditorParameters(Object input) {
+		tv.setInput(input);
+		nameColumn.getColumn().pack();
+		valueColumn.getColumn().pack();
+	}
+	
+	
+	
+	public void refresh() {
+		tv.refresh();
+	}
+	
+	public void setReferences(String[] split) {
+		references = split;
+	}
+	
+	public TreeViewer getTreeViewer() {
+		return tv;
+	}
+	
+	public Object getInput() {
+		return tv.getInput();
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultParametersComposite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/SummaryView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/SummaryView.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/SummaryView.java	(revision 3022)
@@ -62,6 +62,7 @@
 import org.txm.rcp.editors.TXMBrowser;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.widget.PropertiesSelector;
+import org.txm.rcp.views.corpora.CorporaView;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
 import org.txm.searchengine.cqp.core.functions.summary.Summary;
@@ -69,153 +70,164 @@
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
-// TODO: Auto-generated Javadoc
+
 /**
- * Display the internal hierarchie of a MainCorpus
- * @author mdecorde.
+ * Display the internal structures hierarchy of a MainCorpus
+ * 
+ * @author mdecorde
  */
 public class SummaryView extends ViewPart {
-
+	
 	MainCorpus selectedCorpus;
-	List<Property> selectedProps;
+	
+	List<StructuralUnitProperty> selectedProps;
+	
 	Summary summary;
-
+	
 	/** The tv. */
 	TreeViewer tv;
+	
 	Combo corpusCombo;
-	PropertiesSelector propsArea;
-
+	
+	PropertiesSelector<StructuralUnitProperty> propsArea;
+	
 	/** The attached browser editor. */
 	protected TXMBrowser attachedBrowserEditor;
-
+	
 	/** The ID. */
 	public static String ID = SummaryView.class.getName();
-
+	
 	/**
 	 * Instantiates a new summary view.
 	 */
-	public SummaryView() {
-	}
-
+	public SummaryView() {}
+	
 	/**
 	 * Refresh.
 	 */
 	public static void refresh() {
 		SummaryView baseView = (SummaryView) PlatformUI.getWorkbench()
-				.getActiveWorkbenchWindow().getActivePage().findView(
-						SummaryView.ID);
-		if (baseView != null)
+				.getActiveWorkbenchWindow().getActivePage().findView(SummaryView.ID);
+		if (baseView != null) {
 			baseView.tv.refresh();
+		}
 	}
-
+	
 	/**
 	 * Reload.
 	 */
 	public static void reload() {
 		SummaryView baseView = (SummaryView) PlatformUI.getWorkbench()
-				.getActiveWorkbenchWindow().getActivePage().findView(
-						SummaryView.ID);
-		if (baseView != null)
+				.getActiveWorkbenchWindow().getActivePage().findView(SummaryView.ID);
+		if (baseView != null) {
 			baseView._reload();
+		}
 	}
-
+	
 	/**
 	 * _reload.
 	 */
 	public void _reload() {
-
+		
 		initParameters();
-
+		
 		compute();
-
-
 	}
-
-	public void compute()
-	{
+	
+	public void compute() {
+		
 		try {
+			selectedProps = propsArea.getSelectedProperties();
+			
 			if (selectedCorpus == null || selectedProps == null || selectedProps.size() == 0) {
-				//System.out.println("Error: corpus="+selectedCorpus+", props="+selectedProps);
 				return;
 			}
-			summary = new Summary(selectedCorpus);
-			ArrayList<StructuralUnitProperty> properties = new ArrayList<StructuralUnitProperty>();
+			if (summary == null || !summary.getCorpus().equals(selectedCorpus)) {
+				summary = new Summary(selectedCorpus);
+				CorporaView.refreshObject(selectedCorpus);
+			}
+			
+			ArrayList<StructuralUnitProperty> properties = new ArrayList<>();
 			for (Property p : selectedProps) {
 				if (p instanceof StructuralUnitProperty) {
 					properties.add((StructuralUnitProperty) p);
 				}
 			}
-
+			
 			summary.setProperties(properties);
 			if (summary.compute()) {
 				tv.setContentProvider(new TreeNodeTreeProvider());
 				tv.setLabelProvider(new TreeNodeLabelProvider());
-
+				
 				tv.setInput(summary);
 				refresh();
-				tv.expandToLevel(selectedProps.size()+1);
+				tv.expandToLevel(selectedProps.size() + 1);
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			System.out.println(TXMUIMessages.errorWhileComputingCorpusSummary);
 			org.txm.utils.logger.Log.printStackTrace(e);
-		} 
+		}
 	}
-
-	public void initParameters()
-	{
-		if (!Toolbox.isInitialized())
+	
+	public void initParameters() {
+		
+		if (!Toolbox.isInitialized()) {
 			return;
-		//init combo
+		}
+		// init combo
 		try {
 			corpusCombo.removeAll();
 			for (MainCorpus p : CorpusManager.getCorpusManager().getCorpora().values()) {
 				corpusCombo.add(p.getName());
 			}
-		} catch (Exception e2) {
+		}
+		catch (Exception e2) {
 			// TODO Auto-generated catch block
 			org.txm.utils.logger.Log.printStackTrace(e2);
 		}
-
-		//init default corpus
-		//		try {
-		//			if (CorpusManager.getCorpusManager().getCorpora().size() > 0) {
-		//				selectedCorpus = CorpusManager.getCorpusManager().getCorpora().get(0);
-		//				corpusCombo.select(0);
-		//			}
-		//		} catch (Exception e) {	org.txm.utils.logger.Log.printStackTrace(e);}
-
+		
+		// init default corpus
+		// try {
+		// if (CorpusManager.getCorpusManager().getCorpora().size() > 0) {
+		// selectedCorpus = CorpusManager.getCorpusManager().getCorpora().get(0);
+		// corpusCombo.select(0);
+		// }
+		// } catch (Exception e) { org.txm.utils.logger.Log.printStackTrace(e);}
+		
 		if (selectedCorpus != null) reloadProperties();
 	}
-
-	public void reloadProperties()
-	{
+	
+	public void reloadProperties() {
 		if (selectedCorpus == null) return;
-		ArrayList<Property> availables = new ArrayList<Property>();
+		
+		ArrayList<StructuralUnitProperty> availables = new ArrayList<>();
 		try {
-			availables = new ArrayList<Property>(selectedCorpus.getOrderedStructuralUnitProperties());
-		} catch (CqiClientException e1) {
+			availables = new ArrayList<>(selectedCorpus.getOrderedStructuralUnitProperties());
+		}
+		catch (CqiClientException e1) {
 			// TODO Auto-generated catch block
 			org.txm.utils.logger.Log.printStackTrace(e1);
 			return;
 		}
-
-		//init prop selector
-		ArrayList<Property> selectorSelectedProps = new ArrayList<Property>();
-		//		if (summary != null) {
-		//			for(StructuralUnitProperty prop : summary.getProperties())
-		//			{
-		//				selectorSelectedProps.add(prop);
-		//				availables.remove(prop);
-		//			}
-		//		} else {
-		//System.out.println("AVAILABLES SIZE > 0");
-		if (availables.size()  > 0) {
+		
+		// init prop selector
+		ArrayList<StructuralUnitProperty> selectorSelectedProps = new ArrayList<>();
+		// if (summary != null) {
+		// for(StructuralUnitProperty prop : summary.getProperties())
+		// {
+		// selectorSelectedProps.add(prop);
+		// availables.remove(prop);
+		// }
+		// } else {
+		// System.out.println("AVAILABLES SIZE > 0");
+		if (availables.size() > 0) {
 			boolean foundp = false;
 			boolean founds = false;
-			for (int i = 0 ; i < availables.size() ; i++) {
-
-				StructuralUnitProperty prop = (StructuralUnitProperty) availables.get(i);
-				//System.out.println("check prop : "+prop.getFullName());
+			for (int i = 0; i < availables.size(); i++) {
+				
+				StructuralUnitProperty prop = availables.get(i);
+				// System.out.println("check prop : "+prop.getFullName());
 				String name = prop.getFullName();
 				if ("text_id".equals(name)) { //$NON-NLS-1$
 					selectorSelectedProps.add(availables.get(i));
@@ -223,15 +235,16 @@
 					i--;
 					continue;
 				}
-				if (!foundp)
+				if (!foundp) {
 					if ("p_n".equals(name) || "p_id".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$
 						selectorSelectedProps.add(availables.get(i));
 						availables.remove(i);
 						i--;
-						foundp=true;
+						foundp = true;
 						continue;
 					}
-				if (!founds)
+				}
+				if (!founds) {
 					if ("s_n".equals(name) || "s_id".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$
 						selectorSelectedProps.add(availables.get(i));
 						availables.remove(i);
@@ -239,9 +252,11 @@
 						founds = true;
 						continue;
 					}
+				}
 			}
-
+			
 			Collections.sort(selectorSelectedProps, new Comparator<Property>() {
+				
 				@Override
 				public int compare(Property o1, Property o2) {
 					StructuralUnitProperty s1 = (StructuralUnitProperty) o1;
@@ -256,31 +271,33 @@
 				}
 			});
 		}
-		//}
+		// }
 		propsArea.clear();
-		//System.out.println("Set properties "+availables+", "+selectorSelectedProps);
+		// System.out.println("Set properties "+availables+", "+selectorSelectedProps);
 		this.propsArea.setProperties(availables, selectorSelectedProps);
-		//init default props
+		// init default props
 		selectedProps = propsArea.getSelectedProperties();
-
-		if (tv.getContentProvider() != null)
+		
+		if (tv.getContentProvider() != null) {
 			tv.setInput(null);
+		}
 	}
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 	 */
 	@Override
 	public void createPartControl(Composite parent) {
-
+		
 		parent.setLayout(new GridLayout(2, false));
-
+		
 		// [[Choose corpus]]
 		corpusCombo = new Combo(parent, SWT.READ_ONLY);
-		corpusCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-				true, false, 2, 1));
-
+		corpusCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
+		
 		corpusCombo.addSelectionListener(new SelectionListener() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				String corpusName = corpusCombo.getText();
@@ -288,157 +305,153 @@
 					selectedCorpus = CorpusManager.getCorpusManager().getCorpus(corpusName);
 					reloadProperties();
 					compute();
-				} catch (CqiClientException e1) {
+				}
+				catch (Exception e1) {
 					// TODO Auto-generated catch block
 					org.txm.utils.logger.Log.printStackTrace(e1);
-				} catch (InvalidCqpIdException e1) {
-					// TODO Auto-generated catch block
-					org.txm.utils.logger.Log.printStackTrace(e1);
 				}
 			}
-
+			
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
-
+		
 		// [Choose properties]
 		propsArea = new PropertiesSelector(parent, SWT.NONE);
 		propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
 		propsArea.setLayout(new GridLayout(3, false));
-
-		//Button reload
+		
+		// Button reload
 		Button openeditdialog = new Button(parent, SWT.PUSH);
 		openeditdialog.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 		openeditdialog.setText(TXMUIMessages.reload);
 		openeditdialog.addSelectionListener(new SelectionListener() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				compute();
 			}
-
+			
 			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {	}
+			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
-
+		
 		// show corpus tree
 		tv = new TreeViewer(parent);
-		tv.getTree().setLayoutData(
-				new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
-
+		tv.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
+		
 		tv.addDoubleClickListener(new IDoubleClickListener() {
+			
 			private ProgressListener progresslistener;
-
+			
 			@Override
 			public void doubleClick(DoubleClickEvent event) {
-				//System.out.println("open Edition or Text editor");
+				// System.out.println("open Edition or Text editor");
 				IStructuredSelection sel = (IStructuredSelection) tv.getSelection();
 				Object first = sel.getFirstElement();
 				final Summary.TreeNode node = (Summary.TreeNode) first;
-
+				
 				try {
 					final Page openedPage = summary.getDefaultEditionPage(node);
 					if (openedPage != null) {
 						// System.out.println(page.getFile());
-						if (attachedBrowserEditor == null
-								|| attachedBrowserEditor.isDisposed()) {
+						if (attachedBrowserEditor == null || attachedBrowserEditor.isDisposed()) {
 							attachedBrowserEditor = OpenBrowser
 									.openEdition(openedPage.getFile()
 											.getAbsolutePath(), openedPage.getFile().getName());
 							attachedBrowserEditor.setEdition(openedPage.getEdition());
 						}
 						attachedBrowserEditor.showPage(openedPage);
-					} else {
-						System.out.println(TXMUIMessages.noDefaultEditionPageFoundForElementColon+node);
 					}
-
+					else {
+						System.out.println(TXMUIMessages.noDefaultEditionPageFoundForElementColon + node);
+					}
+					
 					if (progresslistener != null) {
 						attachedBrowserEditor.getBrowser().removeProgressListener(progresslistener);
 					}
 					progresslistener = new ProgressListener() {
+						
 						@Override
-						public void changed(ProgressEvent event) {
-						}
-
+						public void changed(ProgressEvent event) {}
+						
 						@Override
 						public void completed(ProgressEvent event) {
-							Page currentpage = attachedBrowserEditor
-									.getCurrentPage();
+							Page currentpage = attachedBrowserEditor.getCurrentPage();
 							// System.out.println("Highlight ! "+currentpage.getEdition().getText()+" name ="+openedPage.getEdition().getText());
-							if (currentpage != null)
-								if (!(currentpage.getEdition().getText() == openedPage
-								.getEdition().getText()))
+							if (currentpage != null) {
+								if (!(currentpage.getEdition().getText() == openedPage.getEdition().getText())) {
 									return;
+								}
+							}
 							String wordid = node.getWordId();
 							String highlightscript = "try { var elt = document.getElementById(\"" + wordid + "\");" + //$NON-NLS-1$ //$NON-NLS-2$
 									"elt.style.backgroundColor=\"#F9D0D0\";" //$NON-NLS-1$
-									+ 
+									+
 									"elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
 									"elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
 									"elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
 									"elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
 									"} catch (e) { };"; //$NON-NLS-1$
-
-							attachedBrowserEditor.getBrowser().execute(
-									highlightscript);
-
-
+							
+							attachedBrowserEditor.getBrowser().execute(highlightscript);
+							
 							String script = "try { document.getElementById(\"" + wordid + "\").scrollIntoView(true); } catch (e) { };"; //$NON-NLS-1$ //$NON-NLS-2$
-							attachedBrowserEditor.getBrowser().execute(
-									script);
+							attachedBrowserEditor.getBrowser().execute(script);
 						}
 					};
-					attachedBrowserEditor.getBrowser().addProgressListener(
-							progresslistener);
-
+					
+					attachedBrowserEditor.getBrowser().addProgressListener(progresslistener);
+					
 					IWorkbenchPage attachedPage = attachedBrowserEditor.getEditorSite().getPage();
 					attachedPage.activate(attachedBrowserEditor);
-
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
+					
+				}
+				catch (Exception e) {
 					org.txm.utils.logger.Log.printStackTrace(e);
 				}
 			}
 		});
-
+		
 		initParameters();
-
+		
 		MenuManager menuManager = new MenuManager();
 		Menu menu = menuManager.createContextMenu(tv.getTree());
-
+		
 		// Set the MenuManager
 		tv.getTree().setMenu(menu);
 		getSite().registerContextMenu(menuManager, tv);
 		// Make the selection available
 		getSite().setSelectionProvider(tv);
-
-
+		
+		
 	}
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
 	 */
 	@Override
 	public void setFocus() {
 		// TODO Auto-generated method stub
-
+		
 	}
-
-	public MainCorpus getSelectedCorpus()
-	{
+	
+	public MainCorpus getSelectedCorpus() {
 		return selectedCorpus;
 	}
-
-	public List<Property> getProperties()
-	{
+	
+	public List<StructuralUnitProperty> getProperties() {
 		return selectedProps;
 	}
-
+	
 	/**
 	 * The Class TxmObjectLabelProvider.
 	 */
 	public class TreeNodeLabelProvider extends LabelProvider {
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
 		 */
 		@Override
@@ -450,8 +463,9 @@
 			}
 			return NLS.bind(TXMUIMessages.errorColonGetTextColonP0, element);
 		}
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
 		 */
 		@Override
@@ -459,13 +473,14 @@
 			return null;
 		}
 	}
-
+	
 	/**
 	 * The Class TxmObjectTreeProvider.
 	 */
 	public class TreeNodeTreeProvider implements ITreeContentProvider {
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
 		 */
 		@Override
@@ -476,8 +491,9 @@
 			}
 			return new Object[0];
 		}
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
 		 */
 		@Override
@@ -487,8 +503,9 @@
 			}
 			return new Object[0];
 		}
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
 		 */
 		@Override
@@ -499,33 +516,33 @@
 			}
 			return false;
 		}
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
 		 */
 		@Override
 		public Object[] getElements(Object element) {
-			if(summary != null)
-			{
-				Object[] objects = {summary.getRoot()};
+			if (summary != null) {
+				Object[] objects = { summary.getRoot() };
 				return objects;
 			}
-
+			
 			return new Object[0];
 		}
-
-		/* (non-Javadoc)
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
 		 */
 		@Override
-		public void dispose() {
-		}
-
-		/* (non-Javadoc)
+		public void dispose() {}
+		
+		/*
+		 * (non-Javadoc)
 		 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
 		 */
 		@Override
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-		}
+		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 3022)
@@ -62,6 +62,7 @@
 import org.txm.rcp.handlers.files.CopyFile;
 import org.txm.rcp.handlers.files.CutFile;
 import org.txm.rcp.handlers.files.DeleteFile;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.handlers.files.PasteFile;
 import org.txm.rcp.handlers.files.RenameFile;
 import org.txm.rcp.handlers.scripts.CreateMacro;
@@ -69,29 +70,30 @@
 import org.txm.rcp.messages.TXMUIMessages;
 
 /**
- * Macro explorer 
+ * Macro explorer
  * 
  * @author mdecorde
  */
 public class MacroExplorer extends ViewPart {
-
+	
 	/** The ID. */
 	static public String ID = MacroExplorer.class.getName();
-
+	
 	/** The home. */
 	protected static String home = Toolbox.getTxmHomePath();
-	//protected static String homeUser = Toolbox.getTxmHomePath();
-
+	// protected static String homeUser = Toolbox.getTxmHomePath();
+	
 	protected static File currentRootDir;
-
-	//protected static File currentUserRootDir; 
 	
+	// protected static File currentUserRootDir;
+	
 	protected static boolean showAll = false;
 	
 	/** The files tree viewer. */
 	protected TreeViewer tv;
 	
 	protected Button all;
+	
 	/**
 	 * Instantiates a new explorer.
 	 */
@@ -99,23 +101,27 @@
 		initCurrentDirectory();
 	}
 	
-	public boolean isShowAll() {return showAll;}
-
+	public boolean isShowAll() {
+		return showAll;
+	}
+	
 	private static void initCurrentDirectory() {
-		home = Toolbox.getTxmHomePath(); 
+		home = Toolbox.getTxmHomePath();
 		if (home == null) home = System.getProperty("user.home"); //$NON-NLS-1$
 		
-		//File scriptsUserDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
+		// File scriptsUserDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
 		File scriptsDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
 		currentRootDir = new File(scriptsDir, "org/txm/macro"); //$NON-NLS-1$
-		//currentUserRootDir = new File(scriptsUserDir, "org/txm/macro"); //$NON-NLS-1$
+		// currentUserRootDir = new File(scriptsUserDir, "org/txm/macro"); //$NON-NLS-1$
 		home = currentRootDir.getAbsolutePath();
-		//homeUser = currentUserRootDir.getAbsolutePath();
+		// homeUser = currentUserRootDir.getAbsolutePath();
 	}
-
-	public String getHome() { return home;}
-	//public String getUserHome() { return homeUser;}
 	
+	public String getHome() {
+		return home;
+	}
+	// public String getUserHome() { return homeUser;}
+	
 	/**
 	 * Refresh.
 	 */
@@ -124,7 +130,7 @@
 				.getActiveWorkbenchWindow().getActivePage().findView(
 						MacroExplorer.ID);
 		
-		//TODO this might cause big latences
+		// TODO this might cause big latences
 		initCurrentDirectory();
 		
 		if (explorerView != null) {
@@ -147,33 +153,34 @@
 			explorerView.tv.refresh(f);
 		}
 	}
-
+	
 	public TreeViewer getTreeViewer() {
 		return tv;
 	}
 	
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 	 */
 	@Override
 	public void createPartControl(Composite parent) {
-
+		
 		FormLayout formLayout = new FormLayout();
 		formLayout.marginWidth = 0;
 		formLayout.marginHeight = 0;
 		parent.setLayout(formLayout);
-
+		
 		// controles composite
 		Composite controls = new Composite(parent, SWT.NONE);
-
+		
 		FormData controlsData = new FormData();
 		controlsData.top = new FormAttachment(0);
 		controlsData.left = new FormAttachment(0);
 		controlsData.right = new FormAttachment(100);
 		controls.setLayoutData(controlsData);
-
+		
 		GridLayout controlsLayout = new GridLayout(3, false);
-		controlsLayout.marginBottom = controlsLayout.marginHeight=0;
+		controlsLayout.marginBottom = controlsLayout.marginHeight = 0;
 		controls.setLayout(controlsLayout);
 		
 		Button refresh = new Button(controls, SWT.NONE);
@@ -181,6 +188,7 @@
 		refresh.setToolTipText(TXMUIMessages.common_refresh);
 		refresh.setLayoutData(new GridData());
 		refresh.addSelectionListener(new SelectionAdapter() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				initCurrentDirectory();
@@ -194,6 +202,7 @@
 		newMacro.setText(TXMUIMessages.newMacro);
 		newMacro.setToolTipText(TXMUIMessages.createANewMacroFromATemplate);
 		newMacro.addSelectionListener(new SelectionAdapter() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				
@@ -209,12 +218,13 @@
 				}
 			}
 		});
-
+		
 		all = new Button(controls, SWT.CHECK);
 		all.setText("all");
 		all.setToolTipText("Show all files");
 		all.setLayoutData(new GridData());
 		all.addSelectionListener(new SelectionAdapter() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				showAll = all.getSelection();
@@ -223,30 +233,31 @@
 		});
 		
 		// set positions & sizes
-		//FormData widgetData = new FormData();
-		//widgetData.right = new FormAttachment(100);
-		//refresh.setLayoutData(widgetData);
-
+		// FormData widgetData = new FormData();
+		// widgetData.right = new FormAttachment(100);
+		// refresh.setLayoutData(widgetData);
+		
 		// the explorer
 		tv = new TreeViewer(parent);
 		tv.setContentProvider(new MacroContentProvider(this));
 		tv.setLabelProvider(new MacroTreeLabelProvider(this));
 		
-//		TreeViewerColumn mainColumn = new TreeViewerColumn(tv, SWT.NONE);
-//        mainColumn.getColumn().setText("File");
-//        mainColumn.getColumn().setWidth(300);
-//        mainColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new MacroTreeLabelProvider(this)));
+		// TreeViewerColumn mainColumn = new TreeViewerColumn(tv, SWT.NONE);
+		// mainColumn.getColumn().setText("File");
+		// mainColumn.getColumn().setWidth(300);
+		// mainColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new MacroTreeLabelProvider(this)));
 		
 		tv.setInput(new File(home));
-
+		
 		FormData tvData = new FormData();
 		tvData.top = new FormAttachment(controls, 0);
 		tvData.bottom = new FormAttachment(100);
 		tvData.left = new FormAttachment(0);
 		tvData.right = new FormAttachment(100);
 		tv.getTree().setLayoutData(tvData);
-
+		
 		tv.addDoubleClickListener(new IDoubleClickListener() {
+			
 			@Override
 			public void doubleClick(DoubleClickEvent event) {
 				TreeSelection selection = (TreeSelection) tv.getSelection();
@@ -255,41 +266,54 @@
 					IWorkbenchWindow acWindow = TXMWindows.getActiveWindow();
 					IWorkbenchPart page = acWindow.getActivePage().getActivePart();
 					
-					ExecuteGroovyMacro.execute(selectedItem.getAbsolutePath(), page, selection, "");
-				} else {
+					if (selectedItem.getName().toLowerCase().endsWith(".groovy")) {
+						ExecuteGroovyMacro.execute(selectedItem.getAbsolutePath(), page, selection, "");
+					}
+					else {
+						EditFile.openfile(selectedItem.getAbsolutePath());
+					}
+				}
+				else {
 					changeState(selection);
 				}
 			}
 		});
-
+		
 		tv.getTree().addKeyListener(new KeyListener() {
+			
 			@Override
-			public void keyReleased(KeyEvent e) { } // nothing to do
-
+			public void keyReleased(KeyEvent e) {} // nothing to do
+			
 			@Override
 			public void keyPressed(KeyEvent e) {
 				ISelection sel = tv.getSelection();
 				if (sel instanceof IStructuredSelection) {
-					List<?> objects = ((IStructuredSelection)sel).toList();
+					List<?> objects = ((IStructuredSelection) sel).toList();
 					if (e.keyCode == SWT.DEL) {
 						DeleteFile.delete(objects);
-					} else if (e.keyCode == SWT.F5) {
+					}
+					else if (e.keyCode == SWT.F5) {
 						MacroExplorer.refresh();
-					} else {
+					}
+					else {
 						for (Object o : objects) {
-							//Object o = ((IStructuredSelection)sel).getFirstElement();
+							// Object o = ((IStructuredSelection)sel).getFirstElement();
 							if (o instanceof File) {
 								File file = (File) o;
 								if (e.keyCode == SWT.DEL) {
 									DeleteFile.delete(file);
-								} else if ((char)e.keyCode == 'c' & ((e.stateMask & SWT.CTRL) != 0)) {
+								}
+								else if ((char) e.keyCode == 'c' & ((e.stateMask & SWT.CTRL) != 0)) {
 									CopyFile.copy(file);
-								} else if ((char)e.keyCode == 'x' & ((e.stateMask & SWT.CTRL) != 0)) {
+								}
+								else if ((char) e.keyCode == 'x' & ((e.stateMask & SWT.CTRL) != 0)) {
 									CutFile.cut(file);
-								} else if ((char)e.keyCode == 'v' & ((e.stateMask & SWT.CTRL) != 0)) {
+								}
+								else if ((char) e.keyCode == 'v' & ((e.stateMask & SWT.CTRL) != 0)) {
 									if (file.isFile()) file = file.getParentFile();
 									PasteFile.paste(file);
-								} else if (e.keyCode == SWT.F2) {
+								}
+								else if (e.keyCode == SWT.F2) {
 									RenameFile.rename(file);
 								}
 							}
@@ -300,16 +324,16 @@
 				}
 			}
 		});
-
+		
 		MenuManager menuManager = new MenuManager();
 		Menu menu = menuManager.createContextMenu(tv.getTree());
-
+		
 		// Set the MenuManager
 		tv.getTree().setMenu(menu);
 		getSite().registerContextMenu(menuManager, tv);
 		getSite().setSelectionProvider(tv);
 	}
-
+	
 	/**
 	 * Can delete.
 	 *
@@ -320,25 +344,24 @@
 		File txmhome = new File(Toolbox.getTxmHomePath());
 		File scripts = new File(Toolbox.getTxmHomePath(), "scripts"); //$NON-NLS-1$
 		File corpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$
-		//File registry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$
+		// File registry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$
 		File workspaces = new File(Toolbox.getTxmHomePath(), "workspaces"); //$NON-NLS-1$
 		File xsl = new File(Toolbox.getTxmHomePath(), "xsl"); //$NON-NLS-1$
 		File samples = new File(Toolbox.getTxmHomePath(), "samples"); //$NON-NLS-1$
-		if (selectedItem.equals(txmhome) || 
+		if (selectedItem.equals(txmhome) ||
 				selectedItem.equals(txmhome) ||
 				selectedItem.equals(scripts) ||
 				selectedItem.equals(corpora) ||
-				//selectedItem.equals(registry) ||
+				// selectedItem.equals(registry) ||
 				selectedItem.equals(workspaces) ||
 				selectedItem.equals(samples) ||
-				selectedItem.equals(xsl))
-		{
+				selectedItem.equals(xsl)) {
 			System.out.println(NLS.bind(TXMUIMessages.folderP0ShouldNotBeDeleted, selectedItem));
 			return false;
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Change state.
 	 *
@@ -348,14 +371,15 @@
 		TreeItem[] items = tv.getTree().getSelection();
 		for (TreeItem item : items) {
 			if (item.getExpanded()) {
-				item.setExpanded(false);	
-			} else {
+				item.setExpanded(false);
+			}
+			else {
 				item.setExpanded(true);
 			}
 			tv.refresh();
-		}	
+		}
 	}
-
+	
 	/**
 	 * Sets the root.
 	 *
@@ -366,7 +390,7 @@
 		tv.setInput(new File(home));
 		tv.refresh();
 	}
-
+	
 	/**
 	 * Sets the root.
 	 *
@@ -377,12 +401,13 @@
 		tv.setInput(new File(home));
 		tv.refresh();
 	}
-
-	/* (non-Javadoc)
+	
+	/*
+	 * (non-Javadoc)
 	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
 	 */
 	@Override
 	public void setFocus() {
 		tv.getTree().setFocus();
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java	(revision 3022)
@@ -74,7 +74,7 @@
 			return null;
 		}
 		
-		System.out.println(NLS.bind(TXMUIMessages.loadingTheP0BinaryCorpusAsATXM079Corpus, zipFile.getName()));
+		System.out.println(NLS.bind(TXMUIMessages.theP0BinaryCorpusVersionIsP1, zipFile.getName(), "0.7.9"));
 		
 		String basedirname = Zip.getRoot(zipFile);
 		
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java	(revision 3022)
@@ -70,25 +70,28 @@
  * @author mdecorde
  */
 public class LoadBinaryCorpus extends AbstractHandler {
-
+	
 	private static final String ID = LoadBinaryCorpus.class.getName();
-
+	
 	File corpusdir;
+	
 	private File zipFile;
+	
 	private File backup;
+	
 	String basedirname;
-
+	
 	@Override
 	/**
 	 * calling this command will : open a directory dialog and try to load the content of the selected directory
 	 */
 	public Object execute(ExecutionEvent event) throws ExecutionException {
-
+		
 		// create dialog to get the corpus directory
 		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-
+		
 		String url = event.getParameter("url"); //$NON-NLS-1$
-
+		
 		if (url != null && url.length() > 0 && url.endsWith(".txm")) { //$NON-NLS-1$
 			zipFile = new File(url);
 			if (!zipFile.exists() && url.startsWith("http")) { //$NON-NLS-1$
@@ -97,43 +100,46 @@
 					File f = new File(url);
 					File corpora = Toolbox.workspace.getLocation();
 					zipFile = new File(corpora, f.getName());
-					System.out.println("BEF ? "+zipFile.exists());
+					System.out.println("BEF ? " + zipFile.exists());
 					zipFile.delete();
-					System.out.println("DEL ? "+zipFile.exists());
+					System.out.println("DEL ? " + zipFile.exists());
 					FileUtils.copyURLToFile(u, zipFile);
 					System.out.println(zipFile.getAbsolutePath());
-					System.out.println("OK ? "+zipFile.exists());
-				} catch (Exception e) {
+					System.out.println("OK ? " + zipFile.exists());
+				}
+				catch (Exception e) {
 					// TODO Auto-generated catch block
 					e.printStackTrace();
 					return null;
 				}
 			}
-		} else {
+		}
+		else {
 			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-			dialog.setFilterExtensions(new String[]{"*.txm"}); //$NON-NLS-1$
+			dialog.setFilterExtensions(new String[] { "*.txm" }); //$NON-NLS-1$
 			if (LastOpened.getFile(ID) != null) {
 				dialog.setFilterPath(LastOpened.getFolder(ID));
 				dialog.setFileName(LastOpened.getFile(ID));
 			}
-
+			
 			if (dialog.open() != null) {
 				final String path = dialog.getFilterPath();
 				final String filename = dialog.getFileName();
-
+				
 				zipFile = new File(path, filename);
 				LastOpened.set(ID, zipFile);
-			} else {
+			}
+			else {
 				return null;
 			}
 		}
-
+		
 		JobHandler job = loadBinaryCorpusArchive(zipFile);
 		return job;
 	}
-
+	
 	/**
-	 * Load a binary corpus archive: 
+	 * Load a binary corpus archive:
 	 * 
 	 * 1- test if the corpus directory is already used
 	 * 2- delete previous corpus version
@@ -142,145 +148,161 @@
 	 * 5- restart TXM engines
 	 */
 	public static JobHandler loadBinaryCorpusArchive(final File zipFile) throws ExecutionException {
-
+		
+		Log.info(TXMUIMessages.loadingBinaryCorpus);
+		
 		String filename = zipFile.getName();
 		final File corporaDir = Toolbox.workspace.getLocation();
 		corporaDir.mkdir();
-
+		
 		if (!filename.endsWith(".txm") && !filename.endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$
-			System.out.println(TXMUIMessages.aBinaryCorpusIsATXMFileExtensionTxmOrZip);
-			System.out.println(NLS.bind(TXMUIMessages.thisFileIsNotATXMFileColonP0, zipFile));
+			Log.warning(TXMUIMessages.aBinaryCorpusIsATXMFileExtensionTxmOrZip);
+			Log.warning(NLS.bind(TXMUIMessages.thisFileIsNotATXMFileColonP0, zipFile));
 			return null;
 		}
-
+		
 		if (!zipFile.canRead()) {
-			System.out.println(NLS.bind(TXMUIMessages.cannotReadTheFileP0, zipFile));
+			Log.warning(NLS.bind(TXMUIMessages.cannotReadTheFileP0, zipFile));
 			return null;
 		}
-
-		//build binary dir path			
+		
+		// build binary dir path
 		String basedirname = Zip.getRoot(zipFile).toUpperCase();
-
+		
 		File corpusdir = new File(corporaDir, basedirname);
 		Project p = Toolbox.workspace.getProject(basedirname);
-
+		
 		if (corpusdir.exists() || p != null) {
 			if (Display.getCurrent() == null) { // not a UI thread -> delete the previous corpus
 				p.delete(); // the user said yes, so delete the previous project
-			} else {
-
-				boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.warning, NLS.bind(TXMUIMessages.theP0CorpusDirectoryAlreadyExistsDoYouWantToReplaceIt, corpusdir.getName().toUpperCase()));
+			}
+			else {
+				
+				boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.warning, NLS.bind(TXMUIMessages.theP0CorpusDirectoryAlreadyExistsDoYouWantToReplaceIt,
+						corpusdir.getName().toUpperCase()));
 				if (b) {
-					//TODO: to enable backup of binary corpus I need to be able to reload correctly a corpus in CQP corpus manager
-					//				backup = new File(corpusdir.getParentFile(), corpusdir.getName()+"-back"); //$NON-NLS-1$
-					//				DeleteDir.deleteDirectory(backup);
-					//				if (backup.exists()) {
-					//					System.out.println(Messages.LoadBinaryCorpus_1+backup);
-					//					return false;
-					//				}
-					//				if (!corpusdir.renameTo(backup)) {
-					//					System.out.println(Messages.LoadBinaryCorpus_2+backup);
-					//					return false;
-					//				}
-
+					// TODO: to enable backup of binary corpus I need to be able to reload correctly a corpus in CQP corpus manager
+					// backup = new File(corpusdir.getParentFile(), corpusdir.getName()+"-back"); //$NON-NLS-1$
+					// DeleteDir.deleteDirectory(backup);
+					// if (backup.exists()) {
+					// System.out.println(Messages.LoadBinaryCorpus_1+backup);
+					// return false;
+					// }
+					// if (!corpusdir.renameTo(backup)) {
+					// System.out.println(Messages.LoadBinaryCorpus_2+backup);
+					// return false;
+					// }
+					
 					if (p != null) {
 						p.delete(); // the user said yes, so delete the previous project
-					} else {
+					}
+					else {
 						DeleteDir.deleteDirectory(corpusdir);
 					}
-
+					
 					if (corpusdir.exists()) {
 						return null;
 					}
-				} else {
+				}
+				else {
 					return null; // abandon
 				}
 			}
 		}
-
+		
 		// scan dir
 		JobHandler jobhandler = new JobHandler(
 				NLS.bind(TXMUIMessages.newCorpusColonP0, corpusdir.getName())) {
+			
 			@Override
 			protected IStatus run(final IProgressMonitor monitor) {
 				this.runInit(monitor);
 				final Project newProject2 = loadBinaryCorpusArchive(zipFile, this, monitor, false);
 				this.setResultObject(newProject2);
 				this.syncExec(new Runnable() {
+					
 					@Override
 					public void run() {
-
+						
 						if (newProject2 != null) {
-							//newProject2.compute(); // TODO calling compute now calls preferences.flush --> JOB LOCK
+							// newProject2.compute(); // TODO calling compute now calls preferences.flush --> JOB LOCK
 							RestartTXM.reloadViews();
-							//System.out.println("Select newly loaded corpus: "+base2.getCorpora().values());
+							// System.out.println("Select newly loaded corpus: "+base2.getCorpora().values());
 							CorporaView.select(newProject2.getChildren(MainCorpus.class));
 							StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
 							Log.info(NLS.bind(TXMUIMessages.P0CorpusLoaded, newProject2));
-						} else {
+						}
+						else {
 							System.out.println("Error: no project loaded.");
 						}
 					}
 				});
 				return Status.OK_STATUS;
-				//return Status.CANCEL_STATUS;
+				// return Status.CANCEL_STATUS;
 			}
 		};
-
+		
 		try {
 			jobhandler.startJob();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			org.txm.utils.logger.Log.printStackTrace(e);
 		}
-
+		
 		return jobhandler;
 	}
-
+	
 	/**
 	 * don't manage the SearchEngine restart
 	 * 
 	 * @param zipFile
 	 * @param jobhandler
 	 * @param monitor
-	 * @param replace 
+	 * @param replace
 	 * @return
 	 */
 	public static Project loadBinaryCorpusArchive(File zipFile, JobHandler jobhandler, final IProgressMonitor monitor, boolean replace) {
 		Project project = null;
 		try {
-			//			SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
-			//			if (engine.isRunning()) {
-			//				engine.stop();
-			//			}
-
-			//CHECK ZIPPED FILE
+			// SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
+			// if (engine.isRunning()) {
+			// engine.stop();
+			// }
+			
+			// CHECK ZIPPED FILE
 			if (Load080BinaryCorpus.canLoad(zipFile)) {
 				project = Load080BinaryCorpus.loadBinaryCorpusArchive(zipFile, monitor, replace);
-			} else if (Load079BinaryCorpus.canLoad(zipFile)) {
+			}
+			else if (Load079BinaryCorpus.canLoad(zipFile)) {
 				project = Load079BinaryCorpus.loadBinaryCorpusArchive(zipFile, monitor, replace);
-			} else {
+			}
+			else {
 				Log.warning(NLS.bind("The {0} archive is not a TXM corpus.", zipFile));
 				return null;
 			}
 			if (project == null) {
 				Log.warning(NLS.bind("Failed to load the {0} corpus.", zipFile));
-				return null; 
+				return null;
 			}
-		} catch (ThreadDeath td) { 
+		}
+		catch (ThreadDeath td) {
 			return null;
-		} catch (Exception e2) {
+		}
+		catch (Exception e2) {
 			org.txm.utils.logger.Log.printStackTrace(e2);
 			return null;
-		} finally {
-
 		}
+		finally {
+			
+		}
 		return project;
 	}
-
+	
 	/**
 	 * load the content of the file if its a directory containing at least the sub folders :
 	 * txm, html, data and registry.
-	 * @param replace 
+	 * 
+	 * @param replace
 	 *
 	 * @param binCorpusDirectory the basedir
 	 * @return the base
@@ -290,33 +312,33 @@
 		if (!(corpusDirectory.exists() && corpusDirectory.isDirectory())) {
 			Log.warning(NLS.bind(TXMUIMessages.failedToLoadCorpusP0, corpusDirectory.getAbsolutePath()));
 			System.out.println(NLS.bind(TXMUIMessages.failedToLoadCorpusP0, corpusDirectory.getAbsolutePath()));
-			return null; 
+			return null;
 		}
-
-		//		SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
-		//		if (engine.isRunning()) {
-		//			engine.stop();
-		//		}
-
-		//		//File txmregistry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$
-		//		//txmregistry.mkdir();
-		//		File txmcorpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$
-		//		txmcorpora.mkdir();
-		//		Project base = Toolbox.workspace.scanDirectory(binCorpusDirectory);
-		//		if (base == null) {
-		//			Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents, binCorpusDirectory)); 
-		//			return null;
-		//		}
+		
+		// SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
+		// if (engine.isRunning()) {
+		// engine.stop();
+		// }
+		
+		// //File txmregistry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$
+		// //txmregistry.mkdir();
+		// File txmcorpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$
+		// txmcorpora.mkdir();
+		// Project base = Toolbox.workspace.scanDirectory(binCorpusDirectory);
+		// if (base == null) {
+		// Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents, binCorpusDirectory));
+		// return null;
+		// }
 		//
-		//		Toolbox.workspace.save();
-
+		// Toolbox.workspace.save();
+		
 		// test with project name
 		Project p = Toolbox.workspace.getProject(corpusDirectory.getName().toUpperCase());
 		if (p != null) {
 			Log.warning(NLS.bind(TXMUIMessages.abortingLoadingOfPOACorpusWithTheSameNameAlreadyExists, corpusDirectory, corpusDirectory.getName().toUpperCase()));
 			return null;
 		}
-
+		
 		// test with CQP MainCorpus name
 		File dataDirectory = new File(corpusDirectory, "data");
 		File[] mainCorpusDirs = dataDirectory.listFiles();
@@ -328,33 +350,35 @@
 				return null;
 			}
 		}
-
+		
 		// seems like a binary corpus directory
 		// copy files in the new current corpora directory
 		File destDir = new File(Toolbox.workspace.getLocation(), corpusDirectory.getName().toUpperCase());
 		if (!destDir.equals(corpusDirectory)) {
 			FileCopy.copyFiles(corpusDirectory, destDir); // the corpus directory is not in the corpora directory
 		}
-
+		
 		Project project = null;
 		File paramFile = new File(destDir, ".settings");
 		File importXMLFile = new File(destDir, "import.xml");
 		File dotProjectFile = new File(destDir, ".project");
 		if (paramFile.exists() && paramFile.isDirectory() && dotProjectFile.exists() && dotProjectFile.isFile()) {
-			Log.info(NLS.bind(TXMUIMessages.loadingTheP0BinaryCorpusAsATXM080Corpus, destDir));
-
+			Log.info(NLS.bind(TXMUIMessages.theP0BinaryCorpusVersionIsP1, destDir));
+			
 			project = Load080BinaryCorpus.loadBinaryCorpusAsDirectory(destDir);
-		} else if (importXMLFile.exists()) {
+		}
+		else if (importXMLFile.exists()) {
 			Log.info(NLS.bind(TXMUIMessages.loadingTheP0BinaryCorpusAsATXM079Corpus, destDir));
 			project = Load079BinaryCorpus.loadBinaryCorpusAsDirectory(destDir, null);
-		} else {
+		}
+		else {
 			Log.warning(NLS.bind(TXMUIMessages.theP0directoryNotABinaryCorpus, destDir));
 		}
-
+		
 		if (!destDir.equals(corpusDirectory) && project == null) { // clean if necessary
 			DeleteDir.deleteDirectory(destDir); // the corpus directory was not in the corpora directory
 		}
-
+		
 		return project;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java	(revision 3021)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java	(revision 3022)
@@ -47,40 +47,43 @@
  * @author mdecorde
  */
 public class Load080BinaryCorpus {
-
-
+	
+	
 	public static boolean canLoad(File zipFile) {
 		String basedirname = Zip.getRoot(zipFile);
-		return Zip.hasEntries(zipFile, basedirname+"/.settings/", basedirname+"/.project", basedirname+"/data/", basedirname+"/txm/", basedirname+"/HTML/", basedirname+"/registry/");
+		return Zip.hasEntries(zipFile, basedirname + "/.settings/", basedirname + "/.project", basedirname + "/data/", basedirname + "/txm/", basedirname + "/HTML/", basedirname + "/registry/");
 	}
+	
 	/**
 	 * load the content of the file if its a directory containing at least the sub folders :
 	 * txm, html, data and registry.
-	 * @param replace 
+	 * 
+	 * @param replace
 	 *
 	 * @param binCorpusDirectory the zipFile
 	 * @return the base
 	 * @throws Exception the exception
 	 */
 	public static Project loadBinaryCorpusArchive(File zipFile, IProgressMonitor monitor, boolean replace) throws Exception {
-		//ZIPPED FILE
+		// ZIPPED FILE
 		if (monitor != null) monitor.beginTask(TXMUIMessages.loadingBinaryCorpus, 100);
 		if (monitor != null) monitor.subTask(TXMUIMessages.extractingBinaryCorpus);
-
+		
 		if (!canLoad(zipFile)) {
 			Log.severe(NLS.bind(TXMUIMessages.binaryCorpusIsNotATXM080CorpusNoSettingsNorProjectFile, zipFile.getName()));
 			return null;
 		}
 		
-		Log.info(NLS.bind(TXMUIMessages.loadingTheP0BinaryCorpusAsATXM080Corpus, zipFile.getName()));
+		Log.info(NLS.bind(TXMUIMessages.theP0BinaryCorpusVersionIsP1, zipFile.getName(), "0.8.0"));
 		
 		String basedirname = Zip.getRoot(zipFile);
-
+		
 		Project p = Toolbox.workspace.getProject(basedirname.toUpperCase());
 		if (p != null) {
 			if (replace) {
 				p.delete();
-			} else {
+			}
+			else {
 				System.out.println(NLS.bind(TXMUIMessages.abortingLoadingOfPOACorpusWithTheSameNameAlreadyExists, zipFile, basedirname.toUpperCase()));
 				return null;
 			}
@@ -90,25 +93,27 @@
 		if (corpusDirectory.exists()) {
 			if (replace) {
 				DeleteDir.deleteDirectory(corpusDirectory);
-			} else {
+			}
+			else {
 				System.out.println(NLS.bind(TXMUIMessages.abortingLoadingOfPOACorpusWithTheSameNameAlreadyExists, zipFile, corpusDirectory));
 				return null;
 			}
 		}
-
+		
 		try {
-			//System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir));
+			// System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir));
 			Zip.decompress(zipFile, Toolbox.workspace.getLocation(), false, monitor);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			Log.severe(NLS.bind(TXMUIMessages.couldNotUnzipBinaryCorpusColon, e));
 			org.txm.utils.logger.Log.printStackTrace(e);
 			return null;
 		}
 		if (monitor != null) monitor.worked(50);
-
+		
 		if (monitor != null) monitor.subTask(TXMUIMessages.loadingTheCorpusInThePlatform);
 		
-
+		
 		// test with CQP MainCorpus name
 		File dataDirectory = new File(corpusDirectory, "data");
 		File[] mainCorpusDirs = dataDirectory.listFiles();
@@ -121,17 +126,17 @@
 				return null;
 			}
 		}
-
+		
 		Project newProject = loadBinaryCorpusAsDirectory(corpusDirectory);
 		if (newProject == null) {
 			DeleteDir.deleteDirectory(corpusDirectory); // clean files
 			Log.severe(TXMUIMessages.failedToLoadBinaryCorpusNullError);
 			return null;
 		}
-
+		
 		return newProject;
 	}
-
+	
 	/**
 	 * load the content of the file if its a directory containing at least the sub folders :
 	 * txm, html, data and registry.
@@ -143,28 +148,29 @@
 	public static Project loadBinaryCorpusAsDirectory(File binCorpusDirectory) throws Exception {
 		if (!(binCorpusDirectory.exists() && binCorpusDirectory.isDirectory())) {
 			Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusP0, binCorpusDirectory.getAbsolutePath()));
-			return null; 
+			return null;
 		}
-
+		
 		File txmcorpora = new File(Toolbox.getTxmHomePath(), "corpora"); //$NON-NLS-1$
 		txmcorpora.mkdir();
 		Project project = Toolbox.workspace.scanDirectory(binCorpusDirectory);
 		if (project == null) {
-			Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents, binCorpusDirectory)); 
+			Log.severe(NLS.bind(TXMUIMessages.failedToLoadCorpusFromDirectoryColonP0WeCannotFindTheNecessaryComponents, binCorpusDirectory));
 			return null;
 		}
-
+		
 		boolean ok = true;
 		for (TXMResult r : project.getChildren(MainCorpus.class)) {
-			MainCorpus c = (MainCorpus)r;
+			MainCorpus c = (MainCorpus) r;
 			ok = ok && c.compute(false);
 		}
 		if (ok) {
 			project.saveParameters();
 			return project;
-		} else {
+		}
+		else {
 			project.delete();
 			return null;
 		}
 	}
-}
\ No newline at end of file
+}
