Index: tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java
===================================================================
--- tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java	(revision 1199)
+++ tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java	(revision 1200)
@@ -299,7 +299,7 @@
 		}
 
 		return LangFormater.format(StringUtils.join(words, wordSeparator),
-				concordance.getCorpus().getLang()); //$NON-NLS-1$
+				concordance.getCorpus().getLanguage()); //$NON-NLS-1$
 	}
 
 	/**
@@ -349,7 +349,7 @@
 			currentPos++; // next position
 		}
 		return LangFormater.format(StringUtils.join(words, wordSeparator),
-				concordance.getCorpus().getLang()); //$NON-NLS-1$
+				concordance.getCorpus().getLanguage()); //$NON-NLS-1$
 	}
 
 	/**
@@ -396,7 +396,7 @@
 			currentPos++;
 		}
 		return LangFormater.format(StringUtils.join(words, wordSeparator),
-				concordance.getCorpus().getLang()); 
+				concordance.getCorpus().getLanguage()); 
 	}
 	
 	/** The properties to process. */
@@ -430,7 +430,7 @@
 			words.add(StringUtils.join(word, "_")); //$NON-NLS-1$
 		}
 		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
-				concordance.getCorpus().getLang()); //$NON-NLS-1$
+				concordance.getCorpus().getLanguage()); //$NON-NLS-1$
 	}
 	
 	/**
@@ -458,7 +458,7 @@
 			words.add(StringUtils.join(word, wordSeparator));
 		}
 		return LangFormater.format(StringUtils.join(words, wordSeparator),
-				concordance.getCorpus().getLang()); //$NON-NLS-1$
+				concordance.getCorpus().getLanguage()); //$NON-NLS-1$
 	}
 	
 	/**
@@ -485,7 +485,7 @@
 		}
 
 		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
-				concordance.getCorpus().getLang()); //$NON-NLS-1$
+				concordance.getCorpus().getLanguage()); //$NON-NLS-1$
 	}
 
 	/**
Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/AnalecAnnotationsImporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/AnalecAnnotationsImporter.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/AnalecAnnotationsImporter.java	(revision 1200)
@@ -0,0 +1,445 @@
+package org.txm.annotation.urs.imports;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.importer.PersonalNamespaceContext;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.elements.Relation;
+import visuAnalec.elements.Schema;
+import visuAnalec.elements.Unite;
+import visuAnalec.fichiers.FichiersGlozz;
+import visuAnalec.vue.Vue;
+
+public class AnalecAnnotationsImporter {
+
+	protected MainCorpus mainCorpus;
+	protected Corpus analecCorpus;
+	protected File annotationsDirectory;
+	protected Vue analecVue;
+	protected IProgressMonitor monitor;
+	protected XMLInputFactory factory;
+	protected File aamFile;
+	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+
+	public AnalecAnnotationsImporter(IProgressMonitor monitor, File outputDirectory, File aamFile, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
+		this.annotationsDirectory = outputDirectory;
+		this.aamFile = aamFile;
+		this.mainCorpus = mainCorpus;
+		this.analecCorpus = analecCorpus;
+		this.analecVue = analecVue;
+		this.monitor = monitor;
+	}
+
+	public boolean process() throws Exception {
+		if (!annotationsDirectory.exists()) {
+			System.out.println("Error: annotationsDirectory does not exist: "+annotationsDirectory.getAbsolutePath());
+			return false;
+		}
+		if (!annotationsDirectory.isDirectory()) {
+			System.out.println("Error: annotationsDirectory is not a directory: "+annotationsDirectory.getAbsolutePath());
+			return false;
+		}
+		if (!aamFile.exists()) {
+			System.out.println("Error: aamFile does not exist: "+aamFile.getAbsolutePath());
+			return false;
+		}
+		
+		if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamFile)) {
+			System.out.println("Error while importing Glozz model: "+aamFile);
+			return false;
+		}
+		
+		File[] ursFiles = annotationsDirectory.listFiles(new FilenameFilter() {
+			@Override
+			public boolean accept(File dir, String name) {
+				return name.matches(".+-urs\\.xml");
+			}
+		});
+
+		if (ursFiles == null) {
+			System.out.println("No XML files found in "+annotationsDirectory);
+			return false;
+		}
+		if (ursFiles.length == 0) {
+			System.out.println("No XML files found in "+annotationsDirectory);
+			return false;
+		}
+		Arrays.sort(ursFiles);
+
+		factory = XMLInputFactory.newInstance();
+		List<String> cqpTextIds = mainCorpus.getProject().getTextsID();
+
+		List<Integer> all_result_summary = Arrays.asList(0,0,0,0,0,0,0,0);
+		
+		if (monitor != null) monitor.subTask("Processing "+ursFiles.length+" texts...");
+		for (File xmlTXMFile : ursFiles) {
+			String textid = xmlTXMFile.getName().substring(0, xmlTXMFile.getName().length() - 8);
+			System.out.println("Processing text: "+textid);
+			if (cqpTextIds.contains(textid)) {
+				if (monitor != null) monitor.subTask("Processing "+textid+" text...");
+				// N unit, N unit error, N unit no match error, N unit too much match error, N Relation, N Relation error, N Schema, N Schema error
+				List<Integer> result_summary = processText(textid, xmlTXMFile);
+				
+				System.out.println(textid+" import report: ");
+				System.out.println(" N Units added: "+result_summary.get(0));
+				System.out.println(" N Units error: "+result_summary.get(1));
+				System.out.println(" N Units no match error: "+result_summary.get(2));
+				System.out.println(" N Units too much match error: "+result_summary.get(3));
+				System.out.println(" N Relations added: "+result_summary.get(4));
+				System.out.println(" N Relations error: "+result_summary.get(5));
+				System.out.println(" N Schemas added: "+result_summary.get(6));
+				System.out.println(" N Schemas error: "+result_summary.get(7));
+				
+				for (int i = 0 ; i < all_result_summary.size() ; i++) all_result_summary.set(i, all_result_summary.get(i)+result_summary.get(i));
+
+			} else {
+				System.out.println("Warning: cannot found text with ID="+textid+" in current CQP corpus.");
+			}
+		}
+		
+		System.out.println("Final import report: ");
+		System.out.println(" N Units added: "+all_result_summary.get(0));
+		System.out.println(" N Units error: "+all_result_summary.get(1));
+		System.out.println(" N Units no match error: "+all_result_summary.get(2));
+		System.out.println(" N Units too much match error: "+all_result_summary.get(3));
+		System.out.println(" N Relations added: "+all_result_summary.get(4));
+		System.out.println(" N Relations error: "+all_result_summary.get(5));
+		System.out.println(" N Schemas added: "+all_result_summary.get(6));
+		System.out.println(" N Schemas error: "+all_result_summary.get(7));
+
+		return true;
+	}
+
+	private List<Integer> processText(String textid, File xmlTXMFile) throws Exception {
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+		// N unit, N unit error, N unit no match error, N unit too much match error, N Relation, N Relation error, N Schema, N Schema error
+		int nUnitsAdded = 0;
+		int nUnitsError = 0;
+		int nUnitsNoMatchError = 0;
+		int nUnitsTooMuchMatchError = 0;
+		int nRelationsAdded = 0;
+		int nRelationsError = 0;
+		int nSchemaAdded = 0;
+		int nSchemaError = 0;
+		
+		unites.clear();
+		relations.clear();
+		schemas.clear();
+		elementProperties.clear();
+
+		if (!parseXMLTXMFile(xmlTXMFile)) return null;
+
+//		if (unites.size() > 0) System.out.println(unites);
+//		if (relations.size() > 0) System.out.println(relations);
+//		if (schemas.size() > 0) System.out.println(schemas);
+//		if (elementProperties.size() > 0) System.out.println(elementProperties);
+//		for (String u : unites.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+//		for (String u : relations.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+//		for (String u : schemas.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+
+		for (String id : unites.keySet()) {
+			String ana = unites.get(id)[0];
+			String type = unites.get(id)[1];
+			String deb = unites.get(id)[2];
+			String fin = unites.get(id)[3];
+			if (elementProperties.containsKey(ana)) {
+
+				try {
+					CQLQuery query = new CQLQuery("[_.text_id=\""+textid+"\" & id=\""+deb+"|"+fin+"\"]");
+					QueryResult result = mainCorpus.query(query, "TMP", true);
+					int[] starts = result.getStarts();
+					result.drop();
+					if (starts.length == 1) {
+						//System.out.println("create unite: "+type+" ["+deb+", "+fin+"]");
+						Unite unite = analecCorpus.addUniteSaisie(type, starts[0], starts[0]);
+						HashMap<String, String> props = elementProperties.get(ana);
+						for (String prop : props.keySet()) {
+							unite.putProp(prop, props.get(prop));
+						}
+						unitesRef.put(id, unite);
+						nUnitsAdded++;
+					} else if (starts.length == 2) {
+						Unite unite = analecCorpus.addUniteSaisie(type, starts[0], starts[1]);
+						//System.out.println("create unite: "+type+" ["+deb+", "+fin+"]");
+						HashMap<String, String> props = elementProperties.get(ana);
+						for (String prop : props.keySet()) {
+							unite.putProp(prop, props.get(prop));
+						}
+						unitesRef.put(id, unite);
+						nUnitsAdded++;
+					} else {
+						nUnitsError++;
+						if (starts.length == 0) {
+							System.out.println("WARNING: no position found for query "+query+".");
+							nUnitsNoMatchError++;
+						} else {
+							System.out.println("WARNING: too many positions found for query "+query+" -> "+Arrays.toString(starts));
+							nUnitsTooMuchMatchError++;
+						}
+					}
+				} catch(Exception e) {
+					System.out.println("Error while getting word positions of id="+deb+" and id="+fin+": "+e.getLocalizedMessage());
+					Log.printStackTrace(e);
+				}
+			} else {
+				System.out.println("Warning no properties found for element id="+id+" and ana="+ana);
+			}
+		}
+
+		for (String id : relations.keySet()) {
+			String ana = relations.get(id)[0];
+			String type = relations.get(id)[1];
+			String target = relations.get(id)[2];
+
+			if (elementProperties.containsKey(ana)) {
+
+				String[] wordsref = target.split(" ");
+				String[] wordsid = new String[wordsref.length];
+				for (int i = 0 ; i < wordsref.length ; i++) wordsid[i] = wordsref[i].substring(1);
+				try {
+					Unite elt1 = unitesRef.get(wordsid[0]);
+					Unite elt2 = unitesRef.get(wordsid[1]);
+					if (elt1 != null && elt2 != null) {
+						//System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
+
+						Relation relation = analecCorpus.addRelationSaisie(type, elt1, elt2);
+						HashMap<String, String> props = elementProperties.get(ana);
+						for (String prop : props.keySet()) {
+							relation.putProp(prop, props.get(prop));
+						}
+						nRelationsAdded++;
+					} else {
+						System.out.println("ERROR: relation element not found "+Arrays.toString(wordsref));
+						nRelationsError++;
+					}
+				} catch(Exception e) {
+
+				}
+			} else {
+				System.out.println("Warning no properties found for element id="+id);
+			}
+		}
+
+		for (String id : schemas.keySet()) {
+			String ana = schemas.get(id)[0];
+			String type = schemas.get(id)[1];
+			String target = schemas.get(id)[2];
+			if (elementProperties.containsKey(ana)) {
+				String[] unitsref = target.split(" ");
+				try {
+					//System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
+					Schema schema = new Schema(type);
+					for (String unitid : unitsref) {
+						unitid = unitid.substring(1); // remove '#'
+						if (unitesRef.containsKey(unitid)) {
+							Unite unite = unitesRef.get(unitid);
+							schema.ajouter(unite);
+						} else {
+							System.out.println("Warning: missing unit id: "+unitid);
+							nSchemaError++;
+						}
+					}
+					analecCorpus.addSchemaLu(schema);
+					HashMap<String, String> props = elementProperties.get(ana);
+					for (String prop : props.keySet()) {
+						schema.putProp(prop, props.get(prop));
+					}
+					nSchemaAdded++;
+				} catch(Exception e) {
+					System.out.println("Error while creating schema with id="+id);
+				}
+			} else {
+				System.out.println("Warning no properties found for element id="+id);
+			}
+		}
+
+		return Arrays.asList(nUnitsAdded, nUnitsError, nUnitsNoMatchError, nUnitsTooMuchMatchError,
+		nRelationsAdded, nRelationsError,
+		nSchemaAdded, nSchemaError);
+	}
+
+	private boolean parseXMLTXMFile(File xmlTXMFile) throws XMLStreamException, MalformedURLException, IOException {
+		InputStream inputData = xmlTXMFile.toURI().toURL().openStream();
+		factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
+
+		String currentType = null;
+		String currentN = null;
+		String currentAna = null;
+		String currentName = null;
+		String currentPropValue = null;
+
+		int processMode = 0; // 0 nothing, 1 elements 2 properties
+
+		if (!goToStandOff(parser)) {
+			System.out.println("Error: cannot find the 'standOff' element in "+xmlTXMFile);
+			return false;
+		}
+		String localname = null;
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				localname = parser.getLocalName();
+
+				if (localname.equals("annotationGrp")) {
+					currentType = parser.getAttributeValue(null, "type");
+					currentN = parser.getAttributeValue(null, "subtype");
+					if (currentType != null && currentN != null) {
+						processMode = 1;
+					} else {
+						System.out.println("Warning found "+localname+" without 'type' and 'n' attribute");
+						processMode = 0;
+					}
+				} else if (localname.equals("div")) {
+					String type = parser.getAttributeValue(null, "type");
+					if (type == null) type = "";
+					if (type.endsWith("-fs"))
+					processMode = 2;
+				} 
+
+				if (processMode == 1) {
+					if (localname.equals("span") || localname.equals("link")) {
+						String id = parser.getAttributeValue(null, "id");
+						String ana = parser.getAttributeValue(null, "ana");
+						//System.out.println("SPAN id="+id +" ana="+ana+" currentType="+currentType+" currentN="+currentN);
+						if ("Unit".equals(currentType)) {
+							String from = parser.getAttributeValue(null, "from");
+							String to = parser.getAttributeValue(null, "to");
+							registerUnite(id, ana, currentN, from, to);
+						} else if ("Relation".equals(currentType)) {
+							String target = parser.getAttributeValue(null, "target");
+							registerRelation(id, ana, currentN, target);
+						} else if ("Schema".equals(currentType)) {
+							String target = parser.getAttributeValue(null, "target");
+							registerSchema(id, ana, currentN, target);
+						}
+					}
+				} else if (processMode == 2) {
+					if (localname.equals("fs")) {
+						currentAna = parser.getAttributeValue(null, "id");
+						if (elementProperties.get(currentAna) != null) System.out.println("WARNING: duplicated element properties: "+currentAna);
+						elementProperties.put(currentAna, new HashMap<String, String>());
+					} else if (localname.equals("f")) {
+						currentName= parser.getAttributeValue(null, "name");
+						currentPropValue = "";
+					}
+				} else {
+					// nothing to do
+				} 
+
+				break;		
+			case XMLStreamConstants.CHARACTERS:
+				if (processMode == 2 && currentAna != null && currentName != null) {
+					currentPropValue += parser.getText();
+				}
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				localname = parser.getLocalName();
+				if (localname.equals("standOff")) { // stop all
+					parser.close();
+					inputData.close();
+					return true;
+				} else if (processMode == 1 && localname.equals("annotationGrp")) { // stop all
+					currentType = null;
+					currentN = null;
+					processMode = 0;
+				} else if (processMode == 2 && localname.equals("div")) {
+					processMode = 0;
+				}
+
+				if (processMode == 1) {
+
+				} else if (processMode == 2) {
+					if (localname.equals("fs")) {
+						currentAna = null;
+					} else if (localname.equals("f")) {
+						if (currentName != null && currentAna != null) {
+							elementProperties.get(currentAna).put(currentName, currentPropValue);
+						}
+						currentName = null;
+					}
+				} else {
+					// nothing to do
+				}
+
+				break;
+
+			case XMLStreamConstants.END_DOCUMENT:
+				parser.close();
+				inputData.close();
+				return false;
+			}
+		}
+		parser.close();
+		inputData.close();
+
+
+		return false; // standOff not found
+	}
+
+	HashMap<String, HashMap<String, String>> elementProperties = new HashMap<String, HashMap<String, String>>();
+	HashMap<String, String[]> unites = new HashMap<String, String[]>(); // id -> {ana, type, from, to}
+	HashMap<String, Unite> unitesRef = new HashMap<String, Unite>(); // id -> Unite
+	private void registerUnite(String id, String ana, String type, String from, String to) {
+		String[] data = {ana.substring(1), type, from.substring(5), to.substring(5)};
+		if (unites.containsKey(id)) {
+			System.out.println("Warning: duplicated Unite id: "+id);
+		} else {
+			unites.put(id, data);
+		}
+	}
+	HashMap<String, String[]> relations = new HashMap<String, String[]>(); // id -> {ana, type, target}
+	private void registerRelation(String id, String ana, String type, String target) {
+		String[] data = {ana.substring(1), type, target};
+		if (relations.containsKey(id)) {
+			System.out.println("Warning: duplicated Relation id: "+id);
+		} else {
+			relations.put(id, data);
+		}
+	}
+	HashMap<String, String[]> schemas = new HashMap<String, String[]>(); // id -> {ana, type, target}
+	private void registerSchema(String id, String ana, String type, String target) {
+		String[] data = {ana.substring(1), type, target};
+		//System.out.println("R schema: "+id+" : "+Arrays.toString(data));
+		if (schemas.containsKey(id)) {
+			System.out.println("Warning: duplicated Schema id: "+id);
+		} else {
+			schemas.put(id, data);
+		}
+	}
+
+	private boolean goToStandOff(XMLStreamReader parser) throws XMLStreamException {
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				String localname = parser.getLocalName();
+				if (localname.equals("standOff")) return true;
+				break;		
+			}
+		}
+		return false;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/AnalecAnnotationsImporter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/DOMAnalecAnnotationsImporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/DOMAnalecAnnotationsImporter.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/DOMAnalecAnnotationsImporter.java	(revision 1200)
@@ -0,0 +1,178 @@
+package org.txm.annotation.urs.imports;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.HashMap;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.importer.PersonalNamespaceContext;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.xml.DomUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.vue.Vue;
+
+public class DOMAnalecAnnotationsImporter {
+
+	MainCorpus mainCorpus;
+	Corpus analecCorpus;
+	File annotationsDirectory;
+	private Vue analecVue;
+	private IProgressMonitor monitor;
+	private XMLInputFactory factory;
+	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+
+	public DOMAnalecAnnotationsImporter(IProgressMonitor monitor, File outputDirectory, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
+		this.annotationsDirectory = outputDirectory;
+		this.mainCorpus = mainCorpus;
+		this.analecCorpus = analecCorpus;
+		this.analecVue = analecVue;
+		this.monitor = monitor;
+	}
+
+	public boolean process() throws Exception {
+		if (!annotationsDirectory.exists()) return false;
+		if (!annotationsDirectory.isDirectory()) return false;
+
+		File[] ursFiles = annotationsDirectory.listFiles(new FilenameFilter() {
+			@Override
+			public boolean accept(File dir, String name) {
+				return name.matches(".+-urs\\.xml");
+			}
+		});
+
+		if (ursFiles == null) {
+			System.out.println("No XML files found in "+annotationsDirectory);
+			return false;
+		}
+		if (ursFiles.length == 0) {
+			System.out.println("No XML files found in "+annotationsDirectory);
+			return false;
+		}
+
+		factory = XMLInputFactory.newInstance();
+
+		for (File xmlAnalec : ursFiles) {
+			String textid = xmlAnalec.getName().substring(0, xmlAnalec.getName().length() - 8);
+			System.out.println("Processing text: "+textid);
+
+			processText(textid, xmlAnalec);
+		}
+
+		return true;
+	}
+
+	private void processText(String textid, File xmlAnalec) throws Exception {
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+
+		HashMap<String, HashMap<String, String>> elementProperties = new HashMap<String, HashMap<String, String>>();
+
+		Document doc = DomUtils.load(xmlAnalec);
+		NodeList textElements = doc.getElementsByTagName("stdf");
+		for (int iText = 0 ; iText < textElements.getLength() ; ) {
+			Element text = (Element)textElements.item(iText);
+
+			NodeList backElements = text.getElementsByTagName("annotations");
+			for (int iBack = 0 ; iBack < backElements.getLength() ; ) {
+				Element back = (Element)backElements.item(iBack);
+
+				NodeList divElements = text.getElementsByTagName("div");
+				for (int ifvLib = 0 ; ifvLib < divElements.getLength() ; ifvLib++) {
+					Element divElement = (Element)divElements.item(ifvLib);
+					String n = divElement.getAttribute("type");
+					if (n == null) n = "";
+					if (n.endsWith("-fs")) {
+						getElementPropertiesFromFvLibElement(elementProperties, divElement);
+					}
+				}
+				
+				NodeList children = back.getElementsByTagName("spanGrp");
+				for (int iChild = 0 ; iChild < children.getLength() ; iChild++) {
+					Element spanGrpElement = (Element)children.item(iChild);
+					String type = spanGrpElement.getAttribute("type");
+					String n = spanGrpElement.getAttribute("subtype");
+					if (type.equals("Unit")) {
+						getUnitesFromSpanGrp(spanGrpElement, n);
+					}
+				}
+				
+				children = back.getElementsByTagName("joinGrp");
+				for (int iChild = 0 ; iChild < children.getLength() ; iChild++) {
+					Element joinGrpElement = (Element)children.item(iChild);
+					String type = joinGrpElement.getAttribute("type");
+					String n = joinGrpElement.getAttribute("subtype");
+					if (type.equals("Relation")) {
+						getRelationsFromJoinGrp(joinGrpElement, n);
+					}
+				}
+				
+				children = back.getElementsByTagName("joinGrp");
+				for (int iChild = 0 ; iChild < children.getLength() ; iChild++) {
+					Element joinGrpElement = (Element)children.item(iChild);
+					String type = joinGrpElement.getAttribute("type");
+					String n = joinGrpElement.getAttribute("subtype");
+					if (type.equals("Schema")) {
+						getSchemasFromJoinGrp(joinGrpElement, n);
+					}
+				}
+
+				break; // stop at first back
+			}
+
+			break; // stop at first text
+		}
+	}
+
+	private void getSchemasFromJoinGrp(Element joinGrpElement, String n) {
+		NodeList children = joinGrpElement.getElementsByTagName("join");
+		for (int iChild = 0 ; iChild < children.getLength() ; iChild++) {
+			Element joinElement = (Element)children.item(iChild);
+			String id = joinElement.getAttribute("id");
+			String target = joinElement.getAttribute("target");
+			String ana = joinElement.getAttribute("ana");
+		}
+	}
+
+	private void getRelationsFromJoinGrp(Element joinGrpElement, String n) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	private void getUnitesFromSpanGrp(Element spanGrpElement, String n) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	private void getElementPropertiesFromFvLibElement(HashMap<String, HashMap<String, String>> elementProperties, Element divElement) {
+		NodeList fsElements = divElement.getElementsByTagName("fs");
+		for (int iChild = 0 ; iChild < fsElements.getLength() ; iChild++) {
+			Element fsElement = (Element)fsElements.item(iChild);
+			String id = fsElement.getAttribute("id");
+
+			if (elementProperties.containsKey(id)) {
+				System.out.println("Warning: duplicated fsElement id: "+id);
+			} else {
+				HashMap<String, String> properties = new HashMap<String, String>();
+				elementProperties.put(id, properties);
+				NodeList fElements = fsElement.getElementsByTagName("f");
+				for (int iChild2 = 0 ; iChild2 < fElements.getLength() ; iChild2++) {
+					Element fElement = (Element)fElements.item(iChild2);
+					String name = fElement.getAttribute("name");
+					if (properties.containsKey(name)) {
+						System.out.println("Warning: duplicated fElement name: "+name+" in "+id+" fsElement.");
+					} else {
+						properties.put(name, fElement.getTextContent().trim());
+					}
+				}
+			}
+		}
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/DOMAnalecAnnotationsImporter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java	(revision 1200)
@@ -0,0 +1,135 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.kohsuke.args4j.Option;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.imports.AnalecAnnotationsImporter;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.vue.Vue;
+/**
+ * Export the Analec annotation of the selected Corpus
+ * 
+ * @author mdecorde
+ *
+ */
+public class ImportTEIAnnotations  extends AbstractHandler {
+
+	@Option(name="directory",usage="the directory containing the XML-TEI-URS annotations files", widget="Folder", required=true, def="annotations")
+	File directory;
+	@Option(name="aamFile",usage="The Glozz model file", widget="FileOpen", required=true, def="model.aam")
+	File aamFile;
+	//@Option(name="standoffAnnotations",usage="select this if the directory contains standoff annotation files", widget="Boolean", required=true, def="false")
+	//boolean standoffAnnotations;
+	@Option(name="resetAnnotations",usage="Remove the old annotations", widget="Boolean", required=true, def="false")
+	boolean resetAnnotations;
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			Object first = CorporaView.getFirstSelectedObject();
+			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+				System.out.println(Messages.ImportTEIAnnotations_0+first);
+				return null;
+			}
+			
+			final MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+			final Corpus analecCorpus = AnalecCorpora.getCorpus(mainCorpus);
+			final Vue vue = AnalecCorpora.getVue(mainCorpus);
+			
+			JobHandler job = new JobHandler(mainCorpus.getName()+Messages.ImportTEIAnnotations_1) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						if (resetAnnotations) {
+							analecCorpus.clearAnnot();
+						}
+						
+						if (!importer(monitor, directory, aamFile, true, mainCorpus, analecCorpus, vue)) {
+							System.out.println(Messages.ImportTEIAnnotations_2);
+							return Status.CANCEL_STATUS;
+						} else {
+							return Status.OK_STATUS;
+						}
+					} catch (Throwable e) {
+						System.out.println(Messages.ImportTEIAnnotations_3+e.getLocalizedMessage());
+						Log.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					}
+				}
+			};
+			job.schedule();
+			
+		} catch (Exception e) {
+			System.out.println(Messages.ImportTEIAnnotations_4+e);
+			Log.printStackTrace(e);
+		}
+		return null;
+	}
+
+	/**
+	 * <pre>
+	 * IProgressMonitor monitor = getIProgressMonitor();
+	 * File directory = new File("resultdir");
+	 * File aamFile = new File("model.aam");
+	 * Boolean stdf = true;
+	 * String name = "BROWN";
+	 * MainCorpus mainCorpus = CorpusManager.getCorpusManager().getCorpus(name)
+	 * Corpus analecCorpus = AnalecCorpora.getCorpus(name.toUpperCase());
+	 * Vue vue = AnalecCorpora.getVue(name);
+	 * 
+     * ImportTEIAnnotations.importer(monitor, directory, aamFile, stdf, mainCorpus, analecCorpus, vue);
+     *</pre>
+	 * @param monitor
+	 * @param annotationDirectory
+	 * @param aamFile
+	 * @param standoffAnnotations
+	 * @param mainCorpus
+	 * @param analecCorpus
+	 * @param vue
+	 * @return
+	 * @throws Exception
+	 */
+	public static boolean importer(IProgressMonitor monitor, File annotationDirectory, File aamFile, boolean standoffAnnotations, MainCorpus mainCorpus, Corpus analecCorpus, Vue vue) throws Exception {
+//		if (!standoffAnnotations) { // use stax because files are too big for DOM process
+//			AnalecAnnotationsImporter importer = new AnalecAnnotationsImporter(monitor, annotationDirectory, mainCorpus, analecCorpus, vue);
+//			boolean ret = importer.process();
+//			if (ret) System.out.println("Done: "+analecCorpus.getToutesUnites().size()+" unites "+analecCorpus.getToutesRelations().size()+" relations "+analecCorpus.getTousSchemas().size()+" schemas.");
+//			return ret;
+//		} else {
+//			DOMAnalecAnnotationsImporter importer = new DOMAnalecAnnotationsImporter(monitor, annotationDirectory, mainCorpus, analecCorpus, vue);
+//			boolean ret = importer.process();
+//			if (ret) System.out.println("Done: "+analecCorpus.getToutesUnites().size()+" unites "+analecCorpus.getToutesRelations().size()+" relations "+analecCorpus.getTousSchemas().size()+" schemas.");
+//			return ret;
+//		}
+		//TODO: DOMAnalecAnnotationsImporter not finished
+		AnalecAnnotationsImporter importer = new AnalecAnnotationsImporter(monitor, annotationDirectory, aamFile, mainCorpus, analecCorpus, vue);
+		boolean ret = importer.process();
+		
+		if (ret) {
+			System.out.println(Messages.ImportTEIAnnotations_5+analecCorpus.getToutesUnites().size()+Messages.ImportTEIAnnotations_6+analecCorpus.getToutesRelations().size()+Messages.ImportTEIAnnotations_7+analecCorpus.getTousSchemas().size()+Messages.ImportTEIAnnotations_8);
+			mainCorpus.setIsModified(true);
+			CorporaView.refreshObject(mainCorpus);
+		}
+		return ret;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveCorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveCorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveCorpus.java	(revision 1200)
@@ -0,0 +1,79 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.edition.rcp.editors.SynopticEditionEditor;
+import org.txm.rcp.TXMWindows;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+
+public class SaveCorpus  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+	Corpus corpus;
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.SaveCorpus_0+first);
+			return null;
+		}
+		final MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		save(mainCorpus, event);
+
+		return null;
+	}
+
+	public static boolean save(final MainCorpus mainCorpus, ExecutionEvent event) {
+		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
+		File fichierCorpus = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getID()+".ec"); //$NON-NLS-1$ //$NON-NLS-2$
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+		System.out.println(Messages.SaveCorpus_3+corpus+Messages.SaveCorpus_1+fichierCorpus);
+		if (!AnalecCorpora.saveCorpus(mainCorpus)) {
+			System.out.println(Messages.SaveCorpus_5);
+			return false;
+		}
+
+		mainCorpus.setIsModified(false);
+		if (event != null) {
+			HandlerUtil.getActiveShell(event).getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					CorporaView.refreshObject(mainCorpus);
+					
+					// find out which editor is using the MainCorpus
+					for (IWorkbenchPage page : TXMWindows.getActiveWindow().getPages()) {
+						for (IEditorReference editor_ref : page.getEditorReferences()) {
+							IEditorPart editor = editor_ref.getEditor(false);
+							if (editor != null && editor instanceof SynopticEditionEditor) {
+								if (mainCorpus.equals(((SynopticEditionEditor)editor).getCorpus())) {
+									((SynopticEditionEditor) editor).fireIsDirty();
+								}
+							}
+						}
+					}
+				}
+			});
+		}
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java	(revision 1200)
@@ -0,0 +1,235 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Arrays;
+
+import org.apache.commons.io.FilenameUtils;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.kohsuke.args4j.Option;
+import org.txm.Toolbox;
+import org.txm.annotation.urs.AnalecAnnotationReIndexer;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.objects.Project;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersGlozz;
+import visuAnalec.fichiers.FichiersJava;
+
+public class ImportGlozzCorpus  extends AbstractHandler {
+
+
+
+	//	@Option(name="aafile",usage="an example file", widget="File", required=true, def="text.aa")
+	//	File aafile;
+
+	//	@Option(name="acfile",usage="an example file", widget="File", required=true, def="annotations.ac")
+	//	File acfile
+
+	@Option(name="glozzDirectory",usage="A folder containing the Glozz files: aa ac and aam", widget="Folder", required=true, def="glozz")
+	File glozzDirectory;
+
+	@Option(name="aamfile",usage="The aam file to use", widget="File", required=true, def="model.aam")
+	File aamfile;
+	private String name;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			// END OF PARAMETERS
+			if (!glozzDirectory.exists()) {
+				System.out.println(Messages.ImportGlozzCorpus_0);
+				return null;
+			}
+
+			name = glozzDirectory.getName();
+			name = AsciiUtils.buildId(name);
+
+			final File srcDir = new File(glozzDirectory, name);
+			System.out.println(Messages.ImportGlozzCorpus_1);
+			DeleteDir.deleteDirectory(srcDir);
+			srcDir.mkdir();
+
+			final File ecDir = new File(glozzDirectory, "ec"); //$NON-NLS-1$
+			System.out.println(Messages.ImportGlozzCorpus_3);
+			DeleteDir.deleteDirectory(ecDir);
+			ecDir.mkdir();
+
+
+			if (!srcDir.exists()) {
+				System.out.println(Messages.ImportGlozzCorpus_4);
+				return null;
+			}
+
+			if (!ecDir.exists()) {
+				System.out.println(Messages.ImportGlozzCorpus_5);
+				return null;
+			}
+
+			// write the TXT file WITH paragraphs
+			File[] aaFiles = glozzDirectory.listFiles(new FilenameFilter() {
+				@Override
+				public boolean accept(File dir, String name) {
+					return name.endsWith(".aa"); //$NON-NLS-1$
+				}
+			});
+			File[] acFiles = glozzDirectory.listFiles(new FilenameFilter() {
+				@Override
+				public boolean accept(File dir, String name) {
+					return name.endsWith(".ac"); //$NON-NLS-1$
+				}
+			});
+
+			if (aaFiles == null || aaFiles.length == 0) {
+				System.out.println(Messages.ImportGlozzCorpus_8+glozzDirectory);
+				return false;
+			}
+			if (acFiles == null || acFiles.length == 0) {
+				System.out.println(Messages.ImportGlozzCorpus_9+glozzDirectory);
+				return false;
+			}
+			if (aaFiles.length != acFiles.length) {
+				System.out.println(Messages.ImportGlozzCorpus_10+glozzDirectory);
+				return false;
+			}
+
+			System.out.println(Messages.ImportGlozzCorpus_11+glozzDirectory);
+			Arrays.sort(acFiles);
+			Arrays.sort(aaFiles);
+			for (int i = 0 ; i < aaFiles.length ; i++) {
+				File acFile = acFiles[i];
+				File aaFile = aaFiles[i];
+				String name = acFile.getName();
+				int idx = name.indexOf("."); //$NON-NLS-1$
+				if (idx > 0) name = name.substring(0, idx);
+
+				File txtFile = new File(srcDir, name+".txt"); //$NON-NLS-1$
+				File ecFile = new File(ecDir, name+".ec"); //$NON-NLS-1$
+				Corpus tmpAnalecCorpus = new Corpus(); // need a temporary corpus
+
+				if (!FichiersGlozz.importerGlozz(tmpAnalecCorpus, acFile, aaFile)) {
+					System.out.println(Messages.ImportGlozzCorpus_15);
+					return null;
+				}
+
+				final String texte = tmpAnalecCorpus.getTexte();
+				int debParag = 0;
+				Integer[] finPars = tmpAnalecCorpus.getFinParagraphes();
+				StringBuffer newTexte = new StringBuffer(texte.length() + finPars.length);
+				for (int iParagraph = 0 ; iParagraph < finPars.length ; iParagraph++) {
+					newTexte.append(texte.substring(debParag, finPars[iParagraph])).append("\n"); //$NON-NLS-1$
+					debParag = finPars[iParagraph];
+				}
+
+				IOUtils.write(txtFile, newTexte.toString()); // write the TXT file for TXM TXT import module
+				FichiersJava.enregistrerCorpus(tmpAnalecCorpus, ecFile); // write for later
+
+				if (!txtFile.exists()) {
+					System.out.println(Messages.ImportGlozzCorpus_17);
+					return null;
+				}
+			}
+
+			Project project = Toolbox.workspace.getProject(name.toUpperCase());
+			if (project != null) {
+				CQPSearchEngine.getEngine().stop();
+				project.delete();
+			}
+			project = new Project(Toolbox.workspace, name.toUpperCase());
+			project.setName(name.toUpperCase());
+			project.setSourceDirectory(srcDir.getAbsolutePath());
+			project.setImportModuleName("txt");
+			project.getEditionDefinition("default").setBuildEdition(true);
+			
+			JobHandler job = ExecuteImportScript.executeScript(project);
+			if (job == null) { // job is scheduled in ExecuteImportScript.executeScript
+				System.out.println(Messages.ImportGlozzCorpus_23);
+				return null;
+			}
+
+			JobHandler job2 = new JobHandler(Messages.ImportGlozzCorpus_24) {
+
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
+						if (corpus == null) {
+							System.out.println("The CQP corpus was not created. Aborting.");
+							return Status.CANCEL_STATUS;
+						}
+						Corpus analecCorpus = AnalecCorpora.getCorpus(corpus);
+						analecCorpus.clearAll(); // remove all : annotations, structure
+						File[] ecFiles = ecDir.listFiles();
+						Arrays.sort(ecFiles);
+						for (File ecFile : ecFiles) {
+							FichiersJava.concatener(ecFile, analecCorpus);
+						}
+
+						System.out.println(Messages.ImportGlozzCorpus_25+aamfile);
+						if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamfile)) {
+							System.out.println(Messages.ImportGlozzCorpus_26);
+							return Status.CANCEL_STATUS;
+						}
+						//					
+						//					System.out.println("Importing Glozz corpus from: "+acfile+" and "+aafile);
+						//					if (!FichiersGlozz.importerGlozz(analecCorpus, acfile, aafile)) {
+						//						System.out.println("Error while importing Glozz corpus.");
+						//						return null;
+						//					}
+
+						System.out.println(Messages.ImportGlozzCorpus_27);
+						AnalecCorpora.removeCorpus(corpus); // remove old corpus if any
+
+						AnalecAnnotationReIndexer aari = new AnalecAnnotationReIndexer(corpus, analecCorpus);
+						if (!aari.process()) {
+							System.out.println(Messages.ImportGlozzCorpus_28);
+							return Status.CANCEL_STATUS;
+						}
+
+						System.out.println(Messages.ImportGlozzCorpus_29);
+						AnalecCorpora.saveCorpus(analecCorpus);
+						AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut();
+						System.out.println(Messages.ImportGlozzCorpus_30);
+						analecCorpus.setTexte(""); // free memory //$NON-NLS-1$
+						DeleteDir.deleteDirectory(ecDir); // cleaning
+						DeleteDir.deleteDirectory(srcDir); // cleaning
+
+						return Status.OK_STATUS;
+					} catch (Exception e) {
+						System.out.println(Messages.ImportGlozzCorpus_32+e.getLocalizedMessage());
+						Log.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					}
+				}
+			};
+			job2.startJob(true); // wait for the TXT import job to finish
+			return null;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadVue.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadVue.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadVue.java	(revision 1200)
@@ -0,0 +1,57 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+import visuAnalec.vue.Vue;
+
+public class LoadVue  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.LoadVue_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		
+		load(mainCorpus);
+		return null;
+	}
+	
+	public boolean load(MainCorpus mainCorpus) {
+		System.out.println(Messages.LoadVue_1+mainCorpus.getName());
+		Vue vue = AnalecCorpora.getVue(mainCorpus);
+		if (!FichiersJava.ouvrirVue(vue)) {
+			System.out.println(Messages.LoadVue_2);
+			return false;
+		}
+		
+		System.out.println(Messages.LoadVue_3);
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadVue.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructure.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructure.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructure.java	(revision 1200)
@@ -0,0 +1,57 @@
+package org.txm.annotation.urs.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.VisuStructure;
+import visuAnalec.fichiers.FichiersJava;
+
+public class LoadStructure  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.LoadStructure_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+//		if (VisuStructure.isOpen()) {
+//			System.out.println("Structure de corpus en cours d'édition. Abandon.");
+//			return null;
+//		}
+		
+		
+		return null;
+	}
+	
+	public static boolean load(Corpus corpus) {
+		System.out.println(Messages.LoadStructure_1+corpus);
+		if (!FichiersJava.ouvrirStructure(corpus)) {
+			System.out.println(Messages.LoadStructure_2);
+			return false;
+		}
+		System.out.println(Messages.LoadStructure_3);
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructure.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportGlozzCorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportGlozzCorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportGlozzCorpus.java	(revision 1200)
@@ -0,0 +1,80 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.kohsuke.args4j.Option;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.export.ExportToGlozzMacro;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+public class ExportGlozzCorpus  extends AbstractHandler {
+
+	@Option(name="exportDirectory",usage="the result directory ", widget="Folder", required=true, def="result directory")
+	File exportDirectory;
+	@Option(name="unit_type",usage="A unit type to export", widget="String", required=true, def="MENTION")
+	String unit_type;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			Object first = CorporaView.getFirstSelectedObject();
+			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+				System.out.println(Messages.ExportGlozzCorpus_0+first);
+				return null;
+			}
+
+			final MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+
+			JobHandler job = new JobHandler(mainCorpus.getName()+Messages.ExportGlozzCorpus_1) {
+
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					try {
+						export(exportDirectory, mainCorpus, unit_type);
+					} catch (ThreadDeath e) {
+						System.out.println(Messages.ExportGlozzCorpus_2);
+					} catch (Throwable e) {
+						System.out.println(Messages.ExportGlozzCorpus_3+e.getLocalizedMessage());
+						Log.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			job.schedule();
+
+			return null;
+		} catch (Throwable e) {
+			System.out.println(Messages.ExportGlozzCorpus_4+e.getLocalizedMessage());
+			Log.printStackTrace(e);
+		}
+		return null;
+	}
+	
+	public static void export(File exportDirectory, MainCorpus mainCorpus, String unit_type) throws NumberFormatException, IOException, CqiServerError, CqiClientException {
+		ExportToGlozzMacro exporter = new ExportToGlozzMacro();
+		File exportFile = new File(exportDirectory, mainCorpus.getID());
+		exporter.doExport(mainCorpus, unit_type, exportFile.getAbsolutePath());
+		return;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportGlozzCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditVue.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditVue.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditVue.java	(revision 1200)
@@ -0,0 +1,64 @@
+package org.txm.annotation.urs.commands;
+
+import java.awt.Dimension;
+import java.awt.Point;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.VisuMain;
+import visuAnalec.donnees.Corpus;
+import visuAnalec.util.GMessages;
+import visuAnalec.vue.VisuVue;
+import visuAnalec.vue.Vue;
+
+public class EditVue  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = EditVue.class.getName(); //$NON-NLS-1$
+	Vue vue;
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println("Selection is not a corpus: "+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+		vue = AnalecCorpora.getVue(corpus);
+
+		javax.swing.SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				try {
+					//System.out.println("Show editor...");
+					//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+					VisuVue visuVue = VisuVue.newVisuVue(null, vue);
+					visuVue.setExtendedState(VisuMain.NORMAL);
+					
+					Point locFenetre = new Point(50, 50);
+					Dimension dimFenetre = new Dimension(500, 500);
+					visuVue.setLocation(locFenetre);
+					visuVue.setSize(dimFenetre);
+					
+					visuVue.setVisible(true);
+				} catch (Throwable ex) {
+					GMessages.erreurFatale(ex);
+				}
+			}
+		});
+
+		return null;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditVue.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditStructure.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditStructure.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditStructure.java	(revision 1200)
@@ -0,0 +1,72 @@
+package org.txm.annotation.urs.commands;
+
+import java.awt.Dimension;
+import java.awt.Point;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.view.ElementPropertiesView;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.VisuMain;
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.VisuStructure;
+import visuAnalec.util.GMessages;
+
+public class EditStructure  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+	
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.EditStructure_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+
+		//System.out.println("Editing structure for corpus="+corpus);
+
+		ElementPropertiesView.closeView(); // ensure no properties are modified
+		open(corpus);
+
+		return null;
+	}
+	
+	public static void open(final Corpus corpus2) {
+		javax.swing.SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				try {
+					//System.out.println("Show editor...");
+					//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+					VisuStructure visuStructure = VisuStructure.newVisuStructure(null, corpus2);
+					visuStructure.setExtendedState(VisuMain.NORMAL);
+					
+					Point locFenetre = new Point(50, 50);
+					Dimension dimFenetre = new Dimension(500, 500);
+					visuStructure.setLocation(locFenetre);
+					visuStructure.setSize(dimFenetre);
+					
+					visuStructure.setVisible(true);
+					visuStructure.agencer();
+				} catch (Throwable ex) {
+					GMessages.erreurFatale(ex);
+				}
+			}
+		});
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditStructure.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEICorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEICorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEICorpus.java	(revision 1200)
@@ -0,0 +1,151 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.kohsuke.args4j.Option;
+import org.txm.Toolbox;
+import org.txm.annotation.urs.AnalecAnnotationReIndexer;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.objects.Project;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersTEI;
+
+public class ImportTEICorpus  extends AbstractHandler {
+
+	@Option(name="xmlFile",usage="an example file", widget="File", required=true, def="text.xml")
+	File xmlFile;
+
+	private String name;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			// END OF PARAMETERS
+			if (!(xmlFile.exists())) {
+				System.out.println(Messages.ImportTEICorpus_0+xmlFile);
+				return null;
+			}
+
+			name = xmlFile.getName();
+			int idx = name.indexOf("."); //$NON-NLS-1$
+			name = name.substring(0, idx);
+			name = AsciiUtils.buildId(name);
+
+			File srcDir = new File(xmlFile.getParentFile(), name);
+			System.out.println(Messages.ImportTEICorpus_2);
+			DeleteDir.deleteDirectory(srcDir);
+			srcDir.mkdir();
+
+			if (!srcDir.exists()) {
+				System.out.println(Messages.ImportTEICorpus_3);
+				return null;
+			}
+
+			// write the TXT file WITH paragraphs
+			File txtFile = new File(srcDir, name+".txt"); //$NON-NLS-1$
+			Corpus tmpAnalecCorpus = new Corpus(); // need a temporary corpus
+			System.out.println(Messages.ImportTEICorpus_5+xmlFile);
+			if (!FichiersTEI.convertir(xmlFile, new File("/tmp"), tmpAnalecCorpus)) { //$NON-NLS-1$
+				System.out.println(Messages.ImportTEICorpus_7);
+				return null;
+			}
+			
+			final String texte = tmpAnalecCorpus.getTexte();
+		    int debParag = 0;
+		    Integer[] finPars = tmpAnalecCorpus.getFinParagraphes();
+		    StringBuffer newTexte = new StringBuffer(texte.length() + finPars.length);
+		    for (int i = 0 ; i < finPars.length ; i++) {
+		    	newTexte.append(texte.substring(debParag, finPars[i])).append("\n"); //$NON-NLS-1$
+		    	debParag = finPars[i];
+		    }
+			
+			IOUtils.write(txtFile, newTexte.toString());
+			
+			if (!txtFile.exists()) {
+				System.out.println(Messages.ImportTEICorpus_9);
+				return null;
+			}
+
+			Project project = new Project(Toolbox.workspace, name.toUpperCase());
+			project.setSourceDirectory(srcDir.getAbsolutePath());
+			project.setImportModuleName("txt");
+			project.getEditionDefinition("default").setBuildEdition(true);
+			
+			JobHandler job = ExecuteImportScript.executeScript(project);
+			if (job == null) { // job is scheduled in ExecuteImportScript.executeScript
+				System.out.println(Messages.ImportTEICorpus_15);
+				return null;
+			}
+
+			JobHandler job2 = new JobHandler(Messages.ImportTEICorpus_16) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+					MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
+					File analecDirectory = new File(corpus.getProjectDirectory(), "analec"); //$NON-NLS-1$
+					analecDirectory.mkdirs();
+					Corpus analecCorpus = AnalecCorpora.getCorpus(corpus);
+					analecCorpus.clearAll(); // remove all : annotations, structure
+					
+					System.out.println(Messages.ImportTEICorpus_18+xmlFile);
+					if (!FichiersTEI.convertir(xmlFile, analecDirectory, analecCorpus)) {
+						System.out.println(Messages.ImportTEICorpus_19);
+						return null;
+					}
+				
+					System.out.println(Messages.ImportTEICorpus_20);
+					
+					AnalecCorpora.removeCorpus(corpus); // remove old corpus if any
+					
+					AnalecAnnotationReIndexer aari = new AnalecAnnotationReIndexer(corpus, analecCorpus);
+					if (!aari.process()) {
+						System.out.println(Messages.ImportTEICorpus_21);
+						return null;
+					}
+					
+					System.out.println(Messages.ImportTEICorpus_22);
+					AnalecCorpora.saveCorpus(analecCorpus);
+					AnalecCorpora.getVue(analecCorpus).retablirVueParDefaut();
+					System.out.println(Messages.ImportTEICorpus_23);
+					
+					return Status.OK_STATUS;
+					} catch (Exception e) {
+						System.out.println(Messages.ImportTEICorpus_24+e);
+						Log.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					}
+				}
+			};
+			job2.startJob(true); // wait for the TXT import job to finish
+			return null;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEICorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructureFromGlozz.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructureFromGlozz.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructureFromGlozz.java	(revision 1200)
@@ -0,0 +1,67 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.kohsuke.args4j.Option;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersGlozz;
+
+public class LoadStructureFromGlozz  extends AbstractHandler {
+
+	@Option(name="aamfile",usage="an example file", widget="File", required=true, def="model.aam")
+	File aamfile;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.LoadStructureFromGlozz_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+		
+//		if (VisuStructure.isOpen()) {
+//			System.out.println("Structure de corpus en cours d'édition. Abandon.");
+//			return null;
+//		}
+		
+		System.out.println(Messages.LoadStructureFromGlozz_1+corpus);
+
+		if (!ParametersDialog.open(this)) return null;
+
+		// END OF PARAMETERS
+		load(aamfile, corpus);
+		return null;
+	}
+	
+	public static boolean load(File aamfile, Corpus corpus) {
+		if (!(aamfile.exists() && aamfile.exists() && aamfile.exists())) {
+			System.out.println(Messages.LoadStructureFromGlozz_2);
+			return false;
+		}
+		
+		File fichierModele = aamfile;
+		if (!FichiersGlozz.importerModeleGlozz(corpus, fichierModele)) {
+			System.out.println(Messages.LoadStructureFromGlozz_3);
+			return false;
+		}
+		
+		System.out.println(Messages.LoadStructureFromGlozz_4);
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadStructureFromGlozz.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructureAsGlozzModel.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructureAsGlozzModel.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructureAsGlozzModel.java	(revision 1200)
@@ -0,0 +1,47 @@
+package org.txm.annotation.urs.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersGlozz;
+
+public class SaveStructureAsGlozzModel  extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.SaveStructureAsGlozzModel_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+
+//		if (VisuStructure.isOpen()) {
+//			System.out.println("Structure de corpus en cours d'édition. Abandon.");
+//			return null;
+//		}
+		
+		System.out.println(Messages.SaveStructureAsGlozzModel_1+corpus);
+
+		if (!FichiersGlozz.exporterModeleGlozz(corpus.getStructure())) {
+			System.out.println(Messages.SaveStructureAsGlozzModel_2);
+			return null;
+		}
+
+		System.out.println(Messages.SaveStructureAsGlozzModel_3);
+		return null;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructureAsGlozzModel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadCorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadCorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadCorpus.java	(revision 1200)
@@ -0,0 +1,72 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.kohsuke.args4j.Option;
+import org.txm.Toolbox;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+import visuAnalec.util.Fichiers;
+import visuAnalec.util.Fichiers.Commande;
+
+public class LoadCorpus  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+
+	@Option(name="ecfile",usage="an example file", widget="File", required=true, def="text.ec")
+	File ecfile;
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.LoadCorpus_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+		
+		System.out.println(Messages.LoadCorpus_1);
+		
+		if (!ParametersDialog.open(this)) return null;
+
+		load(ecfile, corpus);
+		
+		return null;
+	}
+	
+	public static boolean load(File ecfile, Corpus corpus) {
+		if (!(ecfile.exists())) {
+			System.out.println(Messages.LoadCorpus_2);
+			return false;
+		}
+		File fichierCorpus = ecfile;
+		System.out.println(Messages.LoadCorpus_3+fichierCorpus);
+		if (!FichiersJava.ouvrirCorpus(corpus, fichierCorpus, false)) {
+			System.out.println(Messages.LoadCorpus_4);
+			return false;
+		}
+		
+		System.out.println(Messages.LoadCorpus_5);
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveVue.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveVue.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveVue.java	(revision 1200)
@@ -0,0 +1,49 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+
+public class SaveVue  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+	Corpus corpus;
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.SaveVue_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		corpus = AnalecCorpora.getCorpus(mainCorpus);
+
+		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
+		File fichierVue = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getID()+".ecv"); //$NON-NLS-1$ //$NON-NLS-2$
+		System.out.println(Messages.SaveVue_3+corpus+Messages.SaveVue_4+fichierVue);
+
+		if (!FichiersJava.enregistrerCorpus(corpus, fichierVue)) {
+			System.out.println(Messages.SaveVue_5);
+			return null;
+		}
+
+		return null;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveVue.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzAnnotations.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzAnnotations.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzAnnotations.java	(revision 1200)
@@ -0,0 +1,99 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.kohsuke.args4j.Option;
+import org.txm.annotation.urs.AnalecAnnotationReIndexer;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersGlozz;
+
+public class ImportGlozzAnnotations  extends AbstractHandler {
+
+
+
+	@Option(name="aafile",usage="an example file", widget="File", required=true, def="text.aa")
+	File aafile;
+
+	@Option(name="aamfile",usage="an example file", widget="File", required=true, def="model.aam")
+	File aamfile;
+
+	@Option(name="acfile",usage="an example file", widget="File", required=true, def="annotations.ac")
+	File acfile;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			// END OF PARAMETERS
+			
+			return doImport(aafile, aamfile, acfile);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	public static boolean doImport(File aafile, File aamfile, File acfile) throws CqiClientException, IOException, CqiServerError {
+		if (!(aafile.exists() && aafile.exists() && aafile.exists())) {
+			System.out.println(Messages.ImportGlozzAnnotations_0);
+			return false;
+		}
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.ImportGlozzAnnotations_1+first);
+			return false;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		Corpus analecCorpus = AnalecCorpora.getCorpus(mainCorpus);
+		analecCorpus.clearAll(); // remove all : annotations, structure
+		
+		System.out.println(Messages.ImportGlozzAnnotations_2+aamfile);
+		if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamfile)) {
+			System.out.println(Messages.ImportGlozzAnnotations_3);
+			return false;
+		}
+		
+		System.out.println(Messages.ImportGlozzAnnotations_4+acfile+Messages.ImportGlozzAnnotations_5+aafile);
+		if (!FichiersGlozz.importerGlozz(analecCorpus, acfile, aafile)) {
+			System.out.println(Messages.ImportGlozzAnnotations_6);
+			return false;
+		}
+		
+		System.out.println(Messages.ImportGlozzAnnotations_7);
+		AnalecAnnotationReIndexer aari = new AnalecAnnotationReIndexer(mainCorpus, analecCorpus);
+		if (!aari.process()) {
+			System.out.println(Messages.ImportGlozzAnnotations_8);
+			return false;
+		}
+		
+		System.out.println(Messages.ImportGlozzAnnotations_9);
+		AnalecCorpora.saveCorpus(analecCorpus);
+		
+		System.out.println(Messages.ImportGlozzAnnotations_10);
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzAnnotations.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportTEICorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportTEICorpus.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportTEICorpus.java	(revision 1200)
@@ -0,0 +1,97 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.kohsuke.args4j.Option;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.export.AnalecAnnotationTEIExporter;
+import org.txm.rcp.swt.widget.parameters.ParametersDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.vue.Vue;
+
+/**
+ * Export the Analec annotation of the selected Corpus
+ * 
+ * @author mdecorde
+ *
+ */
+public class ExportTEICorpus  extends AbstractHandler {
+
+	@Option(name="outputDirectory",usage="zip the result", widget="Folder", required=true, def="outputdir")
+	File outputDirectory;
+	@Option(name="createArchive",usage="zip the result", widget="Boolean", required=true, def="true")
+	boolean createArchive;
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		try {
+			// Open the parameters input dialog box
+			if (!ParametersDialog.open(this)) return null;
+
+			Object first = CorporaView.getFirstSelectedObject();
+			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+				System.out.println(Messages.ExportTEICorpus_0+first);
+				return null;
+			}
+			
+			final MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+			final Corpus analecCorpus = AnalecCorpora.getCorpus(mainCorpus);
+			final Vue vue = AnalecCorpora.getVue(mainCorpus);
+			outputDirectory.mkdirs();
+			JobHandler job = new JobHandler(mainCorpus.getName()+Messages.ExportTEICorpus_1) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						this.runInit(monitor);
+						if (!export(true, outputDirectory, createArchive, monitor, mainCorpus, analecCorpus, vue)) {
+							System.out.println(Messages.ExportTEICorpus_2);
+							return Status.CANCEL_STATUS;
+						} else {
+							return Status.OK_STATUS;
+						}
+					} catch (Exception e) {
+						System.out.println(Messages.ExportTEICorpus_3+e.getLocalizedMessage());
+						Log.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					}
+				}
+			};
+			job.schedule();
+			
+		} catch (Exception e) {
+			System.out.println(Messages.ExportTEICorpus_4+e);
+			Log.printStackTrace(e);
+		}
+		return null;
+	}
+	
+	public static boolean export(boolean standoffAnnotations, File outputDirectory, boolean createArchive, IProgressMonitor monitor, MainCorpus mainCorpus, Corpus analecCorpus, Vue vue) throws Exception {
+		String name = mainCorpus.getID();
+		File finalOutputDirectory = new File(outputDirectory, name);
+		int n = 2;
+		while (finalOutputDirectory.exists()) {
+			finalOutputDirectory = new File(outputDirectory, name+" ("+n+")"); //$NON-NLS-1$ //$NON-NLS-2$
+			n++;
+		}
+		finalOutputDirectory.mkdirs();
+		AnalecAnnotationTEIExporter exporter = new AnalecAnnotationTEIExporter(monitor, finalOutputDirectory, mainCorpus, analecCorpus, vue);
+		boolean ret = exporter.process(standoffAnnotations, createArchive);
+		
+		return ret;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportTEICorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructure.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructure.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructure.java	(revision 1200)
@@ -0,0 +1,52 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+
+public class SaveStructure  extends AbstractHandler {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.LoadAnnotationStructure"; //$NON-NLS-1$
+	/** The selection. */
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		Object first = CorporaView.getFirstSelectedObject();
+		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
+			System.out.println(Messages.SaveStructure_0+first);
+			return null;
+		}
+		
+		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
+		return save(mainCorpus);
+	}
+	
+	public static boolean save(MainCorpus mainCorpus) {
+		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
+
+		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
+		File fichierStructure = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getID()+".ecs"); //$NON-NLS-1$ //$NON-NLS-2$
+		System.out.println(Messages.SaveStructure_3+corpus+Messages.SaveStructure_4+fichierStructure);
+
+		if (!FichiersJava.enregistrerStructure(corpus, fichierStructure)) {
+			System.out.println(Messages.SaveStructure_5);
+			return false;
+		}
+
+		return true;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/SaveStructure.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java	(revision 1200)
@@ -0,0 +1,72 @@
+package org.txm.annotation.urs.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.osgi.framework.Version;
+import org.txm.Toolbox;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.preferences.AnalecPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.TxmPreferences;
+import org.txm.utils.BundleUtils;
+import org.txm.utils.logger.Log;
+
+/**
+ * Copy macros from bundle to TXM macro directory
+ * 
+ * @author mdecorde
+ *
+ */
+public class DoInstallStep  extends org.txm.rcp.commands.TxmCommand {
+
+	/** The ID. */
+	public static String ID = "org.txm.analec.commands.DoInstallStep"; //$NON-NLS-1$
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) {
+			install();
+			return null;
+	}
+	
+	public void install() {
+		
+		Log.info(Messages.DoInstallStep_2);
+		String saved = AnalecPreferences.getInstance().getString(AnalecPreferences.VERSION); //$NON-NLS-1$
+		Version currentVersion = BundleUtils.getBundleVersion("AnalecRCP"); //$NON-NLS-1$
+		
+		if (saved != null && saved.length() > 0) {
+			Version savedVersion = new Version(saved);
+			if (currentVersion.compareTo(savedVersion) <= 0) {
+				Log.info(Messages.DoInstallStep_5);
+				//System.out.println("No post-installation of Analec to do");
+				return; // nothing to do
+			}
+		}
+		System.out.println(Messages.DoInstallStep_6+currentVersion);
+		
+		File previousAnalecMacroDirectory = new File(Toolbox.getTxmHomePath(), Messages.DoInstallStep_7);
+		if (previousAnalecMacroDirectory.exists() && saved != null && saved.length() > 0) {
+			File back = new File(previousAnalecMacroDirectory.getParentFile(), "analec_"+saved); //$NON-NLS-1$
+			if (back.exists()) {
+				System.out.println(Messages.DoInstallStep_9+back.getAbsolutePath()+Messages.DoInstallStep_10);
+				return;
+			}
+			previousAnalecMacroDirectory.renameTo(back);
+			System.out.println(Messages.DoInstallStep_11+back.getAbsolutePath());
+		}
+		
+		File macroDirectory = new File(Toolbox.getTxmHomePath(), "scripts/macro/org/txm/macro"); //$NON-NLS-1$
+		if (!BundleUtils.copyFiles("AnalecRCP", "src", "org/txm/macro/", "analec", macroDirectory)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			System.out.println(Messages.DoInstallStep_17+macroDirectory.getAbsolutePath());
+			return;
+		}
+		
+		Log.warning(Messages.DoInstallStep_18);
+		AnalecPreferences.getInstance().put(AnalecPreferences.VERSION, currentVersion.toString());
+		return;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferencePage.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferencePage.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferencePage.java	(revision 1200)
@@ -0,0 +1,75 @@
+package org.txm.annotation.urs.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.txm.annotation.urs.Messages;
+import org.txm.rcp.Application;
+
+public class AnalecPreferencePage  extends FieldEditorPreferencePage
+implements IWorkbenchPreferencePage {
+	private BooleanFieldEditor analec_limit_scheme_field;
+	private BooleanFieldEditor prefix_autocompletion_field;
+	
+//	public static final String SELECTED_UNIT_COLOR = "selected_unit_color";
+//	private ColorFieldEditor selected_unit_color;
+//	public static final String HIGHLIGHTED_UNIT_COLOR = "hightlighted_unit_color";
+//	private ColorFieldEditor hightlighted_unit_color;
+	
+	ScopedPreferenceStore preferences;
+	public static final String COLOR_PALETTE = "color_palette"; //$NON-NLS-1$
+	
+	private RadioGroupFieldEditor color_palette;
+
+	public AnalecPreferencePage() {
+		super();
+		
+		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
+				Application.PLUGIN_ID);
+		setPreferenceStore(preferences);
+	}
+
+	/**
+	 * Creates the field editors. Field editors are abstractions of the common
+	 * GUI blocks needed to manipulate various types of preferences. Each field
+	 * editor knows how to save and restore itself.
+	 */
+	@Override
+	public void createFieldEditors() {
+		analec_limit_scheme_field = new BooleanFieldEditor(
+				AnalecPreferences.ANALEC_LIMIT_CORRECTION_SCHEME, Messages.AnalecPreferencePage_3,
+				getFieldEditorParent());
+		addField(analec_limit_scheme_field);
+		
+		prefix_autocompletion_field = new BooleanFieldEditor(
+				AnalecPreferences.PREFIX_AUTOCOMPLETION, Messages.AnalecPreferencePage_4,
+				getFieldEditorParent());
+		addField(prefix_autocompletion_field);
+		
+//		hightlighted_unit_color = new ColorFieldEditor(
+//				HIGHLIGHTED_UNIT_COLOR, "Highlighted units background color",
+//				getFieldEditorParent());
+//		addField(hightlighted_unit_color);
+//		
+//		
+//		selected_unit_color = new ColorFieldEditor(
+//				SELECTED_UNIT_COLOR, "Selected units background color",
+//				getFieldEditorParent());
+//		addField(selected_unit_color);
+		
+		String[][] values = {{"green","green"}, {"yellow","yellow"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		color_palette = new RadioGroupFieldEditor(COLOR_PALETTE, Messages.AnalecPreferencePage_9, 2, values, getFieldEditorParent());
+		addField(color_palette);
+		
+		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
+				Application.PLUGIN_ID);
+		setPreferenceStore(preferences);
+		setTitle("Analec"); //$NON-NLS-1$
+	}
+	
+	@Override
+	public void init(IWorkbench workbench) { }
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferences.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferences.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferences.java	(revision 1200)
@@ -0,0 +1,39 @@
+package org.txm.annotation.urs.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.preferences.RCPPreferences;
+
+public class AnalecPreferences extends TXMPreferences{
+	
+//	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(AnalecPreferences.class).getSymbolicName();
+	
+	public static final String VERSION = "analec.version"; //$NON-NLS-1$
+	public static final String COLOR_PALETTE = "color_palette";
+	public static final String PREFIX_AUTOCOMPLETION = "prefix_autocompletion"; //$NON-NLS-1$
+	public static final String ANALEC_LIMIT_CORRECTION_SCHEME = "analec_limit_correction_scheme"; //$NON-NLS-1$
+
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		Preferences preferences = DefaultScope.INSTANCE.getNode(getPreferencesNodeQualifier());
+		preferences.put(VERSION, "");
+		preferences.put(COLOR_PALETTE, "green");
+		preferences.putBoolean(ANALEC_LIMIT_CORRECTION_SCHEME, false);
+		preferences.putBoolean(PREFIX_AUTOCOMPLETION, false);
+	}
+	
+	/**
+	 * Gets the instance.
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance()	{
+		if (!TXMPreferences.instances.containsKey(AnalecPreferences.class)) {
+			new AnalecPreferences();
+		}
+		return TXMPreferences.instances.get(AnalecPreferences.class);
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/AnalecPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages.properties
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages.properties	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages.properties	(revision 1200)
@@ -0,0 +1,170 @@
+AnalecCorpora_3=Fail to open corpus file: 
+AnalecCorpora_4=Fail to create corpus file: 
+DoInstallStep_10=. Aborting
+DoInstallStep_11=Previous version of Analec macros are moved to: 
+DoInstallStep_17=Error while coping Analec org/txm/macro/analec in 
+DoInstallStep_18=Analec post-installation done.
+DoInstallStep_2=Analec.DoInstallStep.install()
+DoInstallStep_5=No post-installation of Analec to do
+DoInstallStep_6=Post-installing Analec version=
+DoInstallStep_7=scripts/macro/org/txm/macro/analec
+DoInstallStep_9=Analec previous macro backup directory already exists: 
+EditStructure_0=Selection is not a corpus: 
+ExportGlozzCorpus_0=Selection is not a main corpus: 
+ExportGlozzCorpus_1=\ Glozz export
+ExportGlozzCorpus_2=Canceled.
+ExportGlozzCorpus_3=Error while exporting annotations : 
+ExportGlozzCorpus_4=Error while exporting annotations : 
+ExportTEICorpus_0=Selection is not a corpus: 
+ExportTEICorpus_1=\ annotations export...
+ExportTEICorpus_2=Error while exporting corpus.
+ExportTEICorpus_3=Error while exporting corpus to XML-Analec: 
+ExportTEICorpus_4=Error while exporting annotations: 
+ImportGlozzAnnotations_0=The AA AAM and AC files must exists.
+ImportGlozzAnnotations_1=Selection is not a main corpus: 
+ImportGlozzAnnotations_10=Done.
+ImportGlozzAnnotations_2=Importing Glozz model from: 
+ImportGlozzAnnotations_3=error while importing Glozz model.
+ImportGlozzAnnotations_4=Importing Glozz corpus from: 
+ImportGlozzAnnotations_5=\ and 
+ImportGlozzAnnotations_6=error while importing Glozz corpus.
+ImportGlozzAnnotations_7=Reindexing annotations with TXM words
+ImportGlozzAnnotations_8=error while re-indexing Analec annotations.
+ImportGlozzAnnotations_9=Saving annotations.
+ImportGlozzCorpus_0=The glozzDirectory directory must exists.
+ImportGlozzCorpus_1=Creating source directory: $srcDir
+ImportGlozzCorpus_10=No .aa files found in 
+ImportGlozzCorpus_11=Importing Glozz data from: 
+ImportGlozzCorpus_15=Error while importing Glozz data.
+ImportGlozzCorpus_17=Could not create the TXT source file $txtFile
+ImportGlozzCorpus_19=ERROR: could not save import configuration: 
+ImportGlozzCorpus_22=Error: no script found for import name ${importName}: $script
+ImportGlozzCorpus_23=Error during import
+ImportGlozzCorpus_24=Finalize Analec corpus import
+ImportGlozzCorpus_25=Importing Glozz model from: 
+ImportGlozzCorpus_26=Error while importing Glozz model.
+ImportGlozzCorpus_27=Reindexing annotations with TXM words.
+ImportGlozzCorpus_28=error while re-indexing Analec annotations.
+ImportGlozzCorpus_29=Saving annotations.
+ImportGlozzCorpus_3=Creating ec directory: $ecDir
+ImportGlozzCorpus_30=Done.
+ImportGlozzCorpus_32=ERROR while finalizing corpus import: 
+ImportGlozzCorpus_4=Could not create the source directory $srcDir
+ImportGlozzCorpus_5=Could not create the ec directory $ecDir
+ImportGlozzCorpus_8=No .aa files found in 
+ImportGlozzCorpus_9=No .ac files found in 
+ImportTEIAnnotations_0=Selection is not a corpus: 
+ImportTEIAnnotations_1=\ annotations import...
+ImportTEIAnnotations_2=Error while importing annotations.
+ImportTEIAnnotations_3=Error while importing annotations: 
+ImportTEIAnnotations_4=Error while exporting annotations: 
+ImportTEIAnnotations_5=Done: 
+ImportTEIAnnotations_6=\ unites 
+ImportTEIAnnotations_7=\ relations 
+ImportTEIAnnotations_8=\ schemas.
+ImportTEICorpus_0=The XML files must exists: 
+ImportTEICorpus_11=ERROR: could not save import configuration: 
+ImportTEICorpus_14=Error: no script found for import name ${importName}: $script
+ImportTEICorpus_15=Error during import
+ImportTEICorpus_16=Finalize Analec corpus import
+ImportTEICorpus_18=Importing TEI model from: 
+ImportTEICorpus_19=Error while importing TEI model.
+ImportTEICorpus_2=Creating source directory: $srcDir
+ImportTEICorpus_20=Reindexing annotations with TXM words.
+ImportTEICorpus_21=error while re-indexing Analec annotations.
+ImportTEICorpus_22=Saving annotations.
+ImportTEICorpus_23=Done.
+ImportTEICorpus_24=Error while finalizing corpus import: 
+ImportTEICorpus_3=Could not create the source directory $srcDir
+ImportTEICorpus_5=Importing TEI data from: 
+ImportTEICorpus_7=Error while importing TEI data.
+ImportTEICorpus_9=Could not create the TXT source file $txtFile
+LoadCorpus_0=Selection is not a main corpus: 
+LoadCorpus_1=Loading corpus from file...
+LoadCorpus_2=The EC files must exists.
+LoadCorpus_3=Loading corpus from file: 
+LoadCorpus_4=Fail to load structure.
+LoadCorpus_5=Done: 
+LoadStructure_0=Selection is not a main corpus: 
+LoadStructure_1=Loading structure for corpus=
+LoadStructure_2=Fail to load structure.
+LoadStructure_3=Done: 
+LoadStructureFromGlozz_0=Selection is not a main corpus: 
+LoadStructureFromGlozz_1=Importing Glozz model for corpus=
+LoadStructureFromGlozz_2=The AAM file must exists.
+LoadStructureFromGlozz_3=Fail to load structure from Glozz model.
+LoadStructureFromGlozz_4=Done.
+LoadVue_0=Selection is not a main corpus: 
+LoadVue_1=Loading vue for corpus=
+LoadVue_2=Fail to load structure.
+LoadVue_3=Done: 
+SaveCorpus_0=Selection is not a main corpus: 
+SaveCorpus_1=\ in 
+SaveCorpus_3=Saving structure for corpus=
+SaveCorpus_5=Erreur lors de la sauvegarde du corpus.
+SaveStructure_0=Selection is not a main corpus: 
+SaveStructure_3=Saving structure for corpus=
+SaveStructure_4=\ in 
+SaveStructure_5=Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_0=Selection is not a main corpus: 
+SaveStructureAsGlozzModel_1=Saving structure as Glozz model for corpus=
+SaveStructureAsGlozzModel_2=Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_3=Done.
+SaveVue_0=Selection is not a main corpus: 
+SaveVue_3=Saving vue for corpus=
+SaveVue_4=\ in 
+SaveVue_5=Erreur lors de la sauvegarde de la vue.
+AnalecPreferencePage_3=Use Analec scheme to fix unit limits
+AnalecPreferencePage_4=Autocompletion search pattern of field is prefix (instead of infixe)
+AnalecPreferencePage_9=Unit highlight color palette
+AnnotationToolbar_0=No selection found. Aborting.
+AnnotationToolbar_6=Error: QueryResult matches size is 
+AnnotationToolbar_7=\ query was 
+UnitToolbar_10=Supprimer
+UnitToolbar_12=Corriger la limite gauche en cliquant sur un mot
+UnitToolbar_14=Corriger les limites gauche et droite avec une nouvelle s?lection de mot
+UnitToolbar_16=Corriger la limite droite en cliquant sur un mot
+UnitToolbar_27=You must select a word. Try again\!
+UnitToolbar_28=An error occured when updating unit limits with id=
+UnitToolbar_29=Select 
+UnitToolbar_3=** Could not retrieve 
+UnitToolbar_32=Select 
+UnitToolbar_4=\ size: 
+UnitToolbar_44=Creating unit with start=
+UnitToolbar_45=\ end=
+UnitToolbar_46=org.txm.analec.delete
+UnitToolbar_47=Delete unit 
+UnitToolbar_48=Do you really want to delete unit 
+UnitToolbar_49=\ ?
+UnitToolbar_5=Type d'unit? :
+UnitToolbar_50=Aborting annotation limit update
+UnitToolbar_51=Identifiants SelectionListener: 
+UnitToolbar_52=Types SelectionListener: 
+UnitToolbar_53=Reloading identifiants combo values.
+UnitToolbar_54=< type d'unit? >
+UnitToolbar_59=Error no word found for id=
+UnitToolbar_6=Type d'unit?
+UnitToolbar_60=Updating annotation limits: 
+UnitToolbar_61=\ -> 
+UnitToolbar_62=\ with word id=
+UnitToolbar_63=\ with pos=
+UnitToolbar_7=Type d'unit?
+UnitToolbar_8=Cr?er
+StartButton_0=Units
+StartButton_1=Schemas
+StartButton_10=), then call the Analec > Import Structure command
+StartButton_11=Save and close annotation tools: 
+StartButton_12=D?marrer l'annotation Analec
+StartButton_2=Saving analec annotations...
+StartButton_3=Saving analec annotations...
+StartButton_4=Error: corpus not saved.
+StartButton_5=Done.
+StartButton_6=You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+StartButton_7=), then call the Analec > Import Structure command
+StartButton_8=Save and close annotation tools: 
+StartButton_9=You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+NavigationField_0=<identifiant>
+NavigationField_2=Wrong unit ID: 
+NavigationField_3=Wrong unit ID: 
+NavigationField_4=Rechercher par les propri?t?s de ce type d'unit?
+NavigationField_5=<identifiant>

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java	(revision 1200)
@@ -0,0 +1,1192 @@
+package org.txm.annotation.urs.toolbar;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.util.Util;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.events.DragDetectListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.txm.annotation.rcp.editor.AnnotationExtension;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.preferences.AnalecPreferences;
+import org.txm.annotation.urs.view.ElementPropertiesView;
+import org.txm.annotation.urs.widgets.NavigationField;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.edition.rcp.editors.EditionPanel;
+import org.txm.edition.rcp.editors.RGBA;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Project;
+import org.txm.objects.Text;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.swt.dialog.ConfirmDialog;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.Message;
+import visuAnalec.Message.TypeMessage;
+import visuAnalec.donnees.Structure;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Unite;
+
+public class UnitToolbar extends URSAnnotationToolbar {
+
+	//boolean AnalecUnitLimitCorrectionScheme = TxmPreferences.getBoolean(AnalecPreferencePage.ANALEC_LIMIT_CORRECTION_SCHEME); // use Analec scheme to fix unit limits or TXM's
+
+	public RGBA highlighted_unit_color = new RGBA(183, 191, 237, 0.7f);
+	public RGBA selected_unit_color = new RGBA(255, 255, 0, 0.5f);
+
+	private Button createButton;
+	private Button deleteButton;
+	private Button editButton;
+
+	private KeyListener editorKeyListener;
+	private MouseListener editorMouseListener;
+	private int fixingAnnotationLimits = 0;
+	private NavigationField navigationField;
+	private Label l;
+	private MenuListener menuListener;
+	private List<String> previousSelectedTypeUnitIDS;
+
+	private List<String> previousSelectedUnitIDS;
+	protected boolean startFixingUnitLimit;
+	private Combo typeCombo;
+	private Unite[] unites;
+	private String[] typesUnitesAVoir;
+	private int maxCorpusPosition;
+
+	private DragDetectListener dragDetectListener;
+
+	private Button drop_b;
+	private Button editLeftButton;
+	private Button editRightButton;
+
+	public UnitToolbar() { }
+
+	@Override
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
+		super.install(txmeditor, extension, parent, position);
+		
+		annotationArea.getLayout().numColumns = 10;
+		annotationArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+
+		String color_palette = AnalecPreferences.getInstance().getString(AnalecPreferences.COLOR_PALETTE);
+		if ("yellow".equals(color_palette)) { //$NON-NLS-1$
+			this.highlighted_unit_color = URSAnnotationToolbar.lightyellow;
+			this.selected_unit_color = URSAnnotationToolbar.yellow;
+		} else if ("green".equals(color_palette)) { //$NON-NLS-1$
+			this.highlighted_unit_color = URSAnnotationToolbar.lightgreen;
+			this.selected_unit_color = URSAnnotationToolbar.green;
+		} else { // custom palette
+			//		String highlighted_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.HIGHLIGHTED_UNIT_COLOR, "255,255,176");
+			//		String selected_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.SELECTED_UNIT_COLOR, "255,255,96");
+			//		this.highlighted_unit_color = new RGBA(highlighted_unit_color_pref, 0.7f);
+			//		this.selected_unit_color = new RGBA(selected_unit_color_pref, 1f);
+		}
+
+		this.button = extension.getSaveButton();
+		this.maincorpus = this.editor.getCorpus().getMainCorpus();
+		try {
+			maxCorpusPosition = maincorpus.getSize();
+		} catch (Exception e) {
+			System.out.println(Messages.UnitToolbar_3+maincorpus+Messages.UnitToolbar_4+e.getLocalizedMessage());
+			Log.printStackTrace(e);
+		}
+		analecCorpus.addEventListener(this);
+
+
+		l = new Label(annotationArea, SWT.NONE);
+		l.setText(Messages.UnitToolbar_5);	
+		l.setToolTipText(Messages.UnitToolbar_6);
+		l.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
+
+		typeCombo = new Combo(annotationArea, SWT.NONE|SWT.READ_ONLY);
+		typeCombo.setToolTipText(Messages.UnitToolbar_7);
+		GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
+		gdata.minimumWidth = 100;
+		gdata.widthHint = 100;
+		typeCombo.setLayoutData(gdata);
+		typeCombo.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onTypecomboSelected(e);
+			}
+		});
+
+		navigationField = new NavigationField(this, SWT.NONE);
+		gdata = new GridData(GridData.FILL, GridData.CENTER, true, false);
+		navigationField.setLayoutData(gdata);
+		navigationField.addListener(SWT.Selection, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				onIdentifiantComboSelected(event);
+			}
+		});
+
+		//l = new Label(this, SWT.NONE);
+
+		createButton = new Button(annotationArea, SWT.PUSH);
+		createButton.setText(Messages.UnitToolbar_8);
+		gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
+		createButton.setLayoutData(gdata);
+		createButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onCreateButtonSelected(e);
+			}
+		});
+
+		deleteButton = new Button(annotationArea, SWT.PUSH);
+		gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
+		deleteButton.setLayoutData(gdata);
+		deleteButton.setImage(IImageKeys.getImage("platform:/plugin/org.txm.rcp/icons/cross.png")); //$NON-NLS-1$
+		deleteButton.setToolTipText(Messages.UnitToolbar_10);
+		deleteButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onDeleteComboSelected(e);
+			}
+		});
+
+		l = new Label(annotationArea, SWT.NONE);
+
+		editLeftButton = new Button(annotationArea, SWT.TOGGLE);
+		gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
+		editLeftButton.setLayoutData(gdata);
+		editLeftButton.setText("[ ↔"); //$NON-NLS-1$
+		editLeftButton.setToolTipText(Messages.UnitToolbar_12);
+		editLeftButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onEditButtonSelected(e,1);
+			}
+		});
+
+		editButton = new Button(annotationArea, SWT.TOGGLE);
+		editButton.setText("[↔]"); //$NON-NLS-1$
+		editButton.setToolTipText(Messages.UnitToolbar_14);
+		editButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onEditButtonSelected(e);
+			}
+		});
+
+		editRightButton = new Button(annotationArea, SWT.TOGGLE);
+		editRightButton.setText("↔ ]"); //$NON-NLS-1$
+		editRightButton.setToolTipText(Messages.UnitToolbar_16);
+		editRightButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onEditButtonSelected(e,2);
+			}
+		});
+
+		annotationArea.layout();
+		annotationArea.getParent().layout(true);
+		editor.layout(true);
+
+		reloadUnits(); // reloads types
+		reloadIdentifiants();
+
+		createButton.setEnabled(false);
+		deleteButton.setEnabled(false);
+		editButton.setEnabled(false);
+		editLeftButton.setEnabled(false);
+		editRightButton.setEnabled(false);
+
+		//drop_b.setEnabled(false);
+		if (typesUnitesAVoir.length > 0) {
+			typeCombo.select(1);
+			onTypecomboSelected(null);
+
+			testIfAwordSpanIsSelected();
+		}
+
+		ElementPropertiesView.openView();
+		editor.updateWordStyles();
+
+		return true;
+	}
+
+	public void clearHighlight() {
+		if (previousSelectedUnitIDS != null) {
+			if (editor.isDisposed()){
+				editor.removeHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
+				editor.removeFontWeightWordsById(previousSelectedUnitIDS);
+			}
+			previousSelectedUnitIDS = null; // release memory
+		}
+		if (previousSelectedTypeUnitIDS != null) {
+			editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
+			previousSelectedTypeUnitIDS = null; // release memory
+		}
+
+		if (!createButton.isDisposed()) createButton.setEnabled(false);
+		if (!deleteButton.isDisposed()) deleteButton.setEnabled(false);
+		if (!editButton.isDisposed()) editButton.setEnabled(false);
+		//drop_b.setEnabled(false);
+	}
+
+	public MouseListener getEditorClickListener() {
+		if (editorMouseListener != null) return editorMouseListener;
+		editorMouseListener = new MouseListener() {
+
+			boolean dblClick = false;
+			boolean debug = false;
+			private int t,x,y;
+
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {
+				if (debug) System.out.println("DOUBLE CLICK"); //$NON-NLS-1$
+				dblClick= true;
+
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+				String[] ids = panel.getWordSelection(); // may be null
+				//System.out.println("word id="+id);
+				//				if (id != null) {
+				//					org.txm.searchengine.cqp.corpus.Corpus c = UnitToolbar.this.editor.getCorpus();
+				//					try {
+				//						if (debug)  System.out.println(" HIGHLIGHTING ANNOT IF ANY AT "+id);
+				//						tryHighlightingWord(id,c );
+				//					} catch (Exception ex) {
+				//						ex.printStackTrace();
+				//					}
+				//				}
+
+				if (ids != null && typeCombo.getSelectionIndex() > 0 && typeCombo.getEnabled())
+					createButton.setEnabled(true); // there is a text selection in the browser
+			}
+
+			@Override
+			public void mouseDown(MouseEvent e) {
+				if (debug) System.out.println("MOUSE DOWN"); //$NON-NLS-1$
+				dblClick = false;
+				t = e.time;
+				x = e.x;
+				y = e.y;
+			}
+
+			@Override
+			public void mouseUp(MouseEvent e) {
+				if (dblClick) { // doucle click raised by mouseDoubleClick
+					dblClick = false;
+					return; // stop right now ! :-o
+				}
+				if (debug) System.out.println("MOUSE UP"); //$NON-NLS-1$
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+
+				if (typeCombo.getSelectionIndex() <= 0) {
+					createButton.setEnabled(false);
+					deleteButton.setEnabled(false);
+					editLeftButton.setEnabled(false);
+					editButton.setEnabled(false);
+					editRightButton.setEnabled(false);
+					//drop_b.setEnabled(false);
+					return; // nothing to do with annotations
+				}
+
+				// filter click that are not a left simple click (no drag)
+				//System.out.println("click count="+e.count+" button="+e.button+" time="+e.time+" diff="+(e.time-t)+" dist="+(Math.abs(e.x - x) + Math.abs(e.y - y)));
+				if (e.count > 1) {
+					if (debug) System.out.println(" DOUBLE CLICK"); //$NON-NLS-1$
+					//System.out.println("not a simple click");
+					return;
+				}
+
+				int dist = Math.abs(e.x - x) + Math.abs(e.y - y);
+				int deltat = (e.time-t);
+				//System.out.println("deltat ="+deltat);
+				if (dist != 0 && (deltat > 120 || dist > 4)) {
+					//System.out.println(" DRAG dist="+dist+" deltat="+deltat);
+
+					String[] ids = panel.getWordSelection(); // may be null
+
+					if (fixingAnnotationLimits== 3) { // fixing limit with a mouse drag an drop 
+						if (debug)  System.out.println(" EDITING ANNOTATION POSITION mode="+fixingAnnotationLimits); //$NON-NLS-1$
+						onFixingAnnotationLimits(ids);
+						return;
+					} else {
+
+						testIfAwordSpanIsSelected(ids);				
+
+						panel.expandSelectionTo(ids);
+						return;
+					}
+				}
+				if (e.button != 1) {
+					if (debug) System.out.println(" NO LEFT"); //$NON-NLS-1$
+					//System.out.println("not a left click");
+					return;
+				}
+				if ((e.time-t) > 200) {
+					if (debug) System.out.println(" LONG"); //$NON-NLS-1$
+					//System.out.println("not a short click");
+					return;
+				}
+
+				String[] ids = panel.getWordSelection(); // may be null
+
+				if (fixingAnnotationLimits > 0) {
+					if (debug)  System.out.println(" EDITING ANNOTATION POSITION mode="+fixingAnnotationLimits); //$NON-NLS-1$
+					onFixingAnnotationLimits(ids);
+					return;
+				}
+
+				if (ids == null) { // clear selection
+					if (debug)  System.out.println(" NO WORD SELECTION"); //$NON-NLS-1$
+					navigationField.setSelectionIndex(0); // clear selection
+
+					return;
+				}
+
+				org.txm.searchengine.cqp.corpus.CQPCorpus c = UnitToolbar.this.editor.getCorpus();
+
+				try {
+					if (debug) System.out.println(" HIGHLIGHTING ANNOT IF ANY AT "+ids[0]); //$NON-NLS-1$
+					if (tryHighlightingUnitsWord(ids[0],c )) {
+						editor.updateWordStyles();
+					} else { // a word have been clicked
+						testIfAwordSpanIsSelected(ids);		
+						panel.expandSelectionTo(ids);
+					}
+				} catch (Exception ex) {
+					ex.printStackTrace();
+				}
+			}
+		};
+		return editorMouseListener;
+	}
+
+	protected void testIfAwordSpanIsSelected() {
+		EditionPanel panel = editor.getEditionPanel(0);
+		if (panel == null) return;
+		String[] ids = panel.getWordSelection(); // may be null
+		testIfAwordSpanIsSelected(ids);
+	}
+
+	protected void testIfAwordSpanIsSelected(String[] ids) {
+		if (ids != null && typeCombo.getItemCount() > 1  && typeCombo.getEnabled() ) {
+			//System.out.println("ids:"+Arrays.toString(ids));
+			if (navigationField.getSelectionIndex() > 0) {
+				deleteButton.setEnabled(true);
+				editLeftButton.setEnabled(true);
+				editButton.setEnabled(true);
+				editRightButton.setEnabled(true);
+				//drop_b.setEnabled(true);
+			}
+
+			createButton.setEnabled(ids != null);
+		}	
+	}
+
+
+
+	protected void onFixingAnnotationLimits(String[] ids) {
+
+		if (ids == null || ids.length == 0) { System.out.println(Messages.UnitToolbar_27);return; }
+
+		boolean uniteFixed = false;
+		int i = navigationField.getSelectionIndex();
+		if (i > 0) {
+			Unite unite = unites[i-1];
+
+			try {
+				uniteFixed = updateUniteLimits(unite, ids, fixingAnnotationLimits);
+			} catch (CqiClientException e1) {
+				System.out.println(Messages.UnitToolbar_28+ids[0]);
+				Log.printStackTrace(e1);
+			}
+
+			editButton.setSelection(false);
+			editLeftButton.setSelection(false);
+			editRightButton.setSelection(false);
+			fixingAnnotationLimits = 0;
+			typeCombo.setEnabled(true);
+
+			navigationField.setEnabled(true);
+			createButton.setEnabled(true);
+			deleteButton.setEnabled(true);
+
+			if (uniteFixed) {
+				//button.setEnabled(analecCorpus.isModifie());
+				reloadIdentifiants();
+				highlightType();
+				//highlightUnite(unite, true);
+				navigationField.setSelectionIndex(i);
+				//updatePropertiesView(unite); // start-end may have changed
+				return;
+			}
+		}
+	}
+
+
+
+	public KeyListener getEditorKeyListener() {
+		if (editorKeyListener != null) return editorKeyListener;
+		editorKeyListener = new KeyListener() {
+
+			@Override
+			public void keyPressed(KeyEvent e) { }
+
+			@Override
+			public void keyReleased(KeyEvent e) {
+				int mask = SWT.CTRL;
+				if (Util.isMac()) mask = SWT.COMMAND;
+
+				if (((e.stateMask & mask) == mask)) {
+					if (e.keyCode == SWT.SPACE) { 
+						int i = navigationField.getSelectionIndex();
+						if (i > 0) {
+							onEditButtonSelected(null);
+						}
+					} else if (e.keyCode == SWT.ARROW_LEFT) {
+						selectPrevious();
+					} else if (e.keyCode == SWT.ARROW_RIGHT) {
+						selectNext();
+						//					} else if (e.keyCode == SWT.PAGE_UP) { // clash with Eclipse CTRL+PAGE_UP binding
+						//						select10Previous();
+						//					} else if (e.keyCode == SWT.PAGE_DOWN) { // clash with Eclipse CTRL+PAGE_DOWN binding
+						//						select10Next();
+					} else if (e.keyCode == SWT.END) {
+						selectLast();
+					} else if (e.keyCode == SWT.HOME) {
+						selectFirst();
+					}
+				} else {
+					if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { 
+						onCreateButtonSelected(null);
+					} else if (e.keyCode == SWT.DEL) { 
+						int i = navigationField.getSelectionIndex();
+						if (i > 0) {
+							onDeleteComboSelected(null);
+						}
+					}
+				}
+			}
+		};
+		return editorKeyListener;
+	}
+
+	public MenuListener getMenuListener() {
+
+		if (menuListener != null) return menuListener;
+
+		this.menuListener = new MenuListener() {
+
+			HashSet<MenuItem> entries = new HashSet<MenuItem>();
+
+			@Override
+			public void menuHidden(MenuEvent e) { }
+
+			@Override
+			public void menuShown(MenuEvent e) {
+
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+				Menu menu = panel.getBrowser().getMenu();
+
+				for (MenuItem item : entries) item.dispose(); 
+
+				String[] ids = panel.getWordSelection();
+				//System.out.println("Word under mouse: "+id);
+				if (ids != null && ids.length > 0) {
+					int[] startend = getSelectionStartEndWordPositions(); // get the word start end positions
+					ArrayList<Unite> unitEntries = new ArrayList<Unite>(); // stores units  covering the word
+					ArrayList<Integer> noEntries = new ArrayList<Integer>(); // stores units  covering the word
+					int i = 1;
+					for (Unite unit : unites) {
+						if (unit.getDeb() > startend[0]) break; // don't go further
+						if (unit.getFin() < startend[0]) continue;
+						unitEntries.add(unit);
+						noEntries.add(i);
+						i++;
+					}
+
+					if (unitEntries.size() > 0) {
+						MenuItem item = new MenuItem(menu, SWT.SEPARATOR);
+						entries.add(item);
+					}
+
+					for (i = 0 ; i < unitEntries.size() ; i++) {
+						final Unite unit = unitEntries.get(i);
+						final Integer unitNo = Arrays.binarySearch(unites, unit)+1;
+
+						MenuItem item = new MenuItem(menu, SWT.NONE);
+						AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+						try {
+							if (unit.getDeb() == unit.getFin()) {
+								String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[]{unit.getDeb()});
+								item.setText(Messages.UnitToolbar_29+unit.getType()+"-"+unitNo+ ":"+firstWords[0]); //$NON-NLS-2$ //$NON-NLS-3$
+							} else {
+								String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[]{unit.getDeb(), unit.getDeb()+1});
+								item.setText(Messages.UnitToolbar_32+unit.getType()+"-"+unitNo+ "="+firstWords[0]+" "+firstWords[1]+"..."); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+							}
+						} catch (Exception e1) {
+							e1.printStackTrace();
+						}
+						item.addSelectionListener(new SelectionListener() {
+							@Override
+							public void widgetDefaultSelected(SelectionEvent e) { }
+							@Override
+							public void widgetSelected(SelectionEvent e) {
+								selectUniteInIdentifants(unit);
+							}
+						});
+						entries.add(item);
+					}
+				}
+			}
+		};
+
+		return menuListener;
+	}
+
+	public String uniteToWords(Unite unit) {
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+		String[] firstWords = null;
+		try {
+			if (unit.getDeb() == unit.getFin()) {
+				firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[]{unit.getDeb()});
+			} else {
+				firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[]{unit.getDeb(), unit.getDeb()+1});
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return StringUtils.join(firstWords, " "); //$NON-NLS-1$
+	}
+
+	/**
+	 * Highlight units of the current page
+	 */
+	protected void highlightType() {
+		if (unites == null) return;
+
+		try {
+			Page page = editor.getEditionPanel(0).getCurrentPage();
+			Edition e = page.getEdition();
+			Page next = e.getNextPage(page);
+			String id = page.getWordId();
+			if (id == null || id.length() == 0) return;
+
+			int first_ids[] = CQPSearchEngine.getCqiClient().str2Id(maincorpus.getProperty("id").getQualifiedName(), new String[] {id}); //$NON-NLS-1$
+
+			if (first_ids.length == 0) return;
+			int first_id = first_ids[0];
+			if (first_id == -1) return;
+			
+			int last_ids[] = null;
+			if (next != null && next != page) {
+				String next_id = next.getWordId();
+				last_ids = CQPSearchEngine.getCqiClient().str2Id(maincorpus.getProperty("id").getQualifiedName(), new String[] {next_id}); //$NON-NLS-1$
+			}
+
+			int first_pos = CQPSearchEngine.getCqiClient().id2Cpos(maincorpus.getProperty("id").getQualifiedName(), first_id)[0];
+			int last_pos = Integer.MAX_VALUE;
+			if (last_ids != null && last_ids.length > 0) {
+				last_pos = CQPSearchEngine.getCqiClient().id2Cpos(maincorpus.getProperty("id").getQualifiedName(), last_ids[0])[0];
+			}
+
+			int n2 = 0;
+			for (int i = 0 ; i < unites.length ; i++) {
+				for (int p = unites[i].getDeb() ; p <= unites[i].getFin() ; p++) {
+					if (p >= first_pos && p <= last_pos) {
+						n2++;
+					}
+				}
+			}
+
+			int allpositions[] = new int[n2];
+			n2 = 0;
+			for (int i = 0 ; i < unites.length ; i++) {
+				for (int p = unites[i].getDeb() ; p <= unites[i].getFin() ; p++) {
+					if (p >= first_pos && p <= last_pos) {
+						allpositions[n2++] = p;
+					}
+				}
+			}
+
+			if (previousSelectedTypeUnitIDS != null) {
+				editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
+				editor.removeFontWeightWordsById(previousSelectedTypeUnitIDS);
+				previousSelectedTypeUnitIDS = null; // release memory
+			}
+			String ids2[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
+			previousSelectedTypeUnitIDS = Arrays.asList(ids2);
+
+			editor.addHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Highlight a unit and don't focus it
+	 * 
+	 * @param unite
+	 * @param focus if set the edition will focus ONE TIME on the unit
+	 */
+	private void highlightUnite(Unite unite, boolean focus, int clickedWordPosition) {
+		int start = unite.getDeb();
+		int end = unite.getFin();
+		//	System.out.println("HU: start="+start+" end="+end+" -> "+(end-start+1));
+		int len = end-start+1;
+		if (len < 0) {
+			System.out.println("Error: can not highlight unit="+unite+": start > end."); //$NON-NLS-1$ //$NON-NLS-2$
+			return;
+		}
+		int positions [] = new int[len]; // build the positions array for CQP
+		int n = 0;
+		for (int p = start ; p <= end ; p++) {
+			positions[n++] = p;
+		}
+
+		try {
+			if (previousSelectedUnitIDS != null) { // remove previous highlighted words
+				editor.removeHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
+				editor.removeFontWeightWordsById(previousSelectedUnitIDS);
+				previousSelectedUnitIDS = null; // release memory
+			}
+
+			String ids[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
+			//			System.out.println("Highlight words with ids="+Arrays.toString(ids));
+
+			//positions = new int[]{positions[0]};
+			Property text_id = maincorpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
+			int[] text_strucs = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+			String[] text_ids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
+
+			String firstWordId = ids[0];
+			String firstWordTextId = text_ids[0];
+			if (clickedWordPosition  >= 0 && clickedWordPosition < ids.length) {
+				firstWordId = ids[clickedWordPosition];
+				firstWordTextId = text_ids[clickedWordPosition];
+			}
+
+
+			EditionPanel panel = editor.getEditionPanel(0);
+			Edition e = panel.getEdition();
+			Project corpus = e.getText().getProject();
+			//			System.out.println("firstWordTextId="+firstWordTextId);
+			Text newText = corpus.getText(firstWordTextId); // get the new text
+			//			System.out.println("positions="+Arrays.toString(positions));
+			//			System.out.println("firstWordId="+firstWordId);
+			//			System.out.println("firstWordTextId="+firstWordTextId);
+			//			System.out.println("newText="+newText+" e="+e);
+			Edition newEdition = newText.getEdition(e.getName()); // get the edition of the new text
+			Page p = newEdition.getPageForWordId(firstWordId); // find out the page containing the word
+			//			System.out.println("page="+p+" current page="+panel.getCurrentPage());
+
+			previousSelectedUnitIDS = Arrays.asList(ids);
+			editor.addHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
+			editor.addFontWeightWordsById(EditionPanel.WEIGHT_BOLD, previousSelectedUnitIDS);
+
+			if (previousSelectedUnitIDS.size() > 0 && focus) editor.setFocusedWordID(previousSelectedUnitIDS.get(0));
+			//System.out.println("Word page= "+p+" current="+panel.getCurrentPage());
+			if (panel.getCurrentText() != newText) { // text changed
+				//System.out.println("TEXT CHANGED");
+				editor.setText(newText, false); // don't refresh right now
+				editor.goToPage(p.getName());
+			} else if (panel.getCurrentPage() != p) { // do we need to change page ?
+				editor.goToPage(p.getName());
+			} else { // just reload the page to highlight words
+				//System.out.println("NO CHANGE");
+			}
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
+	}
+
+	protected void onCreateButtonSelected(SelectionEvent e) {
+		//System.out.println("onCreateButtonSelected");
+		int[] startend = getSelectionStartEndWordPositions();
+		if (startend != null) {
+			Log.info(Messages.UnitToolbar_44+startend[0]+Messages.UnitToolbar_45+startend[1]);
+			Unite unite = UnitToolbar.this.vue.getCorpus().addUniteSaisie(typeCombo.getText(), startend[0], startend[1]);
+			Structure structure =  UnitToolbar.this.analecCorpus.getStructure();
+			for (String prop : unite.getProps().keySet())
+				unite.getProps().put(prop, structure.getValeurParDefaut(unite.getClass(), unite.getType(), prop));
+
+			reloadIdentifiants();
+			selectUniteInIdentifants(unite);
+			//highlightUnite(unite, true, -1);
+
+			deleteButton.setEnabled(true);
+			editLeftButton.setEnabled(true);
+			editButton.setEnabled(true);
+			editRightButton.setEnabled(true);
+			//drop_b.setEnabled(true);
+			//updatePropertiesView(unite, true);
+			setFocusInPropertiesView();
+			this.extension.getSaveButton().setEnabled(true);
+			editor.fireIsDirty();
+		}
+
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onDeleteComboSelected(SelectionEvent e) {
+		int i = navigationField.getSelectionIndex();
+		if (i <= 0) return;
+		//System.out.println("Delete unite at i="+i);
+		Unite unite = unites[i-1];
+
+		String id = navigationField.getText();
+
+		ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), Messages.UnitToolbar_46, Messages.UnitToolbar_47+id, Messages.UnitToolbar_48+id+Messages.UnitToolbar_49);
+		if (dialog.open() == ConfirmDialog.CANCEL) return;
+
+		//System.out.println("unite "+unite.toString());
+		UnitToolbar.this.vue.getCorpus().supUnite(unite);
+		reloadIdentifiants();
+
+		i = typeCombo.getSelectionIndex();
+		if (i > 0) {
+			highlightType();
+		}
+		this.extension.getSaveButton().setEnabled(true);
+		editor.fireIsDirty();
+
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onEditButtonSelected(SelectionEvent e) {
+		onEditButtonSelected(e, 3);
+	}
+
+	protected void onEditButtonSelected(SelectionEvent e, int mode) {
+		if (mode == 0) { // select unit, select words, click the edit button -> deprecated
+			int i = navigationField.getSelectionIndex();
+			if (i == -1) return;
+			//System.out.println("Delete unite at i="+i);
+			Unite unite = unites[i-1];
+			int[] startend = getSelectionStartEndWordPositions();
+			if (startend != null) {
+				analecCorpus.modifBornesUnite(unite, startend[0], startend[1]);
+				reloadIdentifiants();
+				highlightUnite(unite, false, -1);
+				updatePropertiesView(unite);
+			}
+		} else {
+			if (fixingAnnotationLimits > 0) { 
+				System.out.println(Messages.UnitToolbar_50);
+
+				typeCombo.setEnabled(true);
+				navigationField.setEnabled(true);
+				createButton.setEnabled(true);
+				deleteButton.setEnabled(true);
+				fixingAnnotationLimits = 0;
+			} else {
+				typeCombo.setEnabled(false);
+				navigationField.setEnabled(false);
+				createButton.setEnabled(false);
+				deleteButton.setEnabled(false);
+				fixingAnnotationLimits = mode;
+			}
+		}
+		this.extension.getSaveButton().setEnabled(true);
+		editor.fireIsDirty();
+		if (e != null) editor.updateWordStyles();
+	}
+
+	/**
+	 * called when the NavigationField changed its selection
+	 * @param e
+	 */
+	public void onIdentifiantComboSelected(Object e) {
+		Log.info(Messages.UnitToolbar_51+navigationField.getSelectionIndex());
+		int i = navigationField.getSelectionIndex();
+		if (i <= 0) {
+			if (previousSelectedUnitIDS != null) {
+				editor.removeHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
+				editor.removeFontWeightWordsById(previousSelectedUnitIDS);
+				previousSelectedUnitIDS = null; // release memory
+			}
+			highlightType();
+
+			clearPropertiesView(); // unload the selected element if any
+			createButton.setEnabled(false);
+			deleteButton.setEnabled(false);
+			editLeftButton.setEnabled(false);
+			editButton.setEnabled(false);
+			editRightButton.setEnabled(false);
+			//drop_b.setEnabled(false);
+			//navigationField.setSelectionIndex(i);
+		} else {
+			createButton.setEnabled(false);
+			deleteButton.setEnabled(true);
+			editLeftButton.setEnabled(true);
+			editButton.setEnabled(true);
+			editRightButton.setEnabled(true);
+			//drop_b.setEnabled(true);
+			//System.out.println("i="+i);
+			Unite unite = unites[i-1];
+			//System.out.println("unite="+unite);
+			//System.out.println("unite str="+uniteToWords(unite));
+			highlightUnite(unite, true, -1);
+
+			updatePropertiesView(unite);
+			deleteButton.setEnabled(true);
+			editLeftButton.setEnabled(true);
+			editButton.setEnabled(true);
+			editRightButton.setEnabled(true);
+			//drop_b.setEnabled(true);
+		}
+
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onTypecomboSelected(SelectionEvent e) {
+		Log.info(Messages.UnitToolbar_52+typeCombo.getSelectionIndex());
+		reloadIdentifiants();
+
+		if (typeCombo.getSelectionIndex() > 0) {
+			//String type = unitesAVoir[typeCombo.getSelectionIndex()-1];
+			highlightType();
+			navigationField.setEnabled(true);
+		} else {
+			clearHighlight();
+			navigationField.setEnabled(false);
+		}
+
+		createButton.setEnabled(false);
+		deleteButton.setEnabled(false);
+		editButton.setEnabled(false);
+		//drop_b.setEnabled(false);
+		if (e != null) editor.updateWordStyles();
+	}
+
+	/**
+	 * reload the identifiants combo
+	 * 
+	 * @param unite the unite to select, may be null
+	 */
+	public void reloadIdentifiants() {
+		Log.info(Messages.UnitToolbar_53);
+		String type0 = typeCombo.getText();
+		unites = vue.getUnitesAVoir(type0);
+		String[] identifiants = vue.getIdUnites(type0, unites);
+		navigationField.setIdentifiants(identifiants, type0, Unite.class);
+		navigationField.setSelectionIndex(0);
+	}
+
+	public void reloadUnits() {
+
+		typesUnitesAVoir = vue.getTypesUnitesAVoir();
+		String[] items = new String[typesUnitesAVoir.length +1];
+		System.arraycopy(typesUnitesAVoir, 0, items, 1, typesUnitesAVoir.length);
+		items[0] = Messages.UnitToolbar_54;
+		typeCombo.setItems(items);
+		if (items.length > 0) {
+			typeCombo.select(0);
+		}
+		typeCombo.layout();
+
+		onTypecomboSelected(null);
+	}
+
+	protected void selectUniteInIdentifants(Unite unite) {
+		for (int i = 0 ; i < unites.length ; i++) {
+			//System.out.println("VS "+unites[i]);
+			if (unites[i] == unite) {
+				navigationField.setSelectionIndex(i+1);
+				return; // no need to go further
+			}
+		}
+	}
+
+	public void setEnable(boolean enable) {
+		l.setEnabled(enable);
+		typeCombo.setEnabled(enable);
+		navigationField.setEnabled(enable);
+		createButton.setEnabled(enable);
+		deleteButton.setEnabled(enable);
+		editButton.setEnabled(enable);
+		editLeftButton.setEnabled(enable);
+		editRightButton.setEnabled(enable);
+		//drop_b.setEnabled(enable);
+	}
+
+	@Override
+	public void traiterEvent(Message e) {
+		if (annotationArea.isDisposed()) return;
+
+		if (e.getType().equals(TypeMessage.MODIF_STRUCTURE)) {
+			//System.out.println("UnitToolbar.traiterEvent: Update toolbar ");
+			UnitToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					setEnable(!analecCorpus.isVide());
+					//reloadUnits();
+				}
+			});
+		} else if (e.getType().equals(TypeMessage.MODIF_ELEMENT)) {
+			//System.out.println("UnitToolbar.traiterEvent: Update toolbar ");
+			UnitToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					//reloadUnits();
+				}
+			});
+		}
+	}
+
+	protected boolean tryHighlightingUnitsWord(String id, org.txm.searchengine.cqp.corpus.CQPCorpus c) throws CqiClientException {
+		EditionPanel panel = editor.getEditionPanel(0);
+		if (panel == null) return false;
+		if (id != null) {
+
+		}
+		QueryResult r = c.query(new CQLQuery("[_.text_id=\""+panel.getEdition().getText().getName()+"\" & id=\""+id+"\"]"), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		List<Match> matches = r.getMatches();
+		if (matches.size() == 0) {
+			System.out.println(Messages.UnitToolbar_59+id);
+			return false;
+		}
+		int start = matches.get(0).getStart();
+		//System.out.println("start="+start);
+		r.drop();
+		int i = 0;
+		ArrayList<Integer> matching_units = new ArrayList<Integer>();
+		for (Unite u : unites) {
+			if (u.getDeb() <= start &&  start <= u.getFin()) {
+				matching_units.add(i);
+			} else if (u.getDeb() > start) { // no need to search further
+				continue;
+			}
+			i++;
+		}
+
+		if (matching_units.size() > 0) {
+			// get index in matching_units of the current unit if any
+			int iUnite = matching_units.indexOf(navigationField.getSelectionIndex()-1);
+
+			if (iUnite == -1) iUnite = 0; // current unit is not present, take the first in matching_units
+			else iUnite = (iUnite+1)%matching_units.size(); // take the next unit in matching_units
+
+			iUnite = matching_units.get(iUnite); // get the real unit position in 'unites'
+			navigationField.setSelectionIndex(iUnite+1, false); // call onIndentifiantComboChanged(...)
+
+			createButton.setEnabled(false);
+			deleteButton.setEnabled(true);
+			editLeftButton.setEnabled(true);
+			editButton.setEnabled(true);
+			editRightButton.setEnabled(true);
+
+			Unite unite = unites[iUnite];
+			int offset = start-unite.getDeb(); // to select the right page when the unit words overlap with 2 pages
+			highlightUnite(unite, true, offset);
+
+			updatePropertiesView(unite);
+
+			return true;
+		}
+
+
+		navigationField.setSelectionIndex(0);
+
+		return false;
+	}
+
+	protected boolean updateUniteLimits(Unite unite, String[] ids, int mode) throws CqiClientException {
+
+		EditionPanel panel = UnitToolbar.this.editor.getEditionPanel(0);
+		String text_name = panel.getEdition().getText().getName();
+
+		int[] startend = getStartEndWordPositions(maincorpus, ids, text_name);
+		if (startend == null) return false;
+
+		int pos = startend[0];
+		Log.warning(Messages.UnitToolbar_60+unite.getDeb()+Messages.UnitToolbar_61+unite.getFin()+Messages.UnitToolbar_62+ids+Messages.UnitToolbar_63+pos);
+
+		if (mode == 1) { // left
+			analecCorpus.modifBornesUnite(unite, pos, unite.getFin());
+		} else if (mode == 2) { // right
+			analecCorpus.modifBornesUnite(unite, unite.getDeb(), pos);
+		} else if (mode == 3) { // choose using distance
+			analecCorpus.modifBornesUnite(unite, startend[0], startend[1]);
+		}
+
+		return true;
+	}
+
+	public void selectNext() {
+		int i = navigationField.selectNext();
+	}
+
+	public void selectPrevious() {
+		int i = navigationField.selectPrevious();
+	}
+
+	@Override
+	public void selectFirst() {
+		int i = navigationField.selectFirst();
+	}
+
+	@Override
+	public void select10Previous() {
+		int i = navigationField.select10Previous();
+	}
+
+	@Override
+	public void select10Next() {
+		int i = navigationField.select10Next();
+	}
+
+	@Override
+	public void selectLast() {
+		int i = navigationField.selectLast();
+	}
+
+	@Override
+	public void select(Element currentElement) {
+		if (currentElement.getClass() == Unite.class) {
+			int i = Arrays.binarySearch(unites, currentElement);
+			if (i >= 0) navigationField.setSelectionIndex(i+1);
+		}
+	}
+
+	@Override
+	public String getElementType() {
+		if (typeCombo.isDisposed()) return ""; //$NON-NLS-1$
+		return typeCombo.getText();
+	}
+
+	@Override
+	public void onBackToText(Text text, String id) {
+		if (id.length() > 0) {
+			try {
+				tryHighlightingUnitsWord(id, this.getCQPCorpus());
+			} catch (CqiClientException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	@Override
+	public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
+		return Text.class;
+	}
+
+	@Override
+	public boolean save() {
+		//System.out.println("Saving Analec annotation...");
+		if (AnalecCorpora.saveCorpus(analecCorpus)) {
+			this.extension.getSaveButton().setEnabled(false);
+			return true;
+		}
+		return false;
+	}
+
+	@Override
+	public String getName() {
+		return "Unit";
+	}
+
+	@Override
+	public boolean notifyStartOfCompute() throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean notifyEndOfCompute() throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void notifyEndOfRefresh() throws Exception {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void notifyStartOfCreatePartControl() throws Exception {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void notifyStartOfRefresh() throws Exception {
+		// TODO Auto-generated method stub
+
+	}
+
+	ProgressListener pageProgressListener = null;
+	@Override
+	protected ProgressListener getPageReloadListener() {
+		if (pageProgressListener != null) {
+			return pageProgressListener;
+		}
+
+		pageProgressListener = new ProgressListener() {
+
+			@Override
+			public void completed(ProgressEvent event) {
+				if (typeCombo.getSelectionIndex() >= 0) {
+					highlightType();
+				}
+			}
+
+			@Override
+			public void changed(ProgressEvent event) { }
+		};
+		return pageProgressListener;
+	}
+
+	@Override
+	public boolean needToUpdateIndexes() {
+		return false;
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/SchemaToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/SchemaToolbar.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/SchemaToolbar.java	(revision 1200)
@@ -0,0 +1,1007 @@
+package org.txm.annotation.urs.toolbar;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.jface.util.Util;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.txm.annotation.rcp.editor.AnnotationExtension;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.preferences.AnalecPreferences;
+import org.txm.annotation.urs.view.ElementPropertiesView;
+import org.txm.annotation.urs.widgets.NavigationField;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.edition.rcp.editors.EditionPanel;
+import org.txm.edition.rcp.editors.RGBA;
+import org.txm.edition.rcp.editors.SynopticEditionEditor;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Project;
+import org.txm.objects.Text;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.swt.dialog.ConfirmDialog;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.Message;
+import visuAnalec.Message.TypeMessage;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Schema;
+import visuAnalec.elements.Unite;
+
+public class SchemaToolbar extends URSAnnotationToolbar {
+
+	public RGBA highlighted_unit_color = new RGBA(183, 191, 237, 0.7f);
+	public RGBA selected_unit_color = new RGBA(255, 255, 0, 0.5f);
+	
+	//	private Button createButton;
+	private Button deleteSchemaButton;
+	private Button deleteUniteButton;
+	//	private Button editButton;
+	private KeyListener editorKeyListener;
+	private MouseListener editorMouseListener;
+	private Label l;
+	private MenuListener menuListener;
+
+//	private List<String> previousSelectedTypeSchemaIDS;
+	private List<String> previousSelectedSchemaIDS;
+	private List<String> previousSelectedUniteIDS;
+
+	protected boolean startFixingUnitLimit;
+
+	private Schema[] schemas;
+	private Unite[] unites;
+	private String[] schemasAVoir;
+	private Combo typeCombo;
+	private NavigationField navigationField;
+	//	private Combo unitTypeCombo;
+	private NavigationField subNavigationField;
+
+	public SchemaToolbar() { }
+
+	@Override
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
+		super.install(txmeditor, extension, parent, position);
+		
+		annotationArea.getLayout().numColumns = 7;
+		annotationArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+		String color_palette = AnalecPreferences.getInstance().getString(AnalecPreferences.COLOR_PALETTE);
+		if ("yellow".equals(color_palette)) { //$NON-NLS-1$
+			this.highlighted_unit_color = URSAnnotationToolbar.lightyellow;
+			this.selected_unit_color = URSAnnotationToolbar.yellow;
+		} else if ("green".equals(color_palette)) { //$NON-NLS-1$
+			this.highlighted_unit_color = URSAnnotationToolbar.lightgreen;
+			this.selected_unit_color = URSAnnotationToolbar.green;
+		} else { // custom palette
+			//		String highlighted_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.HIGHLIGHTED_UNIT_COLOR, "255,255,176");
+			//		String selected_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.SELECTED_UNIT_COLOR, "255,255,96");
+			//		this.highlighted_unit_color = new RGBA(highlighted_unit_color_pref, 0.7f);
+			//		this.selected_unit_color = new RGBA(selected_unit_color_pref, 1f);
+		}
+		
+		this.editor = (SynopticEditionEditor) txmeditor;
+		analecCorpus.addEventListener(this);
+
+		l = new Label(annotationArea, SWT.NONE);
+		l.setText("Type de schéma : ");
+		l.setToolTipText("Type de schéma");
+
+		this.maincorpus = this.editor.getCorpus().getMainCorpus();
+		typeCombo = new Combo(annotationArea, SWT.NONE|SWT.READ_ONLY);
+		typeCombo.setToolTipText("Type de schéma");
+		GridData gdata = new GridData(GridData.FILL, GridData.CENTER, false, false);
+		gdata.minimumWidth = 100;
+		gdata.widthHint = 100;
+		typeCombo.setLayoutData(gdata);
+		typeCombo.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onTypeComboSelected(e);
+			}
+		});
+
+		navigationField = new NavigationField(this, SWT.NONE);
+		gdata = new GridData(GridData.FILL, GridData.FILL, true, false);
+		navigationField.setLayoutData(gdata);
+		navigationField.addListener(SWT.Selection, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				onIdentifiantComboSelected(null);
+			}
+		});
+
+		deleteSchemaButton = new Button(annotationArea, SWT.PUSH);
+		deleteSchemaButton.setImage(IImageKeys.getImage("platform:/plugin/org.txm.rcp/icons/cross.png")); //$NON-NLS-1$
+		deleteSchemaButton.setToolTipText("Supprimer le schéma");
+		deleteSchemaButton.setEnabled(false);
+		deleteSchemaButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onDeleteSchemaComboSelected(e);
+			}
+		});
+
+		l = new Label(annotationArea, SWT.NONE);
+		l.setText("Unités :");
+		subNavigationField = new NavigationField(this, SWT.NONE);
+		gdata = new GridData(GridData.FILL, GridData.FILL, true, false);
+		subNavigationField.setLayoutData(gdata);
+		subNavigationField.addListener(SWT.Selection, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				onIdentifiantUniteComboSelected(event);
+			}
+		});
+
+		deleteUniteButton = new Button(annotationArea, SWT.PUSH);
+		deleteUniteButton.setImage(IImageKeys.getImage("platform:/plugin/org.txm.rcp/icons/cross.png")); //$NON-NLS-1$
+		deleteUniteButton.setToolTipText("Supprimer l'unité de la chaîne");
+		deleteUniteButton.setEnabled(false);
+		deleteUniteButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				onDeleteUniteComboSelected(e);
+			}
+		});
+
+		annotationArea.layout();
+		annotationArea.getParent().layout(true);
+		editor.getEditionArea().layout();
+
+		reloadTypeSchemas(); // reloads ids also
+		reloadIdentifiants();
+		
+		if (schemasAVoir.length > 0) {
+			typeCombo.select(1);
+			onTypeComboSelected(null);
+
+			testIfAwordSpanIsSelected();
+			
+//			if (schemas.length > 0) {
+//				navigationField.selectFirst();
+//				onIdentifiantComboSelected(null);
+//			}
+		}
+
+		//		createButton.setEnabled(false);
+		//deleteSchemaButton.setEnabled(false);
+		//		editButton.setEnabled(false);
+		editor.updateWordStyles();
+		ElementPropertiesView.openView();
+		
+		return true;
+	}
+	
+	protected void testIfAwordSpanIsSelected() {
+		EditionPanel panel = editor.getEditionPanel(0);
+		if (panel == null) return;
+		String[] ids = panel.getWordSelection(); // may be null
+		testIfAwordSpanIsSelected(ids);
+	}
+
+	protected void testIfAwordSpanIsSelected(String[] ids) {
+		if (ids != null && typeCombo.getItemCount() > 1  && typeCombo.getEnabled() ) {
+			//System.out.println("ids:"+Arrays.toString(ids));
+			if (navigationField.getSelectionIndex() > 0) {
+				deleteSchemaButton.setEnabled(true);
+			}
+		}	
+	}
+
+	public void clearSchemasHighlight() {
+		//System.out.println("clear: "+previousSelectedSchemaIDS);
+		if (previousSelectedSchemaIDS != null) {
+			editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
+			editor.removeFontWeightWordsById(previousSelectedSchemaIDS);
+			previousSelectedSchemaIDS = null; // release memory
+		}
+//		if (previousSelectedTypeSchemaIDS != null) {
+//			editor.removeHighlightWordsById(lightblue, previousSelectedTypeSchemaIDS);
+//			previousSelectedTypeSchemaIDS = null; // release memory
+//		}
+	}
+
+
+	public void clearUnitesHighlight() {
+		if (previousSelectedUniteIDS != null) {
+			editor.removeHighlightWordsById(selected_unit_color, previousSelectedUniteIDS);
+			editor.removeFontWeightWordsById(previousSelectedUniteIDS);
+			previousSelectedUniteIDS = null; // release memory
+		}
+
+		if (!deleteUniteButton.isDisposed()) deleteUniteButton.setEnabled(false);
+	}
+
+	public MouseListener getEditorClickListener() {
+		if (1 +1 == 2) return null;
+		if (editorMouseListener != null) return editorMouseListener;
+		editorMouseListener = new MouseListener() {
+
+			boolean dblClick = false;
+			boolean debug = false;
+			private int t,x,y;
+
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {
+				if (debug) System.out.println("DOUBLE CLICK"); //$NON-NLS-1$
+				dblClick= true;
+
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+				String[] ids = panel.getWordSelection(); // may be null
+				//System.out.println("word id="+id);
+				//				if (id != null) {
+				//					org.txm.searchengine.cqp.corpus.Corpus c = SchemaToolbar.this.editor.getCorpus();
+				//					try {
+				//						if (debug)  System.out.println(" HIGHLIGHTING ANNOT IF ANY AT "+id);
+				//						tryHighlightingWord(id,c );
+				//					} catch (Exception ex) {
+				//						ex.printStackTrace();
+				//					}
+				//				}
+
+				//				if (id != null && typeCombo.getSelectionIndex() > 0 && typeCombo.getEnabled())
+				//					createButton.setEnabled(true); // there is a text selection in the browser
+			}
+
+			@Override
+			public void mouseDown(MouseEvent e) {
+				if (debug) System.out.println("MOUSE DOWN"); //$NON-NLS-1$
+				dblClick = false;
+				t = e.time;
+				x = e.x;
+				y = e.y;
+			}
+
+			@Override
+			public void mouseUp(MouseEvent e) {
+				if (dblClick) { // doucle click raised by mouseDoubleClick
+					dblClick = false;
+					return; // stop right now ! :-o
+				}
+				if (debug) System.out.println("MOUSE UP"); //$NON-NLS-1$
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+
+				if (typeCombo.getSelectionIndex() <= 0) {
+					//					createButton.setEnabled(false);
+					deleteSchemaButton.setEnabled(false);
+					//					editButton.setEnabled(false);
+					return; // nothing to do with annotations
+				}
+
+				// filter click that are not a left simple click (no drag)
+				//System.out.println("click count="+e.count+" button="+e.button+" time="+e.time+" diff="+(e.time-t)+" dist="+(Math.abs(e.x - x) + Math.abs(e.y - y)));
+				if (e.count > 1) {
+					if (debug) System.out.println(" DOUBLE CLICK"); //$NON-NLS-1$
+					//System.out.println("not a simple click");
+					return;
+				}
+
+				if (Math.abs(e.x - x) + Math.abs(e.y - y) > 7) {
+					if (debug) System.out.println(" DRAG"); //$NON-NLS-1$
+
+					String[] ids = panel.getWordSelection(); // may be null
+					if (ids != null && ids.length > 0 && typeCombo.getItemCount() > 1  && typeCombo.getEnabled() ) {
+
+						if (navigationField.getSelectionIndex() > 0 && ids[0] != null) {
+							deleteSchemaButton.setEnabled(true);
+							//							editButton.setEnabled(true);
+						}
+						//						
+						//						createButton.setEnabled(id != null);
+					}
+					//panel.getBrowser().forceFocus();
+					// extend selection to word boundaries
+					//					String id = panel.getWordSelection(); // may be null
+					//					if (id != null) {
+					//						panel.expandSelectionTo(id);
+					//					}
+					return;
+				}
+				if (e.button != 1) {
+					if (debug) System.out.println(" NO LEFT"); //$NON-NLS-1$
+					//System.out.println("not a left click");
+					return;
+				}
+				if ((e.time-t) > 150) {
+					if (debug) System.out.println(" LONG"); //$NON-NLS-1$
+					//System.out.println("not a short click");
+					return;
+				}
+
+				String[] ids = panel.getWordSelection(); // may be null
+
+				if (ids == null) { // clear selection
+					if (debug)  System.out.println(" NO WORD SELECTION"); //$NON-NLS-1$
+					//					navigationField.setSelectionIndex(0); // clear selection
+					//					onIdentifiantComboSelected(null);
+					return;
+				}
+
+				org.txm.searchengine.cqp.corpus.CQPCorpus c = SchemaToolbar.this.editor.getCorpus();
+
+				try {
+					if (debug)  System.out.println(" HIGHLIGHTING ANNOT IF ANY AT "+ids[0]); //$NON-NLS-1$
+					tryHighlightingWord(ids[0],c );
+				} catch (Exception ex) {
+					ex.printStackTrace();
+				}
+			}
+		};
+		return editorMouseListener;
+	}
+
+	public KeyListener getEditorKeyListener() {
+		if (editorKeyListener != null) return editorKeyListener;
+		editorKeyListener = new KeyListener() {
+
+			@Override
+			public void keyPressed(KeyEvent e) { }
+
+			@Override
+			public void keyReleased(KeyEvent e) {
+				//System.out.println("Key: "+e.keyCode);
+				int mask = SWT.CTRL;
+				if (Util.isMac()) mask = SWT.COMMAND;
+
+				//				if ((e.stateMask & SWT.ALT) == SWT.ALT) {
+				//					if (e.keyCode == SWT.ARROW_UP) {
+				//						selectPreviousUnite();
+				//					} else if (e.keyCode == SWT.ARROW_DOWN) {
+				//						selectNextUnite();
+				//					} else if (e.keyCode == SWT.HOME) {
+				//						selectFirstUnite();
+				//					} else if (e.keyCode == SWT.END) {
+				//						selectLastUnite();
+				//					}
+				//				} else 
+				if (((e.stateMask & mask) == mask)) {
+					if (e.keyCode == SWT.ARROW_UP) {
+						selectPrevious();
+					} else if (e.keyCode == SWT.ARROW_DOWN) {
+						selectNext();
+					} else if (e.keyCode == SWT.HOME) {
+						selectFirst();
+					} else if (e.keyCode == SWT.END) {
+						selectLast();
+					}
+				}
+			}
+		};
+		return editorKeyListener;
+	}
+
+	public MenuListener getMenuListener() {
+		if (1 +1 == 2) return null;
+		if (menuListener != null) return menuListener;
+
+		this.menuListener = new MenuListener() {
+
+			HashSet<MenuItem> entries = new HashSet<MenuItem>();
+
+			@Override
+			public void menuHidden(MenuEvent e) { }
+
+			@Override
+			public void menuShown(MenuEvent e) {
+
+				EditionPanel panel = editor.getEditionPanel(0);
+				if (panel == null) return;
+				Menu menu = panel.getBrowser().getMenu();
+
+				for (MenuItem item : entries) item.dispose(); 
+
+				int[] startend = getSelectionStartEndWordPositions(); 
+				//System.out.println("Word under mouse: "+id);
+				if (startend != null && startend.length == 2) {
+					// get the word start end positions
+					ArrayList<Unite> unitEntries = new ArrayList<Unite>(); // stores units  covering the word
+					ArrayList<Integer> noEntries = new ArrayList<Integer>(); // stores units  covering the word
+					int i = 1;
+					Unite[] unites = schemas[navigationField.getSelectionIndex()-1].getUnitesSousjacentes();
+					for (Unite unit : unites) {
+						if (unit.getDeb() > startend[0]) break; // don't go further
+						if (unit.getFin() < startend[0]) continue;
+						unitEntries.add(unit);
+						noEntries.add(i);
+						i++;
+					}
+
+					if (unitEntries.size() > 0) {
+						MenuItem item = new MenuItem(menu, SWT.SEPARATOR);
+						entries.add(item);
+					}
+
+					for (i = 0 ; i < unitEntries.size() ; i++) {
+						final Unite unit = unitEntries.get(i);
+						final Integer unitNo = Arrays.binarySearch(unites, unit)+1;
+
+						MenuItem item = new MenuItem(menu, SWT.NONE);
+						item.setText("Select "+unit.getType()+"-"+unitNo);
+						item.addSelectionListener(new SelectionListener() {
+							@Override
+							public void widgetDefaultSelected(SelectionEvent e) { }
+							@Override
+							public void widgetSelected(SelectionEvent e) {
+								highlightUnite(unit);
+								updatePropertiesView(unit);
+							}
+						});
+						entries.add(item);
+					}
+				}
+			}
+		};
+
+		return menuListener;
+	}
+
+	protected void highlightType() {
+		
+		if (schemas == null) return;
+		if (schemas.length == 0) return;
+
+		// highlight all units of all schemas ? -> too much
+		
+	}
+
+	protected void highlightSchema(Schema schema) {
+		//clearHighlight();
+
+		unites = schema.getUnitesSousjacentes();
+
+		if (unites == null) return;
+		if (unites.length > 0) {
+
+			Unite unite0 = schema.getUnite0();
+			int n2 = 0;
+			for (int i = 0 ; i < unites.length ; i++) {
+				for (int p = unites[i].getDeb() ; p <= unites[i].getFin() ; p++) {
+					n2++;
+				}
+			}
+			int allpositions[] = new int[n2];
+			n2 = 0;
+			for (int i = 0 ; i < unites.length ; i++) {
+				for (int p = unites[i].getDeb() ; p <= unites[i].getFin() ; p++) {
+					allpositions[n2++] = p;
+				}
+			}
+
+			org.txm.searchengine.cqp.corpus.CQPCorpus c = SchemaToolbar.this.editor.getCorpus();
+			try {
+				if (previousSelectedSchemaIDS != null) {
+					editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
+					previousSelectedSchemaIDS = null; // release memory
+				}
+				String ids2[] = CQPSearchEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
+				previousSelectedSchemaIDS = Arrays.asList(ids2);
+
+				editor.addHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	private void highlightUnite(Unite unite) {
+		int start = unite.getDeb();
+		int end = unite.getFin();
+		int positions [] = new int[end-start+1];
+		int n = 0;
+		for (int p = start ; p <= end ; p++) {
+			positions[n++] = p;
+		}
+		org.txm.searchengine.cqp.corpus.CQPCorpus c = SchemaToolbar.this.editor.getCorpus();
+
+		try {
+			if (previousSelectedUniteIDS != null) {
+				editor.removeHighlightWordsById(selected_unit_color, previousSelectedUniteIDS);
+				editor.removeFontWeightWordsById(previousSelectedUniteIDS);
+				previousSelectedUniteIDS = null; // release memory
+			}
+
+			String ids[] = CQPSearchEngine.getCqiClient().cpos2Str(c.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
+			//System.out.println("Highlight words with ids="+Arrays.toString(ids));
+
+			positions = new int[]{positions[0]};
+			Property text_id = c.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
+			int[] text_strucs = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+			String[] text_ids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
+
+			String firstWordId = ids[0];
+			String firstWordTextId = text_ids[0];
+
+			EditionPanel panel = editor.getEditionPanel(0);
+			Edition e = panel.getEdition();
+			Project corpus = e.getText().getProject();
+			Text newText = corpus.getText(firstWordTextId); // get the new text
+			Edition newEdition = newText.getEdition(e.getName()); // get the edition of the new text
+			Page p = newEdition.getPageForWordId(firstWordId); // find out the page containing the word
+
+			previousSelectedUniteIDS = Arrays.asList(ids);
+//			System.out.println("HU: "+previousSelectedUniteIDS);
+			editor.addHighlightWordsById(selected_unit_color, previousSelectedUniteIDS);
+			editor.addFontWeightWordsById(EditionPanel.WEIGHT_BOLD, previousSelectedUniteIDS);
+			
+			if (previousSelectedUniteIDS.size() > 0)	editor.setFocusedWordID(previousSelectedUniteIDS.get(0));
+			//System.out.println("Word page= "+p+" current="+panel.getCurrentPage());
+			if (panel.getCurrentText() != newText) { // text changed
+				//System.out.println("TEXT CHANGED");
+				editor.setText(newText, false); // don't refresh right now
+			} else if (panel.getCurrentPage() != p) { // do we need to change page ?
+				//System.out.println("PAGE CHANGED");
+				editor.goToPage(p.getName());
+			} else { // just reload the page to highlight words
+				//editor.updateWordStyles();
+			}
+			
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
+	}
+
+	protected void onDeleteSchemaComboSelected(SelectionEvent e) {
+		int iSchema = navigationField.getSelectionIndex();
+		if (iSchema <= 0) return;
+		//System.out.println("Delete unite at i="+i);
+		Schema schema = schemas[iSchema-1];
+
+		String id = navigationField.getText();
+
+		ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), "org.txm.analec.delete", "Delete unit "+id, "Do you really want to delete schema "+id+" ?"); //$NON-NLS-1$
+		if (dialog.open() == ConfirmDialog.CANCEL) return;
+
+		//System.out.println("unite "+unite.toString());
+		SchemaToolbar.this.vue.getCorpus().supSchema(schema);
+		maincorpus.setIsModified(true);
+		reloadIdentifiants();
+		onIdentifiantComboSelected(null);
+
+		if (typeCombo.getSelectionIndex() > 0) {
+			highlightType(); // reload other unit highlight
+		}
+		editor.fireIsDirty();
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onDeleteUniteComboSelected(SelectionEvent e) {
+		int iSchema = navigationField.getSelectionIndex();
+		if (iSchema <= 0) return;
+		//System.out.println("Delete unite at i="+i);
+		Schema schema = schemas[iSchema-1];
+
+		int i = subNavigationField.getSelectionIndex();
+		if (i <= 0) return;
+		//System.out.println("Delete unite at i="+i);
+		Unite unite = unites[i-1];
+
+		String id = subNavigationField.getText();
+
+		ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), "org.txm.analec.delete", "Delete unit "+id, "Do you really want to delete unit "+id+" from the schema?"); //$NON-NLS-1$
+		if (dialog.open() == ConfirmDialog.CANCEL) return;
+
+		//System.out.println("unite "+unite.toString());
+		SchemaToolbar.this.vue.getCorpus().supUnite(unite);
+		maincorpus.setIsModified(true);
+		highlightSchema(schema);
+		reloadIdentifiantsUnites();
+		onIdentifiantUniteComboSelected(null);
+		editor.fireIsDirty();
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onIdentifiantUniteComboSelected(Event e) {
+		if (unites == null) return;
+
+		int iUnite = subNavigationField.getSelectionIndex();
+		if (iUnite > 0) {
+			Unite unite = unites[iUnite-1];
+			highlightUnite(unite);
+			deleteUniteButton.setEnabled(true);
+		} else {
+			clearUnitesHighlight();
+			deleteUniteButton.setEnabled(false);
+		}
+		
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onIdentifiantComboSelected(SelectionEvent e) {
+		Log.info("Identifiants SelectionListener: "+navigationField.getSelectionIndex());
+		int iSchema = navigationField.getSelectionIndex();
+		if (iSchema <= 0) {
+			if (previousSelectedSchemaIDS != null) {
+				editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedSchemaIDS);
+				previousSelectedSchemaIDS = null; // release memory
+			}
+
+			highlightType();
+			deleteSchemaButton.setEnabled(false);
+			subNavigationField.setEnabled(false);
+			subNavigationField.setSelectionIndex(0);
+			deleteUniteButton.setEnabled(false);
+		} else {
+			Schema schema = schemas[iSchema-1];
+			clearHighlight();
+			highlightSchema(schema);
+			reloadIdentifiantsUnites();
+			updatePropertiesView(schema);
+			deleteSchemaButton.setEnabled(true);
+		}
+		
+		if (e != null) editor.updateWordStyles();
+	}
+
+	protected void onTypeComboSelected(SelectionEvent e) {
+		Log.info("Types SelectionListener: "+typeCombo.getSelectionIndex());
+		reloadIdentifiants();
+		if (typeCombo.getSelectionIndex() > 0) {
+			//String type = unitesAVoir[typeCombo.getSelectionIndex()-1];
+			highlightType();
+			navigationField.setEnabled(true);
+			if (schemas.length > 0) {
+				navigationField.selectFirst();
+				onIdentifiantComboSelected(null);
+			}
+		} else {
+			clearHighlight();
+			unites = null;
+			navigationField.setEnabled(false);
+		}
+
+		deleteSchemaButton.setEnabled(false);
+		if (e != null) editor.updateWordStyles();
+	}
+
+	/**
+	 * reload the identifiants combo
+	 * 
+	 * @param unite the unite to select, may be null
+	 */
+	public void reloadIdentifiants() {
+		Log.info("Reloading identifiants combo values.");
+		String type0 = typeCombo.getText();
+		schemas = vue.getSchemasAVoir(type0);
+		String[] identifiants = vue.getIdSchemas(type0, schemas);
+		navigationField.setIdentifiants(identifiants, type0, Schema.class);
+		navigationField.setSelectionIndex(0);
+	}
+
+	/**
+	 * reload the identifiants combo
+	 * 
+	 * @param unite the unite to select, may be null
+	 */
+	public void reloadIdentifiantsUnites() {
+		Log.info("Reloading unites combo values.");
+		int iSchema = navigationField.getSelectionIndex();
+		if (iSchema <= 0) {
+			subNavigationField.setIdentifiants(new String[0], null, null);
+			unites = null;
+			return;
+		} else {
+			Schema schema = schemas[iSchema-1];
+			unites = schema.getUnitesSousjacentes();
+			String[] identifiants = new String[unites.length];
+			for (int i = 0 ; i < unites.length ; i++) {
+				identifiants[i] = ""+(i+1);//vue.getIdElement(unites[i]); //$NON-NLS-1$
+			}
+			subNavigationField.setIdentifiants(identifiants, null, null);
+
+			//		String[] items = new String[identifiants.length +1];
+			//		System.arraycopy(identifiants, 0, items, 1, identifiants.length);
+			//		//System.out.println("Identifiants: "+Arrays.toString(identifiants));
+			//		items[0] = "< identifiant >";
+			//		identifiantCombo.setItems(items);
+			if (identifiants.length > 0) {
+				subNavigationField.setSelectionIndex(1);
+				subNavigationField.setEnabled(true);
+			} else {
+				subNavigationField.setSelectionIndex(0);
+				subNavigationField.setEnabled(false);
+			}
+			//identifiantCombo.layout();
+		}
+	}
+
+	public void reloadTypeSchemas() {
+
+		schemasAVoir = vue.getTypesSchemasAVoir();
+		String[] items = new String[schemasAVoir.length +1];
+		System.arraycopy(schemasAVoir, 0, items, 1, schemasAVoir.length);
+		items[0] = "<type de schéma>";
+		typeCombo.setItems(items);
+		if (items.length > 0) {
+			typeCombo.select(1);
+		}
+		typeCombo.layout();
+
+		onTypeComboSelected(null);
+	}
+
+	protected void selectSchemaInIdentifants(Schema schema) {
+		for (int i = 0 ; i < schemas.length ; i++) {
+			//System.out.println("VS "+unites[i]);
+			if (schemas[i] == schema) {
+				navigationField.setSelectionIndex(i+1);
+				return; // no need to go further
+			}
+		}
+	}
+
+	public void setEnable(boolean enable) {
+		l.setEnabled(enable);
+		typeCombo.setEnabled(enable);
+		//		createButton.setEnabled(enable);
+		deleteSchemaButton.setEnabled(enable);
+		//		editButton.setEnabled(enable);
+		navigationField.setEnabled(enable);
+	}
+
+	@Override
+	public void traiterEvent(Message e) {
+		if (annotationArea.isDisposed()) return;
+
+		if (e.getType().equals(TypeMessage.MODIF_STRUCTURE)) {
+			//System.out.println("SchemaToolbar.traiterEvent: Update toolbar ");
+			SchemaToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					setEnable(!analecCorpus.isVide());
+					//reloadUnits();
+				}
+			});
+		} else if (e.getType().equals(TypeMessage.MODIF_ELEMENT)) {
+			//System.out.println("SchemaToolbar.traiterEvent: Update toolbar ");
+			SchemaToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					//reloadUnits();
+				}
+			});
+		}
+	}
+
+	protected void tryHighlightingWord(String id, org.txm.searchengine.cqp.corpus.CQPCorpus c) throws CqiClientException {
+		EditionPanel panel = editor.getEditionPanel(0);
+		if (panel == null) return;
+		if (id != null) {
+
+		}
+		QueryResult r = c.query(new CQLQuery("[_.text_id=\""+panel.getEdition().getText().getName()+"\" & id=\""+id+"\"]"), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		List<Match> matches = r.getMatches();
+		if (matches.size() == 0) {
+			System.out.println("Error no word found for id="+id);
+			return;
+		}
+		int start = matches.get(0).getStart();
+		//System.out.println("start="+start);
+		r.drop();
+		int i = 0;
+		Unite[] unites = schemas[navigationField.getSelectionIndex()-1].getUnitesSousjacentes();
+		for (Unite u : unites) {
+			if (u.getDeb() <= start &&  start <= u.getFin()) {
+				highlightUnite(u);
+				updatePropertiesView(u);
+
+				deleteSchemaButton.setEnabled(true);
+				return;
+			} else if (u.getFin() < start) { // no need to search further
+
+			}
+			i++;
+		}
+
+		//	navigationField.setSelectionIndex(0);
+		onIdentifiantComboSelected(null);
+	}
+
+	protected boolean updateUniteLimits(Unite unite, String id) throws CqiClientException {
+
+		String[] ids = {id};
+		EditionPanel panel = SchemaToolbar.this.editor.getEditionPanel(0);
+		String text_name = panel.getEdition().getText().getName();
+
+		int[] startend = getStartEndWordPositions(maincorpus, ids, text_name);
+		if (startend == null) return false;
+
+		int pos = startend[0];
+		Log.warning("Updating annotation limits: "+unite.getDeb()+" -> "+unite.getFin()+" with word id="+id+" with pos="+pos);
+		if ((pos == unite.getDeb() || pos == unite.getFin()) && (unite.getFin() - unite.getDeb()) == 1) {
+			analecCorpus.modifBornesUnite(unite, pos, pos);
+		} else if (pos <= unite.getDeb()) {
+			analecCorpus.modifBornesUnite(unite, pos, unite.getFin());
+		} else if (pos >= unite.getFin()) {
+			analecCorpus.modifBornesUnite(unite, unite.getDeb(), pos);
+		} else if ((pos - unite.getDeb()) < (unite.getFin() - pos)) {
+			analecCorpus.modifBornesUnite(unite, pos, unite.getFin());
+		} else {
+			analecCorpus.modifBornesUnite(unite, unite.getDeb(), pos);
+		}
+
+		return true;
+	}
+
+	public void selectNextUnite() {
+		subNavigationField.selectNext();
+	}
+
+	public void selectPreviousUnite() {
+		subNavigationField.selectPrevious();
+	}
+
+	public void selectFirstUnite() {
+		subNavigationField.selectFirst();
+	}
+
+	public void selectLastUnite() {
+		subNavigationField.selectLast();
+	}
+
+	@Override
+	public void selectNext() {
+		navigationField.selectNext();
+	}
+
+	@Override
+	public void selectPrevious() {
+		navigationField.selectPrevious();
+	}
+
+	@Override
+	public void selectFirst() {
+		navigationField.selectFirst();
+	}
+
+	@Override
+	public void selectLast() {
+		navigationField.selectLast();
+	}
+
+	@Override
+	public void select10Previous() {
+		navigationField.select10Previous();
+	}
+
+	@Override
+	public void select10Next() {
+		navigationField.select10Next();
+	}
+
+	@Override
+	public void select(Element currentElement) {
+		if (currentElement.getClass() == Schema.class) {
+			int i = Arrays.binarySearch(schemas, currentElement);
+			if (i >= 0) navigationField.setSelectionIndex(i+1);
+		}
+	}
+
+	@Override
+	public String getElementType() {
+		if (typeCombo.isDisposed()) return ""; //$NON-NLS-1$
+		return typeCombo.getText();
+	}
+
+	@Override
+	public void clearHighlight() {
+		clearSchemasHighlight();
+		clearUnitesHighlight();
+	}
+
+	@Override
+	public void onBackToText(Text text, String id) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
+		return Text.class;
+	}
+
+	@Override
+	public boolean save() {
+		return AnalecCorpora.saveCorpus(analecCorpus);
+	}
+
+	@Override
+	public String getName() {
+		return "Schema annotation";
+	}
+
+	@Override
+	public boolean notifyStartOfCompute() throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean notifyEndOfCompute() throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void notifyEndOfRefresh() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void notifyStartOfCreatePartControl() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void notifyStartOfRefresh() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	ProgressListener pageProgressListener = null;
+	@Override
+	protected ProgressListener getPageReloadListener() {
+		if (pageProgressListener != null) {
+			return pageProgressListener;
+		}
+		
+		pageProgressListener = new ProgressListener() {
+			
+			@Override
+			public void completed(ProgressEvent event) {
+				if (typeCombo.getSelectionIndex() >= 0) {
+					highlightType();
+				}
+			}
+			
+			@Override
+			public void changed(ProgressEvent event) { }
+		};
+		return pageProgressListener;
+	}
+
+	@Override
+	public boolean needToUpdateIndexes() {
+		return false;
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/SchemaToolbar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java	(revision 1200)
@@ -0,0 +1,272 @@
+package org.txm.annotation.urs.toolbar;
+
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolItem;
+import org.txm.annotation.rcp.editor.AnnotationArea;
+import org.txm.annotation.rcp.editor.AnnotationExtension;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.view.ElementPropertiesView;
+import org.txm.annotation.urs.view.ElementSearchView;
+import org.txm.core.results.TXMResult;
+import org.txm.edition.rcp.editors.EditionPanel;
+import org.txm.edition.rcp.editors.RGBA;
+import org.txm.edition.rcp.editors.SynopticEditionEditor;
+import org.txm.objects.Text;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.Message;
+import visuAnalec.Message.TypeMessage;
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.Corpus.CorpusListener;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Unite;
+import visuAnalec.vue.Vue;
+
+public abstract class URSAnnotationToolbar extends AnnotationArea implements CorpusListener {
+
+	//see https://groupes.renater.fr/wiki/txm-info/public/specs_charte_graphique
+	public static final RGBA blue = new RGBA(152, 159, 201, 0.7f);
+	public static final RGBA lightblue = new RGBA(185, 193, 239, 0.4f);
+	public static final RGBA green = new RGBA(122, 153, 0, 0.7f);
+	public static final RGBA lightgreen = new RGBA(206, 240, 83, 0.5f);
+	public static final RGBA yellow = new RGBA(255,255,50, 1f);
+	public static final RGBA lightyellow = new RGBA(255,255,176, 0.5f);
+
+	protected Corpus analecCorpus;
+	protected Vue vue;
+	protected MainCorpus maincorpus;
+	protected SynopticEditionEditor editor;
+	protected ToolItem button;
+
+	public URSAnnotationToolbar() { }
+
+	public abstract void selectFirst();
+	public abstract void selectPrevious();
+	public abstract void select10Previous();
+	public abstract void select10Next();
+	public abstract void selectNext();
+	public abstract void selectLast();
+	public abstract void select(Element currentElement);
+
+	@Override
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
+
+		this.extension = extension;
+		this.editor = (SynopticEditionEditor) txmeditor;
+		this.maincorpus = (MainCorpus) this.editor.getCorpus();
+		analecCorpus = AnalecCorpora.getCorpus(maincorpus);
+		vue = AnalecCorpora.getVue(maincorpus);
+
+		annotationArea = new GLComposite(parent, SWT.NONE, "Unit annotation");
+
+		if (getEditorClickListener() != null)
+			editor.getEditionPanel(0).getBrowser().addMouseListener(getEditorClickListener());
+		if (getMenuListener() != null)
+			editor.getEditionPanel(0).getBrowser().getMenu().addMenuListener(getMenuListener());
+		if (getEditorKeyListener() != null)
+			editor.getEditionPanel(0).getBrowser().addKeyListener(getEditorKeyListener());
+		if (getEditorKeyListener() != null)
+			editor.getEditionPanel(0).getBeforeHighlighListeners().add(getPageReloadListener());
+
+		if (analecCorpus.getStructure().isVide()) {
+			analecCorpus.ajouterType(Unite.class, "Entity");
+			analecCorpus.ajouterProp(Unite.class, "Entity", "Property");
+		}
+
+		button = extension.getSaveButton();
+		button.setEnabled(analecCorpus.isModifie());
+		return true;
+	}
+
+
+	protected abstract ProgressListener getPageReloadListener();
+
+	public Corpus getAnalecCorpus() {
+		return analecCorpus;
+	}
+
+	protected void updatePropertiesView(Element element) {
+		ElementPropertiesView view = ElementPropertiesView.openView();
+		if (view != null) view.loadElement(this.maincorpus, this.analecCorpus, element, this);
+	}
+
+	public boolean isDirty() {
+		if (analecCorpus != null) return analecCorpus.isModifie();
+		return false;
+	}
+
+	public boolean isDisposed() {
+		return annotationArea == null || annotationArea.isDisposed();
+	}
+
+	protected void clearPropertiesView() {
+		ElementPropertiesView view = ElementPropertiesView.openView();
+		if (view != null) {
+			view.unloadElement(this.analecCorpus, this);
+		}
+	}
+
+	protected static void setFocusInPropertiesView() {
+		ElementPropertiesView view = ElementPropertiesView.openView();
+		if (view != null) {
+			view.setFocusOnProperty();
+		}
+	}
+
+	protected int[] getSelectionStartEndWordPositions() {
+		EditionPanel panel = this.editor.getEditionPanel(0);
+		String text_name = panel.getEdition().getText().getName();
+		String[] sel = panel.getWordSelection();
+		if (sel == null) {
+			Log.info("Error: no word selection");
+			return null;
+		}
+		//System.out.println("Selection="+sel);
+		try {
+			return getStartEndWordPositions(maincorpus, sel, text_name);
+		} catch (CqiClientException e1) {
+			e1.printStackTrace();
+		}
+		return null;
+	}
+
+	protected int[] getStartEndWordPositions(MainCorpus c, String[] ids, String text_name) throws CqiClientException {
+		//System.out.println("IDS="+Arrays.toString(ids));
+		CQLQuery query = new CQLQuery("[_.text_id=\""+text_name+"\" & id=\""+StringUtils.join(ids, "|")+"\"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		QueryResult result = c.query(query, "TMP", false); //$NON-NLS-1$
+		List<Match> matches = result.getMatches();
+		int start, end;
+		//		try {
+		//			int[] indexes = CQPSearchEngine.getCqiClient().str2Id(c.getProperty("id").getQualifiedName(), ids);
+		//			int[] positions = CQPSearchEngine.getCqiClient().id2Cpos(c.getProperty("id").getQualifiedName(), indexes);
+		//		
+		//		} catch (Exception e) {
+		//			
+		//		}
+		if (matches.size() == 0) {
+			System.out.println("Error: no match for query="+query);
+			return null;
+		} else {
+			start = matches.get(0).getStart();
+			end = matches.get(matches.size()-1).getStart();
+		}
+		result.drop();
+		return new int[]{start, end};
+	}
+
+	// listen to corpus structure modification -> enable/disable the button
+	// and to new annotations -> set the star modifier to the Corpus view
+	protected CorpusListener corpusListener = new CorpusListener() {
+		@Override
+		public void traiterEvent(final Message e) {
+			if (maincorpus == null) return;
+
+			//System.out.println("StartButton.corpusListener.traiterEvent: "+e);
+
+			button.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					if (e.getType() == TypeMessage.MODIF_STRUCTURE) {
+						boolean ready = AnalecCorpora.isAnnotationStructureReady(maincorpus);
+						button.setEnabled(ready);
+						//if (!ready && utoolbar != null && !utoolbar.isDisposed()) utoolbar.clearHighlight();
+					}
+
+					if (e.getType() == TypeMessage.MODIF_ELEMENT) {
+						button.setEnabled(AnalecCorpora.isAnnotationStructureReady(maincorpus));
+						if (!maincorpus.isModified()) {
+							maincorpus.setIsModified(true); // to show the * in corpora view
+							updateCorporaView(maincorpus);
+						}
+
+					} else if (e.getType() == TypeMessage.CORPUS_SAVED) {
+						button.setEnabled(false);
+						if (maincorpus.isModified()) {
+							maincorpus.setIsModified(false); // to remove the * in corpora view
+							updateCorporaView(maincorpus);
+						}
+					}
+				}
+			});
+
+		}
+	};
+
+	public static void updateCorporaView(final MainCorpus corpus) {
+		CorporaView.refreshObject(corpus);
+	}
+
+	@Override
+	public boolean discardChanges() {
+		if (maincorpus.isModified()) {
+			AnalecCorpora.revert(maincorpus);
+			analecCorpus = AnalecCorpora.getCorpus(maincorpus);
+			vue = AnalecCorpora.getVue(maincorpus);
+			analecCorpus.removeEventListener(corpusListener);
+			CorporaView.refreshObject(maincorpus);
+		}
+		return false;
+	}
+
+	public abstract MenuListener getMenuListener();
+	public abstract MouseListener getEditorClickListener();
+	public abstract KeyListener getEditorKeyListener();
+	public abstract void clearHighlight();
+	public abstract void onBackToText(Text text, String id);
+
+	public SynopticEditionEditor getEditor() {
+		return editor;
+	}
+
+	public void _close() {
+
+		this.clearHighlight();
+
+		try {
+			analecCorpus.removeEventListener(this);
+		} catch(Exception e) { }
+
+		if (!editor.isDisposed()) {
+			if (this.getEditorClickListener() != null)
+				editor.getEditionPanel(0).getBrowser().removeMouseListener(this.getEditorClickListener());
+			if (this.getMenuListener() != null)
+				editor.getEditionPanel(0).getBrowser().getMenu().removeMenuListener(this.getMenuListener());
+			if (this.getEditorKeyListener() != null)
+				editor.getEditionPanel(0).getBrowser().removeKeyListener(this.getEditorKeyListener());
+			if (this.getPageReloadListener() != null)
+				editor.getEditionPanel(0).getBeforeHighlighListeners().remove(this.getPageReloadListener());
+		}
+		if (annotationArea != null && annotationArea.isDisposed()) annotationArea.dispose();
+
+		ElementPropertiesView.closeView();
+		ElementSearchView.closeView();
+		analecCorpus.removeEventListener(corpusListener);
+	}
+
+	public org.txm.searchengine.cqp.corpus.CQPCorpus getCQPCorpus() {
+		return maincorpus;
+	}
+
+	public abstract String getElementType();
+
+	public void fireIsDirty() {
+		editor.fireIsDirty();
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecAnnotationReIndexer.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecAnnotationReIndexer.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecAnnotationReIndexer.java	(revision 1200)
@@ -0,0 +1,145 @@
+package org.txm.annotation.urs;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.elements.Unite;
+
+public class AnalecAnnotationReIndexer {
+	MainCorpus corpus;
+	Corpus analecCorpus;
+	File aafile;
+	public boolean debug = false;
+
+	public AnalecAnnotationReIndexer(MainCorpus corpus, Corpus analecCorpus) {
+		this.corpus = corpus;
+		this.analecCorpus = analecCorpus;
+	}
+
+	public boolean process() throws CqiClientException, IOException, CqiServerError {
+
+		int corpusSize = corpus.getSize();
+
+		String text = analecCorpus.getTexte();
+		int isearch = 0; // the current search start position
+
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+		Property word = corpus.getProperty("word");
+
+		int positions[] = new int[corpusSize];
+		for (int i = 0 ; i < corpusSize ; i++) positions[i] = i;
+		
+		int positionsCorrespondances[] = new int[corpusSize];
+		String strs[] = CQI.cpos2Str(word.getQualifiedName(), positions);
+
+		for (int i = 0 ; i < corpusSize ; i++) {
+			int idx = text.indexOf(strs[i], isearch);
+			if (idx < 0) {
+				System.out.println("Error: cannot find word='"+strs[i]+"' (word with position in CQP corpus="+positions[i]+") in text with current carret="+isearch+". Aborting.");
+				
+				System.out.println("Current text slice is (-20, +20 characters): ");
+				System.out.println("* before: "+text.substring(Math.max(0, isearch-20), Math.min(isearch+20, isearch)));
+				System.out.println("* after: "+text.substring(isearch, Math.min(isearch+20, text.length()-1)));
+				
+				return false;
+			}
+			positionsCorrespondances[i] = idx;
+			isearch = idx + strs[i].length();
+		}
+		
+		if (debug) System.out.println(Arrays.toString(positions));
+		if (debug) System.out.println(Arrays.toString(positionsCorrespondances));
+
+		isearch = 0;
+		ArrayList<Unite> unites = analecCorpus.getToutesUnites();
+		if (debug) System.out.println("units not-sorted: ");
+		if (debug) printUnits(unites);
+		Collections.sort(unites, new Comparator<Unite>() {
+			@Override
+			public int compare(Unite o1, Unite o2) {
+				return o1.getDeb() - o2.getDeb();
+			}
+		});
+		if (debug) System.out.println("units sorted: ");
+		if (debug) printUnits(unites);
+		
+		int iunite = 0;
+		for (Unite unite : unites) {
+			if (debug) System.out.println("Updating ");
+			if (debug) printUnite(unite);
+			int start = unite.getDeb();
+			int end = unite.getFin();
+			
+			boolean startFound = false;
+			boolean endFound = false;
+			int i = 0; // or not : unites are sorted by start position, we don't need to browse all words \o/
+			for (; i < positionsCorrespondances.length ; i++) {
+				if (startFound && endFound) break; // no need to go further
+				if (debug) System.out.println("i="+i+" positionsCorrespondances[i]="+positionsCorrespondances[i]);
+				if (!startFound && start < positionsCorrespondances[i]) {
+					unite.setDeb(i-1);
+					startFound = true;
+				}
+				if (!endFound && end <= positionsCorrespondances[i]) {
+					unite.setFin(i-1);
+					endFound = true;
+				}
+			}
+			
+			if (!endFound && i == positionsCorrespondances.length) {
+				unite.setFin(i-1);
+				endFound = true;
+			}
+			if (!startFound && i == positionsCorrespondances.length) {
+				unite.setDeb(i-1);
+				startFound = true;
+			}
+			
+			if (!(startFound && endFound)) {
+				String s = "Error: cannot find words positions for unite of type="+unite.getType()+" and unit carret positions=["+start+", "+end+"]. Aborting";
+				System.out.println(s);
+				
+				System.out.println("5 last found units are: ");
+				for (int j = 4 ; j >= 0 ; j--) {
+					if (iunite-j >= 0) {
+						printUnite(unites.get(iunite-j));
+					}
+				}
+				return false;
+			}
+			//if (i > 0) i--; // restart at previous word
+			iunite++;
+		}
+		if (debug) System.out.println("units updated: ");
+		if (debug) printUnits(unites);
+		return true;
+	}
+	
+	public static void printUnite(Unite unite) {
+		System.out.print(unite.getType()+ "["+unite.getDeb()+", "+unite.getFin()+"]");
+	}
+	
+	public static void printUnits(List<Unite> units) {
+		int i = 0;
+		for (Unite u : units) {
+			if (i > 0) System.out.print(", ");
+			printUnite(u);
+			i++;
+		}
+		System.out.println();
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecAnnotationReIndexer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/NavigationField.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/NavigationField.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/NavigationField.java	(revision 1200)
@@ -0,0 +1,360 @@
+package org.txm.annotation.urs.widgets;
+
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.fieldassist.TXMAutoCompleteField;
+import org.eclipse.jface.fieldassist.TextContentAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseWheelListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.toolbar.URSAnnotationToolbar;
+import org.txm.annotation.urs.toolbar.UnitToolbar;
+import org.txm.annotation.urs.view.ElementSearchView;
+import org.txm.rcp.IImageKeys;
+
+import visuAnalec.elements.Unite;
+
+/**
+ * Mimic the List and Combo widget to manage big data volume
+ * 
+ * Don't forget to add a SelectionListener to the parent to manage the selection change
+ * 
+ * @author mdecorde
+ *
+ */
+public class NavigationField extends Composite {
+
+	protected String[] identifiants;
+
+	protected org.eclipse.swt.widgets.Text identifiantCombo;
+	protected Button identifiantComboButtonStart;
+	protected Button identifiantComboButtonUp;
+	protected Button identifiantComboButtonDown;
+	protected Button identifiantComboButtonEnd;
+	protected Button searchButton;
+
+	protected TXMAutoCompleteField identifiantComboAutoCompleteField;
+
+	private URSAnnotationToolbar toolbar;
+
+	public NavigationField(URSAnnotationToolbar parent, int style) {
+		super(parent.getAnnotationArea(), style);
+		this.toolbar = parent;
+		GridLayout layout = new GridLayout(6, false);
+		layout.marginLeft = layout.marginRight = 0;
+		layout.marginWidth = 0;
+		//layout.horizontalSpacing = layout.marginBottom = layout.marginHeight = layout.marginLeft = layout.marginRight = layout.marginTop = layout.marginWidth = 0;
+		this.setLayout(layout);
+
+		//		Composite identifiantComboButtons = new Composite(this, SWT.NONE);
+		//		GridData gdata = new GridData(GridData.FILL, GridData.FILL, false, false);
+		//		identifiantComboButtons.setLayoutData(gdata);
+		//		//identifiantComboButtons.setLayout(new GridLayout(1, true));
+		//		RowLayout fillLayout = new RowLayout(SWT.HORIZONTAL);
+		//		fillLayout.spacing = 0;
+		//		fillLayout.marginHeight = 0;
+		//		fillLayout.marginWidth = 0;
+		//		identifiantComboButtons.setLayout(fillLayout);
+		//		RowData rdata = new RowData();
+		//		//rdata.width = 20;
+		identifiantComboButtonStart = new Button(this, SWT.PUSH);
+		identifiantComboButtonStart.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
+		//		identifiantComboButtonStart.setLayoutData(rdata);
+		identifiantComboButtonStart.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				selectFirst();
+				toolbar.getEditor().updateWordStyles();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		identifiantComboButtonUp = new Button(this, SWT.PUSH);
+		identifiantComboButtonUp.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
+		//		identifiantComboButtonUp.setLayoutData(rdata);
+		identifiantComboButtonUp.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				selectPrevious();
+				toolbar.getEditor().updateWordStyles();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		identifiantCombo = new org.eclipse.swt.widgets.Text(this, SWT.BORDER);
+		KeyStroke keys = KeyStroke.getInstance(SWT.CONTROL, SWT.SPACE);
+		identifiantComboAutoCompleteField = new TXMAutoCompleteField(identifiantCombo, new TextContentAdapter(), new String[0], keys);
+		Cursor cursor = new Cursor(identifiantCombo.getDisplay(), SWT.CURSOR_SIZENS);
+		identifiantCombo.setCursor(cursor);
+		identifiantCombo.setText(Messages.NavigationField_0);
+
+		GridData gdata2 = new GridData(GridData.FILL, GridData.FILL, true, false);
+		gdata2.minimumWidth = 100;
+		identifiantCombo.setLayoutData(gdata2);
+		identifiantCombo.addKeyListener(new KeyListener() {
+			@Override
+			public void keyReleased(KeyEvent e) {
+				//System.out.println("e:"+e.keyCode);
+				if (identifiantComboAutoCompleteField.isOpen()) return; // ignore keys when content assist is opened
+
+				if (e.keyCode == SWT.ARROW_UP) {
+					selectPrevious();
+					toolbar.getEditor().updateWordStyles();
+				} else if (e.keyCode == SWT.ARROW_DOWN) {
+					selectNext();
+					toolbar.getEditor().updateWordStyles();
+				} else if (e.keyCode == SWT.PAGE_UP) {
+					select10Previous();
+					toolbar.getEditor().updateWordStyles();
+				} else if (e.keyCode == SWT.PAGE_DOWN) {
+					select10Next();
+					toolbar.getEditor().updateWordStyles();
+				}  else if (e.keyCode == SWT.END) {
+					selectLast();
+					toolbar.getEditor().updateWordStyles();
+				} else if (e.keyCode == SWT.HOME) {
+					selectFirst();
+					toolbar.getEditor().updateWordStyles();
+				} else if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+					String id = identifiantCombo.getText().trim();
+					String prefix = type+"-"; //$NON-NLS-1$
+					if (id.startsWith(prefix)) {
+						id = id.substring(prefix.length());
+						//System.out.println("ID: "+id);
+						try {
+							Integer i = Integer.parseInt(id);
+							if (identifiants.length < i) {
+								System.out.println(Messages.NavigationField_2+identifiantCombo.getText());
+								return;
+							}
+							setSelectionIndex(i);
+							//notifySelectionChanged(null);
+							toolbar.getEditor().updateWordStyles();
+						} catch(Exception ex) {
+							System.out.println(Messages.NavigationField_3+identifiantCombo.getText());
+						}
+					}
+				}
+				
+				
+			}
+
+			@Override
+			public void keyPressed(KeyEvent e) { }
+		});
+		identifiantCombo.addMouseWheelListener(new MouseWheelListener() {
+			@Override
+			public void mouseScrolled(MouseEvent e) {
+				if (identifiantComboAutoCompleteField.isOpen()) return;
+
+				if (e.count > 0) {
+					selectPrevious();
+				} else {
+					selectNext();
+				}
+				//toolbar.getEditor().updateWordStyles();
+			}
+		});
+
+		identifiantComboButtonDown = new Button(this, SWT.PUSH);
+		identifiantComboButtonDown.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
+		//		identifiantComboButtonDown.setLayoutData(rdata);
+		identifiantComboButtonDown.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				selectNext();
+				toolbar.getEditor().updateWordStyles();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		identifiantComboButtonEnd = new Button(this, SWT.PUSH);
+		identifiantComboButtonEnd.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
+		//		identifiantComboButtonEnd.setLayoutData(rdata);
+		identifiantComboButtonEnd.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				selectLast();
+				toolbar.getEditor().updateWordStyles();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		searchButton = new Button(this, SWT.PUSH);
+		searchButton.setToolTipText(Messages.NavigationField_4);
+		searchButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_SEARCH));
+		searchButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
+		searchButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				ElementSearchView view = ElementSearchView.openView();
+				view.loadType(NavigationField.this.toolbar.getCQPCorpus(), 
+						NavigationField.this.toolbar.getAnalecCorpus(), 
+						clazz, 
+						type, 
+						NavigationField.this.toolbar);
+				view.setFocus();
+			}
+		});
+		searchButton.setVisible(false);
+	}
+
+
+
+	protected void notifySelectionChanged(Object object) {
+		Event event = new Event();
+		event.data = identifiantComboIndex;
+		this.notifyListeners(SWT.Selection, event);
+	}
+
+	// This is a set of identifiantCombo control methods to replace the ComboViewer Jface widget
+	protected int identifiantComboIndex = 0;
+	protected int identifiantComboSize = 0;
+
+	private String type;
+
+	private Class clazz;
+	/**
+	 * Set the navigation index AND notify the change value listener
+	 * @param i
+	 */
+	public void setSelectionIndex(int i) {
+		setSelectionIndex(i, true);
+	}
+	/**
+	 * Set the navigation index AND notify the change value listener
+	 * @param i
+	 * @param notify if false listeners won't be notified
+	 */
+	public void setSelectionIndex(int i, boolean notify) {
+		if (identifiantComboSize <= i) return;
+		if (i < 0) return;
+		identifiantComboIndex = i;
+		if (i == 0) {
+			this.identifiantCombo.setText(Messages.NavigationField_5);
+		} else if (type != null && type.length() > 0) {
+			this.identifiantCombo.setText(type+"-"+(i)); //$NON-NLS-1$
+		} else {
+			this.identifiantCombo.setText(""+i); //$NON-NLS-1$
+		}
+		Event e = new Event();
+		e.data = i;
+		if (notify) this.notifyListeners(SWT.Selection, e);
+	}
+	/**
+	 * 
+	 * @param values
+	 * @param type mandatory to display the search button
+	 * @param clazz mandatory to display the search button
+	 */
+	public void setIdentifiants(String[] values, String type, Class clazz) {
+		this.identifiants = values;
+		this.type = type;
+		this.clazz = clazz;
+
+		GridData gdata = (GridData) searchButton.getLayoutData();
+		if (type != null && clazz != null) {
+			searchButton.setVisible(true);
+			gdata.minimumWidth = -1;
+			gdata.widthHint = -1;
+		} else {
+			searchButton.setVisible(false);
+			gdata.minimumWidth = 0;
+			gdata.widthHint = 0;
+		}
+
+		identifiantComboSize = values.length + 1; // + 1 because of <identifiants>
+		identifiantComboAutoCompleteField.setProposals(values);
+	}
+	public int getSelectionIndex() { return identifiantComboIndex;}
+	public int getIdentifiantSize() { return identifiantComboSize;}
+	public String getText() {
+		return identifiantCombo.getText();
+	}
+
+	public void setEnabled(boolean b) {
+		this.identifiantCombo.setEnabled(b);
+		this.identifiantComboButtonStart.setEnabled(b);
+		this.identifiantComboButtonDown.setEnabled(b);
+		this.identifiantComboButtonUp.setEnabled(b);
+		this.identifiantComboButtonEnd.setEnabled(b);
+		this.searchButton.setEnabled(b);
+	}
+
+	public int selectNext() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = getSelectionIndex();
+		i = (i+1)%identifiantComboSize;
+		setSelectionIndex(i);
+		return i;
+	}
+
+	public int selectPrevious() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = getSelectionIndex();
+		i = (i-1)%identifiantComboSize;
+		if (i < 0) i = identifiantComboSize + i;
+		setSelectionIndex(i);
+
+		return i;
+	}
+
+	public int selectFirst() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = 1%identifiantComboSize;
+		setSelectionIndex(i);
+		return i;
+	}
+
+	public int select10Previous() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = getSelectionIndex();
+		i = (i-10)%identifiantComboSize;
+		if (i < 0) i = identifiantComboSize + i;
+		setSelectionIndex(i);
+		return i;
+	}
+
+	public int select10Next() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = getSelectionIndex();
+		i = (i+10)%identifiantComboSize;
+		setSelectionIndex(i);
+		return i;
+	}
+
+	public int selectLast() {
+		if (identifiantComboSize == 0) return 0;
+
+		int i = (identifiantComboSize - 1);
+		if (i < 0) i = identifiantComboSize + i;
+		setSelectionIndex(i);
+		return i;
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/NavigationField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/TextItem.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/TextItem.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/TextItem.java	(revision 1200)
@@ -0,0 +1,30 @@
+package org.txm.annotation.urs.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+
+public class TextItem extends Item {
+
+	private ToolBar parent;
+	private Text field;
+
+	public TextItem (ToolBar parent, int style) {
+		super(parent, style);
+		this.parent = parent;
+	}
+	
+	public String getText() {
+		return field.getText();
+	}
+	
+	public void setText(String s) {
+		 field.setText(s);
+	}
+	
+	public void addSelectionListener(SelectionListener listener) {
+		 field.addSelectionListener(listener);
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/TextItem.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/DropDownButton.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/DropDownButton.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/DropDownButton.java	(revision 1200)
@@ -0,0 +1,74 @@
+package org.txm.annotation.urs.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+public class DropDownButton extends Button {
+
+	public DropDownButton(ToolBar parent, int style) {
+		super(parent, style);
+		// TODO Auto-generated constructor stub
+	}
+	
+	public static void main (String [] args) {
+		final Display display = new Display ();
+		final Shell shell = new Shell (display);
+		final ToolBar toolBar = new ToolBar (shell, SWT.NONE);
+		Rectangle clientArea = shell.getClientArea ();
+		toolBar.setLocation(clientArea.x, clientArea.y);
+		final Menu menu = new Menu (shell, SWT.POP_UP);
+		for (int i=0 ; i < 8 ; i++) {
+			MenuItem item = new MenuItem (menu, SWT.PUSH);
+			item.setText ("Item " + i); //$NON-NLS-1$
+			item.addSelectionListener(new SelectionListener() {
+				
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					System.out.println("item "+this); //$NON-NLS-1$
+				}
+				
+				@Override
+				public void widgetDefaultSelected(SelectionEvent e) { }
+			});
+		}
+		
+		ToolItem b1 = new ToolItem(toolBar, SWT.PUSH);
+		b1.setText("push me"); //$NON-NLS-1$
+		
+		final ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN);
+		item.setText("default item"); //$NON-NLS-1$
+		item.addListener(SWT.Selection, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				if (event.detail == SWT.ARROW) {
+					Rectangle rect = item.getBounds();
+					Point pt = new Point(rect.x, rect.y + rect.height);
+					pt = toolBar.toDisplay (pt);
+					menu.setLocation(pt.x, pt.y);
+					menu.setVisible(true);
+				}
+			}
+		});
+		
+		toolBar.pack();
+		shell.pack();
+		shell.open();
+		while (!shell.isDisposed()) {
+			if (!display.readAndDispatch()) display.sleep();
+		}
+		menu.dispose();
+		display.dispose();
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/widgets/DropDownButton.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_ru.properties
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_ru.properties	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_ru.properties	(revision 1200)
@@ -0,0 +1,170 @@
+AnalecCorpora_3=N/A_Fail to open corpus file: 
+AnalecCorpora_4=N/A_Fail to create corpus file: 
+DoInstallStep_10=N/A_. Aborting
+DoInstallStep_11=N/A_Previous version of Analec macros are moved to: 
+DoInstallStep_17=N/A_Error while coping Analec org/txm/macro/analec in 
+DoInstallStep_18=N/A_Analec post-installation done.
+DoInstallStep_2=N/A_Analec.DoInstallStep.install()
+DoInstallStep_5=N/A_No post-installation of Analec to do
+DoInstallStep_6=N/A_Post-installing Analec version=
+DoInstallStep_7=N/A_scripts/macro/org/txm/macro/analec
+DoInstallStep_9=N/A_Analec previous macro backup directory already exists: 
+EditStructure_0=N/A_Selection is not a corpus: 
+ExportGlozzCorpus_0=N/A_Selection is not a main corpus: 
+ExportGlozzCorpus_1=N/A_\ Glozz export
+ExportGlozzCorpus_2=N/A_Canceled.
+ExportGlozzCorpus_3=N/A_Error while exporting annotations : 
+ExportGlozzCorpus_4=N/A_Error while exporting annotations : 
+ExportTEICorpus_0=N/A_Selection is not a corpus: 
+ExportTEICorpus_1=N/A_\ annotations export...
+ExportTEICorpus_2=N/A_Error while exporting corpus.
+ExportTEICorpus_3=N/A_Error while exporting corpus to XML-Analec: 
+ExportTEICorpus_4=N/A_Error while exporting annotations: 
+ImportGlozzAnnotations_0=N/A_The AA AAM and AC files must exists.
+ImportGlozzAnnotations_1=N/A_Selection is not a main corpus: 
+ImportGlozzAnnotations_10=N/A_Done.
+ImportGlozzAnnotations_2=N/A_Importing Glozz model from: 
+ImportGlozzAnnotations_3=N/A_error while importing Glozz model.
+ImportGlozzAnnotations_4=N/A_Importing Glozz corpus from: 
+ImportGlozzAnnotations_5=N/A_\ and 
+ImportGlozzAnnotations_6=N/A_error while importing Glozz corpus.
+ImportGlozzAnnotations_7=N/A_Reindexing annotations with TXM words
+ImportGlozzAnnotations_8=N/A_error while re-indexing Analec annotations.
+ImportGlozzAnnotations_9=N/A_Saving annotations.
+ImportGlozzCorpus_0=N/A_The glozzDirectory directory must exists.
+ImportGlozzCorpus_1=N/A_Creating source directory: $srcDir
+ImportGlozzCorpus_10=N/A_No .aa files found in 
+ImportGlozzCorpus_11=N/A_Importing Glozz data from: 
+ImportGlozzCorpus_15=N/A_Error while importing Glozz data.
+ImportGlozzCorpus_17=N/A_Could not create the TXT source file $txtFile
+ImportGlozzCorpus_19=N/A_ERROR: could not save import configuration: 
+ImportGlozzCorpus_22=N/A_Error: no script found for import name ${importName}: $script
+ImportGlozzCorpus_23=N/A_Error during import
+ImportGlozzCorpus_24=N/A_Finalize Analec corpus import
+ImportGlozzCorpus_25=N/A_Importing Glozz model from: 
+ImportGlozzCorpus_26=N/A_Error while importing Glozz model.
+ImportGlozzCorpus_27=N/A_Reindexing annotations with TXM words.
+ImportGlozzCorpus_28=N/A_error while re-indexing Analec annotations.
+ImportGlozzCorpus_29=N/A_Saving annotations.
+ImportGlozzCorpus_3=N/A_Creating ec directory: $ecDir
+ImportGlozzCorpus_30=N/A_Done.
+ImportGlozzCorpus_32=N/A_ERROR while finalizing corpus import: 
+ImportGlozzCorpus_4=N/A_Could not create the source directory $srcDir
+ImportGlozzCorpus_5=N/A_Could not create the ec directory $ecDir
+ImportGlozzCorpus_8=N/A_No .aa files found in 
+ImportGlozzCorpus_9=N/A_No .ac files found in 
+ImportTEIAnnotations_0=N/A_Selection is not a corpus: 
+ImportTEIAnnotations_1=N/A_\ annotations import...
+ImportTEIAnnotations_2=N/A_Error while importing annotations.
+ImportTEIAnnotations_3=N/A_Error while importing annotations: 
+ImportTEIAnnotations_4=N/A_Error while exporting annotations: 
+ImportTEIAnnotations_5=N/A_Done: 
+ImportTEIAnnotations_6=N/A_\ unites 
+ImportTEIAnnotations_7=N/A_\ relations 
+ImportTEIAnnotations_8=N/A_\ schemas.
+ImportTEICorpus_0=N/A_The XML files must exists: 
+ImportTEICorpus_11=N/A_ERROR: could not save import configuration: 
+ImportTEICorpus_14=N/A_Error: no script found for import name ${importName}: $script
+ImportTEICorpus_15=N/A_Error during import
+ImportTEICorpus_16=N/A_Finalize Analec corpus import
+ImportTEICorpus_18=N/A_Importing TEI model from: 
+ImportTEICorpus_19=N/A_Error while importing TEI model.
+ImportTEICorpus_2=N/A_Creating source directory: $srcDir
+ImportTEICorpus_20=N/A_Reindexing annotations with TXM words.
+ImportTEICorpus_21=N/A_error while re-indexing Analec annotations.
+ImportTEICorpus_22=N/A_Saving annotations.
+ImportTEICorpus_23=N/A_Done.
+ImportTEICorpus_24=N/A_Error while finalizing corpus import: 
+ImportTEICorpus_3=N/A_Could not create the source directory $srcDir
+ImportTEICorpus_5=N/A_Importing TEI data from: 
+ImportTEICorpus_7=N/A_Error while importing TEI data.
+ImportTEICorpus_9=N/A_Could not create the TXT source file $txtFile
+LoadCorpus_0=N/A_Selection is not a main corpus: 
+LoadCorpus_1=N/A_Loading corpus from file...
+LoadCorpus_2=N/A_The EC files must exists.
+LoadCorpus_3=N/A_Loading corpus from file: 
+LoadCorpus_4=N/A_Fail to load structure.
+LoadCorpus_5=N/A_Done: 
+LoadStructure_0=N/A_Selection is not a main corpus: 
+LoadStructure_1=N/A_Loading structure for corpus=
+LoadStructure_2=N/A_Fail to load structure.
+LoadStructure_3=N/A_Done: 
+LoadStructureFromGlozz_0=N/A_Selection is not a main corpus: 
+LoadStructureFromGlozz_1=N/A_Importing Glozz model for corpus=
+LoadStructureFromGlozz_2=N/A_The AAM file must exists.
+LoadStructureFromGlozz_3=N/A_Fail to load structure from Glozz model.
+LoadStructureFromGlozz_4=N/A_Done.
+LoadVue_0=N/A_Selection is not a main corpus: 
+LoadVue_1=N/A_Loading vue for corpus=
+LoadVue_2=N/A_Fail to load structure.
+LoadVue_3=N/A_Done: 
+SaveCorpus_0=N/A_Selection is not a main corpus: 
+SaveCorpus_1=N/A_\ in 
+SaveCorpus_3=N/A_Saving structure for corpus=
+SaveCorpus_5=N/A_Erreur lors de la sauvegarde du corpus.
+SaveStructure_0=N/A_Selection is not a main corpus: 
+SaveStructure_3=N/A_Saving structure for corpus=
+SaveStructure_4=N/A_\ in 
+SaveStructure_5=N/A_Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_0=N/A_Selection is not a main corpus: 
+SaveStructureAsGlozzModel_1=N/A_Saving structure as Glozz model for corpus=
+SaveStructureAsGlozzModel_2=N/A_Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_3=N/A_Done.
+SaveVue_0=N/A_Selection is not a main corpus: 
+SaveVue_3=N/A_Saving vue for corpus=
+SaveVue_4=N/A_\ in 
+SaveVue_5=N/A_Erreur lors de la sauvegarde de la vue.
+AnalecPreferencePage_3=N/A_Use Analec scheme to fix unit limits
+AnalecPreferencePage_4=N/A_Autocompletion search pattern of field is prefix (instead of infixe)
+AnalecPreferencePage_9=N/A_Unit highlight color palette
+AnnotationToolbar_0=N/A_No selection found. Aborting.
+AnnotationToolbar_6=N/A_Error: QueryResult matches size is 
+AnnotationToolbar_7=N/A_\ query was 
+UnitToolbar_10=N/A_Supprimer
+UnitToolbar_12=N/A_Corriger la limite gauche en cliquant sur un mot
+UnitToolbar_14=N/A_Corriger les limites gauche et droite avec une nouvelle s?lection de mot
+UnitToolbar_16=N/A_Corriger la limite droite en cliquant sur un mot
+UnitToolbar_27=N/A_You must select a word. Try again\!
+UnitToolbar_28=N/A_An error occured when updating unit limits with id=
+UnitToolbar_29=N/A_Select 
+UnitToolbar_3=N/A_** Could not retrieve 
+UnitToolbar_32=N/A_Select 
+UnitToolbar_4=N/A_\ size: 
+UnitToolbar_44=N/A_Creating unit with start=
+UnitToolbar_45=N/A_\ end=
+UnitToolbar_46=N/A_org.txm.analec.delete
+UnitToolbar_47=N/A_Delete unit 
+UnitToolbar_48=N/A_Do you really want to delete unit 
+UnitToolbar_49=N/A_\ ?
+UnitToolbar_5=N/A_Type d'unit? :
+UnitToolbar_50=N/A_Aborting annotation limit update
+UnitToolbar_51=N/A_Identifiants SelectionListener: 
+UnitToolbar_52=N/A_Types SelectionListener: 
+UnitToolbar_53=N/A_Reloading identifiants combo values.
+UnitToolbar_54=N/A_< type d'unit? >
+UnitToolbar_59=N/A_Error no word found for id=
+UnitToolbar_6=N/A_Type d'unit?
+UnitToolbar_60=N/A_Updating annotation limits: 
+UnitToolbar_61=N/A_\ -> 
+UnitToolbar_62=N/A_\ with word id=
+UnitToolbar_63=N/A_\ with pos=
+UnitToolbar_7=N/A_Type d'unit?
+UnitToolbar_8=N/A_Cr?er
+StartButton_0=N/A_Units
+StartButton_1=N/A_Schemas
+StartButton_10=N/A_), then call the Analec > Import Structure command
+StartButton_11=N/A_Save and close annotation tools: 
+StartButton_12=N/A_D?marrer l'annotation Analec
+StartButton_2=N/A_Saving analec annotations...
+StartButton_3=N/A_Saving analec annotations...
+StartButton_4=N/A_Error: corpus not saved.
+StartButton_5=N/A_Done.
+StartButton_6=N/A_You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+StartButton_7=N/A_), then call the Analec > Import Structure command
+StartButton_8=N/A_Save and close annotation tools: 
+StartButton_9=N/A_You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+NavigationField_0=N/A_<identifiant>
+NavigationField_2=N/A_Wrong unit ID: 
+NavigationField_3=N/A_Wrong unit ID: 
+NavigationField_4=N/A_Rechercher par les propri?t?s de ce type d'unit?
+NavigationField_5=N/A_<identifiant>

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementPropertiesView.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementPropertiesView.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementPropertiesView.java	(revision 1200)
@@ -0,0 +1,389 @@
+package org.txm.annotation.urs.view;
+
+import java.text.Collator;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.fieldassist.TXMAutoCompleteField;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuDetectEvent;
+import org.eclipse.swt.events.MenuDetectListener;
+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.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Combo;
+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.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.toolbar.URSAnnotationToolbar;
+import org.txm.rcp.IImageKeys;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.Message;
+import visuAnalec.Message.TypeMessage;
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.Corpus.CorpusListener;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Schema;
+import visuAnalec.elements.Unite;
+import visuAnalec.vue.Vue;
+
+public class ElementPropertiesView extends ViewPart {
+
+	public static final String ID = ElementPropertiesView.class.getName();
+
+	private LinkedHashMap<Combo, String> textWidgets = new LinkedHashMap<Combo, String>();
+	Element element;
+	URSAnnotationToolbar toolbar;
+
+	private ToolBar buttons;
+	private Composite fields;
+	private ToolItem firstButton;
+	private ToolItem previousButton;
+	private ToolItem nextButton;
+	private ToolItem lastButton;
+	RowData cData = new RowData();
+	private GridData lData;
+	private GridData tData;
+
+	private Corpus analecCorpus;
+	private Vue vue;
+	private CorpusListener corpusListener = new CorpusListener() {
+		@Override
+		public void traiterEvent(final Message e) {
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					//System.out.println("EVENT: "+e);
+					if (ElementPropertiesView.this.element == null) return;
+					if (fields == null || fields.isDisposed()) return;
+					
+					if (e.getType() == TypeMessage.MODIF_STRUCTURE) {
+						needUpdate = true;
+						loadElement(corpus, analecCorpus, element, toolbar);
+					}
+				}
+			});
+			
+		}
+	};
+
+	private boolean needUpdate = false;
+
+	private org.txm.searchengine.cqp.corpus.CQPCorpus corpus;
+
+//	private KeyListener allControlsKeyListener;
+
+	public static void closeView() {
+		try {
+			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+			ElementPropertiesView view = (ElementPropertiesView) page.findView(ElementPropertiesView.ID);
+
+			// close Element View if opened
+			if (view != null) {
+				view = (ElementPropertiesView) page.showView(ElementPropertiesView.ID);
+				page.hideView(view);
+			}
+
+			return;
+		} catch (PartInitException e1) {
+			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
+			Log.printStackTrace(e1);
+		}
+		return;
+	}
+	public static ElementPropertiesView openView() {
+		// open Element View if not opened
+		try {
+			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+			ElementPropertiesView view = (ElementPropertiesView) page.findView(ElementPropertiesView.ID);
+			if (view == null) {
+				view = (ElementPropertiesView) page.showView(ElementPropertiesView.ID);
+				if (view != null && !view.fields.isDisposed() && view.fields.getParent() != null) 
+					view.fields.getParent().layout(); // sometimes the part layout is broken
+			}
+			if (view == null) {
+				System.out.println("Error ElementPropertiesView view not found: "+ElementPropertiesView.ID);
+			}
+			return view;
+		} catch (PartInitException e1) {
+			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
+			Log.printStackTrace(e1);
+		}
+		return null;
+	}
+
+	@Override
+	public void createPartControl(Composite parent) {
+				
+		GridLayout layout = new GridLayout();
+		parent.setLayout(layout);
+		
+		//previous and next buttons
+		buttons = new ToolBar(parent, SWT.NONE);
+		GridData buttons_gdata = new GridData(GridData.FILL, GridData.CENTER, true, false);
+		buttons_gdata.horizontalSpan = 2;
+		buttons.setLayoutData(buttons_gdata);
+		firstButton = new ToolItem(buttons, SWT.PUSH);
+		firstButton.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
+		firstButton.setToolTipText("Select the first element");
+		firstButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (toolbar != null && !toolbar.isDisposed()) toolbar.selectFirst();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		previousButton = new ToolItem(buttons, SWT.PUSH);
+		previousButton.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
+		previousButton.setToolTipText("Select the previous element");
+		previousButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (toolbar != null && !toolbar.isDisposed()) toolbar.selectPrevious();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		nextButton = new ToolItem(buttons, SWT.PUSH);
+		nextButton.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
+		nextButton.setToolTipText("Select the next element");
+		nextButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (toolbar != null && !toolbar.isDisposed()) toolbar.selectNext();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		lastButton = new ToolItem(buttons, SWT.ARROW | SWT.END);
+		lastButton.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
+		lastButton.setToolTipText("Select the last element");
+		lastButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (toolbar != null && !toolbar.isDisposed()) toolbar.selectLast();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		fields = new Composite(parent, SWT.NONE);
+		GridData fields_gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
+		fields.setLayoutData(fields_gdata);
+		fields.setLayout(new RowLayout());
+		this.setPartName("Element");
+		
+		// GridDatas to use when a new field is added
+		cData.width = 325;
+		lData = new GridData(GridData.FILL, GridData.CENTER, false, false);
+		lData.minimumWidth = 75;
+		lData.widthHint = 75;
+		tData = new GridData(GridData.FILL, GridData.FILL, true, false);
+		tData.minimumWidth = 150;
+		tData.widthHint = 150;
+
+		parent.addDisposeListener(new DisposeListener() {
+			@Override
+			public void widgetDisposed(DisposeEvent e) {
+				try {
+					if (element != null) { // save previous unit changes
+						for (Combo t : textWidgets.keySet()) {
+							if (!t.isDisposed()) {
+								saveFieldValue(t);
+							}
+						}
+					}
+				} catch(Exception ex) { ex.printStackTrace();}
+			}
+		});
+	}
+
+	public void unloadElement(Corpus analecCorpus, URSAnnotationToolbar toolbar) {
+
+		if (this.element != null) { // save previous unit changes
+			for (Combo t : textWidgets.keySet()) {
+				if (!t.isDisposed()) {
+					saveFieldValue(t);
+				}
+			}
+		}
+		
+		if (this.analecCorpus != null) { // remove corpus listener from previous corpus
+			this.analecCorpus.removeEventListener(corpusListener);
+		}
+		
+		clear();
+		this.needUpdate = true;
+	}
+	
+	public void loadElement(org.txm.searchengine.cqp.corpus.CQPCorpus corpus, Corpus analecCorpus, Element newElement, URSAnnotationToolbar toolbar) {
+
+		if (this.element != null) { // save previous unit changes
+			for (Combo t : textWidgets.keySet()) {
+				if (!t.isDisposed()) saveFieldValue(t);
+				if (!t.isDisposed()) t.setText("");
+			}
+		}
+
+		if (this.analecCorpus != null) { // remove corpus listener from previous corpus
+			this.analecCorpus.removeEventListener(corpusListener);
+		}
+
+		this.corpus = corpus;
+		this.analecCorpus = analecCorpus;
+		this.analecCorpus.addEventListener(corpusListener);
+		this.vue = AnalecCorpora.getVue(analecCorpus);
+
+		if (this.needUpdate  || this.element == null || (!this.element.getType().equals(newElement.getType()))) { // no need to rebuild the widgets
+			needUpdate = false;
+			clear(); // remove all previous widgets
+
+			String[][] props = vue.getChamps(newElement.getClass(), newElement.getType());
+			for (int l = 0 ; l < props.length ; l++)
+				for (String p : props[l]) { // the first is the prop names
+
+					Composite c = new Composite(fields, SWT.NONE);
+					c.setLayoutData(cData);
+					c.setLayout(new GridLayout(2, false));
+					Label label = new Label(c, SWT.None);
+					label.setText(p);
+					label.setLayoutData(lData);
+
+					Combo t = new Combo(c, SWT.BORDER);
+					t.setLayoutData(tData);
+					textWidgets.put(t, p);
+					setItems(t, newElement);
+					t.addSelectionListener(new SelectionListener() {
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+							if (!(e.widget instanceof Combo)) return;
+							
+//							System.out.println("w:"+e.widget+" selected.");
+							saveFieldValue((Combo)e.widget);
+						}
+
+						@Override
+						public void widgetDefaultSelected(SelectionEvent e) {
+							
+						}
+					});
+				//	t.addKeyListener(allControlsKeyListener);
+					t.addKeyListener(new KeyListener() {
+						@Override
+						public void keyReleased(KeyEvent e) {
+							if (!(e.widget instanceof Combo)) return;
+							if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+//								System.out.println("w:"+e.widget+" key pressed2.");
+								
+								saveFieldValue((Combo)e.widget);
+							}
+//							else if (e.keyCode == SWT.DEL) {
+//								String value =((Combo) e.widget).getText();
+//								System.out.println("DEL prop="+textWidgets.get(e.widget)+" value="+value);
+//							}
+						}
+
+						@Override
+						public void keyPressed(KeyEvent e) { }
+					});
+					
+				}
+			fields.layout();
+			fields.getParent().layout();
+		}
+
+		Log.info("Refreshing unit properties view with: "+newElement);
+		this.toolbar = toolbar;
+		this.element = newElement;
+		for (Combo t : textWidgets.keySet()) {
+			if (newElement.getProps().get(textWidgets.get(t)) != null) {
+				t.setText(newElement.getProps().get(textWidgets.get(t)));
+			}
+		}
+		
+		if (newElement instanceof Unite) {
+			Unite unit = (Unite)newElement;
+			if (unit.getDeb() == unit.getFin())
+				this.setPartName(corpus.getName()+" - "+unit.getType()+" ["+unit.getDeb()+"]");
+			else
+				this.setPartName(corpus.getName()+" - "+unit.getType()+" ["+unit.getDeb()+"-"+unit.getFin()+"]");
+		} else if (newElement instanceof Schema) {
+			Schema schema = (Schema)newElement;
+			this.setPartName(corpus.getName()+" - "+schema.getType()+" "+schema.getUnitesSousjacentes().length+" unités");
+		}
+	}
+
+	protected void saveFieldValue(Combo t) {
+		if (toolbar == null || toolbar.isDisposed()) return;
+		
+		String newVal = t.getText().trim();
+		String v = ElementPropertiesView.this.vue.getValeurChamp(ElementPropertiesView.this.element, textWidgets.get(t));
+		if (!v.equals(newVal) && v != null) {
+			ElementPropertiesView.this.vue.setValeurChamp(ElementPropertiesView.this.element, textWidgets.get(t), newVal);
+			if (toolbar != null && !toolbar.isDisposed()) this.toolbar.fireIsDirty();
+		}
+	}
+	
+	private void setItems(Combo t, Element newElement) {
+		String[] items = vue.getValeursChamp(newElement.getClass(), newElement.getType(), textWidgets.get(t));
+		String lang = null;
+		
+		Arrays.sort(items, Collator.getInstance(Locale.getDefault()));
+		t.setItems(items);
+		KeyStroke keys = KeyStroke.getInstance(SWT.CONTROL, SWT.SPACE);
+		new TXMAutoCompleteField(t, new ComboContentAdapter(), items, keys);
+	}
+	public Element getCurrentElement() {
+		return element;
+	}
+
+	public Corpus getCurrentAnalecCorpus() {
+		return analecCorpus;
+	}
+
+	public void setFocusOnProperty() {
+		for (Combo w : textWidgets.keySet()) {
+			w.setFocus();
+			return;
+		}
+	}
+
+	public void clear() {
+		Control[] children = fields.getChildren();
+		for (int i = 0 ; i < children.length ; i++) { 
+			children[i].dispose();
+		}
+		textWidgets.clear();
+		fields.layout();
+	}
+	@Override
+	public void setFocus() {
+		// TODO Auto-generated method stub
+		
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementPropertiesView.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementSearchView.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementSearchView.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementSearchView.java	(revision 1200)
@@ -0,0 +1,636 @@
+package org.txm.annotation.urs.view;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.fieldassist.TXMAutoCompleteField;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+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.Text;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.annotation.urs.Messages;
+import org.txm.annotation.urs.toolbar.URSAnnotationToolbar;
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.concordance.rcp.handlers.ComputeConcordance;
+import org.txm.edition.rcp.handlers.BackToText;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.utils.SWTEditorsUtils;
+import org.txm.searchengine.cqp.ReferencePattern;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.FakeQueryResult;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.logger.Log;
+
+import visuAnalec.Message;
+import visuAnalec.Message.TypeMessage;
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.Corpus.CorpusListener;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Unite;
+import visuAnalec.vue.Vue;
+
+public class ElementSearchView extends ViewPart {
+
+	public static final String ID = ElementSearchView.class.getName();
+
+	private LinkedHashMap<Combo, String> textWidgets = new LinkedHashMap<Combo, String>();
+	Element currentElement = null;
+	int currentIndex = -1;
+	ArrayList<Element> matchingElements = new ArrayList<Element>();
+	URSAnnotationToolbar toolbar;
+
+	private Composite buttons;
+	private Composite fields;
+	private Text text;
+	private Label label;
+	private Button firstButton;
+	private Button previousButton;
+	private Button nextButton;
+	private Button lastButton;
+	private Button resetButton;
+	private Button searchButton;
+	private Button concordanceButton;
+	RowData cData = new RowData();
+	private GridData lData;
+	private GridData tData;
+
+	private Corpus analecCorpus;
+	private Class clazzSearched;
+	private String typeSearched;
+
+	private Vue vue;
+	private CorpusListener corpusListener = new CorpusListener() {
+		@Override
+		public void traiterEvent(final Message e) {
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					//System.out.println("EVENT: "+e);
+					if (fields == null || fields.isDisposed()) return;
+
+					if (e.getType() == TypeMessage.MODIF_STRUCTURE) {
+						needUpdate = true;
+						loadType(corpus, analecCorpus, clazzSearched, typeSearched, toolbar);
+					}
+				}
+			});
+		}
+	};
+
+	private boolean needUpdate = false;
+
+	private SelectionListener selectionChangedListener;
+
+	private org.txm.searchengine.cqp.corpus.CQPCorpus corpus;
+
+	private ConcordanceEditor concordanceEditor;
+
+	private IEditorPart fromEditor;
+
+	public static void closeView() {
+		try {
+			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+			ElementSearchView view = (ElementSearchView) page.findView(ElementSearchView.ID);
+
+			// close Element View if opened
+			if (view != null) {
+				view = (ElementSearchView) page.showView(ElementSearchView.ID);
+				page.hideView(view);
+			}
+
+			return;
+		} catch (PartInitException e1) {
+			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
+			Log.printStackTrace(e1);
+		}
+		return;
+	}
+	public static ElementSearchView openView() {
+		// open Element View if not opened
+		try {
+			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+			ElementSearchView view = (ElementSearchView) page.findView(ElementSearchView.ID);
+			if (view == null) {
+				view = (ElementSearchView) page.showView(ElementSearchView.ID);
+				if (view != null && !view.fields.isDisposed() && view.fields.getParent() != null) 
+					view.fields.getParent().layout(); // sometimes the part layout is broken
+			}
+			if (view == null) {
+				System.out.println("Error ElementPropertiesView view not found: "+ElementSearchView.ID);
+			}
+			return view;
+		} catch (PartInitException e1) {
+			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
+			Log.printStackTrace(e1);
+		}
+		return null;
+	}
+
+	@Override
+	public void createPartControl(Composite parent) {
+
+		GridLayout layout = new GridLayout();
+		parent.setLayout(layout);
+
+		//previous and next buttons
+		buttons = new Composite(parent, SWT.NONE);
+		buttons.setLayout(new GridLayout(10, false));
+		GridData buttons_gdata = new GridData(GridData.FILL, GridData.CENTER, true, false);
+		buttons_gdata.horizontalSpan = 2;
+		buttons.setLayoutData(buttons_gdata);
+
+		searchButton = new Button(buttons, SWT.PUSH);
+		searchButton.setText("OK");
+		searchButton.setToolTipText("Search elements using the search fields values");
+		searchButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				search();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		resetButton = new Button(buttons, SWT.PUSH);
+		resetButton.setImage(IImageKeys.getImage("platform:/plugin/org.txm.rcp/icons/cross.png"));
+		resetButton.setToolTipText("Reset the search field values");
+		resetButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				for (Combo c : textWidgets.keySet()) c.setText("");
+
+				ElementSearchView.this.concordanceButton.setEnabled(false);
+				ElementSearchView.this.firstButton.setEnabled(false);
+				ElementSearchView.this.previousButton.setEnabled(false);
+				ElementSearchView.this.nextButton.setEnabled(false);
+				ElementSearchView.this.lastButton.setEnabled(false);
+				ElementSearchView.this.text.setEnabled(false);
+				ElementSearchView.this.resetButton.setEnabled(false);
+				currentElement = null;
+				currentIndex = -1;
+				updateCurrentLabel();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		label = new Label(buttons, SWT.NONE);
+		label.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		label.setText("");
+
+		firstButton = new Button(buttons, SWT.PUSH);
+		firstButton.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
+		firstButton.setToolTipText("Select the first match");
+		firstButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				text.setText(""+1);
+				selectionChangedListener.widgetSelected(null);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		previousButton = new Button(buttons, SWT.PUSH);
+		previousButton.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
+		previousButton.setToolTipText("Select the previous match");
+		previousButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int current = Integer.parseInt(text.getText());
+				current--;
+				if (current < 1) current = 1;
+				text.setText(""+current);
+				selectionChangedListener.widgetSelected(null);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		text = new Text(buttons, SWT.BORDER);
+		text.setText("");
+		text.setToolTipText("Set a match number, and select it with the ENTER key");
+		selectionChangedListener = new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (toolbar == null || toolbar.isDisposed()) return; 
+				//System.out.println("SELECTED!!");
+				try {
+					currentIndex = Integer.parseInt(text.getText())-1;
+					currentElement = matchingElements.get(currentIndex);
+					toolbar.select(currentElement);
+					updateCurrentLabel();
+				} catch(Exception err) {
+					System.out.println("Could not set current match: "+err.getLocalizedMessage());
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		};
+		text.addSelectionListener(selectionChangedListener);
+		text.addKeyListener(new KeyListener() {
+			@Override
+			public void keyReleased(KeyEvent e) {
+				if (currentElement == null) return;
+
+				if (e.keyCode == SWT.HOME) {
+					text.setText(""+1);
+					selectionChangedListener.widgetSelected(null);
+				} else if (e.keyCode == SWT.END) {
+					text.setText(""+matchingElements.size());
+					selectionChangedListener.widgetSelected(null);
+				} else if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR ) {
+					selectionChangedListener.widgetSelected(null);
+				}
+			}
+
+			@Override
+			public void keyPressed(KeyEvent e) { }
+		});
+
+		GridData gdata = new GridData(GridData.FILL, GridData.FILL, false, false);
+		gdata.minimumWidth = 100;
+		gdata.widthHint = 100;
+		text.setLayoutData(gdata);
+		label = new Label(buttons, SWT.NONE);
+		label.setText(" / -");
+
+		nextButton = new Button(buttons, SWT.PUSH);
+		nextButton.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
+		nextButton.setToolTipText("Select the next match");
+		nextButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int current = Integer.parseInt(text.getText());
+				current++;
+				if (current > matchingElements.size()) current = matchingElements.size();
+				text.setText(""+current);
+				selectionChangedListener.widgetSelected(null);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		lastButton = new Button(buttons, SWT.PUSH);
+		lastButton.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
+		lastButton.setToolTipText("Select the last match");
+		lastButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				text.setText(""+matchingElements.size());
+				selectionChangedListener.widgetSelected(null);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		concordanceButton = new Button(buttons, SWT.PUSH);
+		concordanceButton.setImage(IImageKeys.getImage(ConcordanceEditor.class, IImageKeys.ACTION_CONCORDANCES));
+		concordanceButton.setToolTipText("View the matches in concordances");
+		concordanceButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				try {
+					toConcordances(e);
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		this.searchButton.setEnabled(false);
+		this.concordanceButton.setEnabled(false);
+		this.firstButton.setEnabled(false);
+		this.previousButton.setEnabled(false);
+		this.nextButton.setEnabled(false);
+		this.lastButton.setEnabled(false);
+		this.text.setEnabled(false);
+		this.resetButton.setEnabled(false);
+
+		fields = new Composite(parent, SWT.NONE);
+		GridData fields_gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
+		fields.setLayoutData(fields_gdata);
+		fields.setLayout(new RowLayout());
+		this.setPartName("Element");
+
+		// GridDatas to use when a new field is added
+		cData.width = 325;
+		lData = new GridData(GridData.FILL, GridData.CENTER, false, false);
+		lData.minimumWidth = 75;
+		lData.widthHint = 75;
+		tData = new GridData(GridData.FILL, GridData.FILL, true, false);
+		tData.minimumWidth = 150;
+		tData.widthHint = 150;
+
+		updateCurrentLabel();
+	}
+
+	protected void updateCurrentLabel() {
+		if (currentIndex >= 0) {
+			this.setPartName(""+(currentIndex+1)+" / "+matchingElements.size()+" "+typeSearched);
+			text.setText(""+(currentIndex+1));
+			label.setText(" / "+matchingElements.size());
+			text.setEnabled(true);
+		} else {
+			if (typeSearched != null) this.setPartName(typeSearched);
+			text.setText("1");
+			text.setEnabled(false);
+			label.setText(" / -");
+		}
+	}
+
+	/**
+	 * 
+	 * @param corpus the CQP corpus 
+	 * @param analecCorpus the analec corpus
+	 * @param clazz the search Analec Element class (Unite, Schema, Relation)
+	 * @param type the searched Element type
+	 * @param toolbar the annotation toolbar which called loadType
+	 */
+	public void loadType(org.txm.searchengine.cqp.corpus.CQPCorpus corpus, Corpus analecCorpus, Class clazz, String type, URSAnnotationToolbar toolbar) {
+		if (toolbar == null || toolbar.isDisposed()) return;
+
+		this.searchButton.setEnabled(true);
+
+		if (this.analecCorpus != null) { // remove corpus listener from previous corpus
+			this.analecCorpus.removeEventListener(corpusListener);
+		}
+
+		this.fromEditor = toolbar.getEditor();
+		if (this.corpus != corpus && concordanceEditor != null) {
+			concordanceEditor = null;
+		}
+		this.corpus = corpus;
+		this.analecCorpus = analecCorpus;
+		this.analecCorpus.addEventListener(corpusListener);
+		this.vue = AnalecCorpora.getVue(analecCorpus);
+
+		if (this.needUpdate  || type.equals(type)) { // no need to rebuild the widgets
+			needUpdate = false;
+			clear(); // remove all previous widgets
+
+			String[][] props = vue.getChamps(clazz, type);
+			if (props.length > 0)
+				for (String p : props[0]) { // the first is the prop names
+
+					Composite c = new Composite(fields, SWT.NONE);
+					c.setLayoutData(cData);
+					c.setLayout(new GridLayout(2, false));
+					Label l = new Label(c, SWT.None);
+					l.setText(p);
+					l.setLayoutData(lData);
+
+					Combo t = new Combo(c, SWT.BORDER);
+					t.setLayoutData(tData);
+					textWidgets.put(t, p);
+					setItems(t, clazz, type, p);
+					t.addKeyListener(new KeyListener() {
+						@Override
+						public void keyReleased(KeyEvent e) {
+							if (!(e.widget instanceof Combo)) return;
+							if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+								search();
+							}
+						}
+
+						@Override
+						public void keyPressed(KeyEvent e) { }
+					});
+				}
+			fields.layout();
+			fields.getParent().layout();
+		}
+
+		this.toolbar = toolbar;
+		this.clazzSearched = clazz;
+		this.typeSearched = type;
+
+		this.setPartName(corpus.getName()+" - "+typeSearched);
+	}
+	public static final String letters = "abcefghijklmnopqrstu";//vwxyz0123456789";
+	public static final int MAXCONCORDANCEQUERYSIZE = 1150; // 1200 in fact
+	//	public static String[] doubleletters = new String[letters.length()+ (letters.length()*letters.length())];
+	//	static {
+	//		for (int i = 0 ; i < letters.length() ; i++) doubleletters[i] = ""+letters.charAt(i);
+	//		for (int i = 0 ; i < letters.length() ; i++) 
+	//			for (int j = 0 ; j < letters.length() ; j++) doubleletters[letters.length()+ i + (j*letters.length())] = ""+letters.charAt(i)+letters.charAt(j);
+	//		System.out.println(Arrays.toString(doubleletters));
+	//	}
+	//	
+	//	/**
+	//	 * just a simple way to create a label using the match length
+	//	 * @param size
+	//	 * @return a uniq String if size is < to doubleletters.length()
+	//	 */
+	//	public static String getLetter(int size) {
+	//		if (size >= doubleletters.length) return "zzz";
+	//		else return doubleletters[size];
+	//	}
+	public void toConcordances(SelectionEvent e) throws Exception {
+		if (matchingElements.size() == 0) return;
+
+		LinkedHashSet<Unite> unites = new LinkedHashSet<Unite>();
+		for (Element m : matchingElements) {
+			for (Unite unite : m.getUnitesSousjacentes()) {
+				unites.add(unite);
+			}
+		}
+		
+		List<Unite> unites_list = new ArrayList<Unite>();
+		unites_list.addAll(unites);
+		Collections.sort(unites_list);
+		
+		int[] starts = new int[unites.size()];
+		int[] ends = new int[unites.size()];
+		int[] targets = null;
+
+		int i = 0;
+		for (Unite u : unites_list) {
+			starts[i] = u.getDeb();
+			ends[i] = u.getFin();
+			i++;
+		}
+
+		FakeQueryResult fqr = new FakeQueryResult("SearchViewLink", toolbar.getCQPCorpus(), new CQLQuery(""), 
+				starts, ends, targets);
+
+		HashSet<Integer> sizes = new HashSet<Integer>();
+		for (Unite unite : unites) {
+			int size = unite.getFin() - unite.getDeb()+1;
+			if (size > letters.length()) size = letters.length()-1;
+			sizes.add(size);
+		}
+
+		List<WordProperty> viewProperties = Arrays.asList(corpus.getWordProperty());
+		ReferencePattern ref = new ReferencePattern(corpus.getStructuralUnit("text").getProperty("id"));
+		final Concordance concordance = new Concordance(corpus);
+		concordance.setParameters(new CQLQuery(""), 
+				viewProperties, viewProperties, viewProperties,
+				viewProperties, viewProperties, viewProperties, 
+				ref, ref, 
+				7, 10);
+		concordance.compute();
+		
+		e.widget.getDisplay().syncExec(new Runnable() {
+			
+			@Override
+			public void run() {
+//				if (concordanceEditor == null || // no editor opened
+//						concordanceEditor.getLineTableViewer().getTable().isDisposed() // editor was closed
+//						|| !concordanceEditor.getCorpus().equals(corpus)) { // editor opened but with different corpus
+//					
+//					IEditorPart editor = ComputeConcordance.openEditor(concordance);
+//					if (editor == null) {
+//						return;
+//					}
+//					concordanceEditor = (ConcordanceEditor) editor;
+//						if (toolbar.getEditor() != null) {
+//							SWTEditorsUtils.addEditor(toolbar.getEditor(), concordanceEditor, EModelService.BELOW);
+//						}
+//						BackToText.associateEditors(toolbar.getEditor(), concordanceEditor);
+//				} else {
+//					concordanceEditor.setConcordance(corpus, concordance);
+//				}
+//
+//				concordanceEditor.compute(true);
+//				IWorkbenchPage attachedPage = concordanceEditor.getEditorSite().getPage();
+//				attachedPage.activate(concordanceEditor);
+			}
+		});
+	}
+
+	/**
+	 * start a new search
+	 */
+	public void search() {
+		if (toolbar == null || toolbar.isDisposed()) return;
+
+		ArrayList<? extends Element> elements = analecCorpus.getElements(clazzSearched, typeSearched);
+		matchingElements.clear();
+		for (Element e : elements) {
+			boolean insert = true;
+			for (Combo w : textWidgets.keySet()) {
+				if (w.getText().trim().length() > 0 
+						&& !e.getProp(textWidgets.get(w)).matches(w.getText())) {
+					insert = false;
+					continue;
+				}
+			}
+			if (insert) matchingElements.add(e);
+		}
+
+		if (matchingElements.size() > 0) {
+
+			// sort elements
+			Collections.sort(matchingElements, new Comparator<Element>() {
+				@Override
+				public int compare(Element o1, Element o2) {
+					if (o1 == null) return 1;
+					else if (o2 == null) return -1;
+					else if (o1.getUnite0().getDeb() < o2.getUnite0().getDeb()) {
+						return -1;
+					} else if (o1.getUnite0().getDeb() > o2.getUnite0().getDeb()) {
+						return 1;
+					} else if (o1.getUnite0().getFin() < o2.getUnite0().getFin()) {
+						return -1;
+					} else if (o1.getUnite0().getFin() > o2.getUnite0().getFin()) {
+						return 1;
+					}
+					return 0;
+				}
+			});
+
+			currentElement = matchingElements.get(0);
+			currentIndex = 0;
+			toolbar.select(currentElement);
+			updateCurrentLabel();
+			this.searchButton.setEnabled(true);
+			this.concordanceButton.setEnabled(true);
+			this.firstButton.setEnabled(true);
+			this.previousButton.setEnabled(true);
+			this.nextButton.setEnabled(true);
+			this.lastButton.setEnabled(true);
+			this.text.setEnabled(true);
+			this.resetButton.setEnabled(true);
+		} else {
+			this.concordanceButton.setEnabled(false);
+			this.firstButton.setEnabled(false);
+			this.previousButton.setEnabled(false);
+			this.nextButton.setEnabled(false);
+			this.lastButton.setEnabled(false);
+			this.text.setEnabled(false);
+			this.resetButton.setEnabled(false);
+			currentElement = null;
+			currentIndex = -1;
+			updateCurrentLabel();
+		}
+	}
+
+	private void setItems(Combo t, Class clazz, String type, String prop) {
+		String[] items = vue.getValeursChamp(clazz, type, prop);
+		t.setItems(items);
+		KeyStroke keys = KeyStroke.getInstance(SWT.CONTROL, SWT.SPACE);
+		new TXMAutoCompleteField(t, new ComboContentAdapter(), items, keys);
+	}
+
+	public Corpus getCurrentAnalecCorpus() {
+		return analecCorpus;
+	}
+
+	@Override
+	public void setFocus() {
+		for (Combo w : textWidgets.keySet()) {
+			w.setFocus();
+			return;
+		}
+	}
+
+	public void clear() {
+		Control[] children = fields.getChildren();
+		for (int i = 0 ; i < children.length ; i++) { 
+			children[i].dispose();
+		}
+		textWidgets.clear();
+		fields.layout();
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementSearchView.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallAnalecFiles.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallAnalecFiles.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallAnalecFiles.java	(revision 1200)
@@ -0,0 +1,44 @@
+package org.txm.annotation.urs;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.txm.PostTXMHOMEInstallationStep;
+import org.txm.Toolbox;
+import org.txm.objects.Workspace;
+import org.txm.utils.BundleUtils;
+import org.txm.utils.io.FileCopy;
+
+/**
+ * Copy all Groovy scripts in TXMHome directory
+ * 
+ * @author mdecorde
+ *
+ */
+public class InstallAnalecFiles extends PostTXMHOMEInstallationStep {
+
+	@Override
+	public boolean install(Workspace workspace) {
+		File txmhomedir = new File(Toolbox.getTxmHomePath());
+		
+		String createfolders[] = { "scripts/groovy/user"}; //$NON-NLS-1$
+		
+		for (String folder : createfolders) {
+			new File(txmhomedir, folder).mkdirs();
+		}
+		File scriptsDirectory = new File(txmhomedir, "scripts/groovy");
+		File userDirectory = new File(scriptsDirectory, "user");
+		File macroDirectory = new File(userDirectory, "org/txm/macro");
+		File analecMacroDirectory = new File(macroDirectory, "analec");
+	
+		String bundle_id = "org.txm.analec.rcp";
+		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "analec", macroDirectory);
+		
+		return analecMacroDirectory.exists();
+	}
+
+	@Override
+	public String getName() {
+		return "Analec (org.txm.analec.rcp)";
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallAnalecFiles.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/AnalecAnnotationTEIExporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/AnalecAnnotationTEIExporter.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/AnalecAnnotationTEIExporter.java	(revision 1200)
@@ -0,0 +1,565 @@
+package org.txm.annotation.urs.export;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.importer.StaxIdentityParser;
+import org.txm.importer.PersonalNamespaceContext;
+import org.txm.rcp.Application;
+import org.txm.rcp.TxmPreferences;
+import org.txm.scripts.importer.StaxStackWriter;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.utils.BundleUtils;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.zip.Zip;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.Structure;
+import visuAnalec.elements.Element;
+import visuAnalec.elements.Relation;
+import visuAnalec.elements.Schema;
+import visuAnalec.elements.Unite;
+import visuAnalec.fichiers.FichiersGlozz;
+import visuAnalec.vue.Vue;
+
+/**
+ * Analec annotations exporter. It uses the XML-TXM format described at https://groupes.renater.fr/wiki/txm-info/public/xml_tei_txm
+ * 
+ * @author mdecorde
+ *
+ */
+public class AnalecAnnotationTEIExporter {
+
+	public static final DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
+	
+	protected File outputDirectory;
+	protected MainCorpus mainCorpus;
+	protected Property wordid;
+	protected Corpus analecCorpus;
+	protected Vue analecVue;
+	protected IProgressMonitor monitor;
+
+	/**
+	 * 
+	 * @param monitor may be null
+	 * @param outputDirectory
+	 * @param mainCorpus
+	 * @param analecCorpus
+	 * @param analecVue
+	 */
+	public AnalecAnnotationTEIExporter(IProgressMonitor monitor, File outputDirectory, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
+		this.outputDirectory = outputDirectory;
+		this.mainCorpus = mainCorpus;
+		this.analecCorpus = analecCorpus;
+		this.analecVue = analecVue;
+		this.monitor = monitor;
+	}
+
+	/**
+	 * 1- Copy the XML-TXM files
+	 * 2- Write the annotations
+	 * 3- Write the structure
+	 * 
+	 * @return true if success
+	 * @throws Exception
+	 */
+	public boolean process(boolean standoff, boolean createArchive) throws Exception {
+		if (!standoff) {
+			System.out.println("Inligned annotations not implemented yet. Aborting");
+			return false;
+		}
+
+		wordid = mainCorpus.getProperty("id");
+		int[] starts = mainCorpus.getTextStartLimits();
+		int[] ends = mainCorpus.getTextEndLimits();
+		StructuralUnit su_text = mainCorpus.getStructuralUnit("text");
+		int[] strucs = CQPSearchEngine.getCqiClient().cpos2Struc(su_text.getQualifiedName(), starts);
+		String[] ids = CQPSearchEngine.getCqiClient().struc2Str(su_text.getProperty("id").getQualifiedName(), strucs);
+
+		File textsDirectory = new File(outputDirectory, "texts");
+		textsDirectory.mkdir();
+		File annotationsDirectory = new File(outputDirectory, "annotations");
+		if (standoff) annotationsDirectory.mkdir();
+
+		if (monitor != null) monitor.beginTask("Writing annotations...", starts.length);
+		for (int i = 0 ; i < starts.length ; i++) {
+			File xmltxmFile = new File(textsDirectory, ids[i]+".xml");
+			File xmltxmAnalecFile = new File(annotationsDirectory, ids[i]+"-urs.xml");
+			if (monitor != null) monitor.subTask(ids[i]+" text...");
+			processText(standoff, xmltxmFile, xmltxmAnalecFile, ids[i], starts[i], ends[i]);
+			if (monitor != null) monitor.worked(1);
+		}
+
+		if (monitor != null) monitor.beginTask("Writing structure", 1);
+
+		//FichiersGlozz.exporterModeleGlozz(analecCorpus.getStructure());
+		File xmltxmStructureFile = new File(outputDirectory, mainCorpus.getName()+".aam");
+		PrintWriter model = new PrintWriter(xmltxmStructureFile, "UTF-8");
+		FichiersGlozz.ModelGlozzPrinter gp = new FichiersGlozz.ModelGlozzPrinter(analecCorpus.getStructure(), model);
+		gp.ecrireModel();
+		model.close();
+
+		//		File xmltxmStructureFile = new File(outputDirectory, mainCorpus.getName()+"-structure.xml");
+		//		StaxStackWriter writer = new StaxStackWriter(xmltxmStructureFile);
+		//		PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+		//		writer.setNamespaceContext(Nscontext);
+		//		writer.writeStartElement(StaxIdentityParser.TEINS, "TEI");
+		//		writer.writeNamespace("tei", StaxIdentityParser.TEINS);
+		//		writer.writeStartElement("teiHeader");
+		//		writer.writeStartElement("fileDesc");
+		//		writer.writeStartElement("titleStmt");
+		//		writer.writeStartElement("title");
+		//		writer.writeCharacters(mainCorpus.getName()+" - structure");
+		//		writer.writeEndElement(); // title
+		//		writer.writeStartElement("respStmt");
+		//		writer.writeStartElement("resp");
+		//		writer.writeCharacters("annotated by");
+		//		writer.writeEndElement(); // resp
+		//		writer.writeStartElement("name");
+		//		writer.writeCharacters("non renseigné");
+		//		writer.writeEndElement(); // name
+		//		writer.writeEndElement(); // respStmt
+		//		writer.writeEndElement(); // titleStmt
+		//		writer.writeStartElement("publicationStmt");
+		//		writer.writeStartElement("publisher");
+		//		writer.writeCharacters("non renseigné");
+		//		writer.writeEndElement(); // publisher
+		//		writer.writeEndElement(); // publicationStmt
+		//		writer.writeStartElement("sourceDesc");
+		//		writer.writeStartElement("bibl");
+		//		writer.writeCharacters("non renseigné");
+		//		writer.writeEndElement(); // bibl
+		//		writer.writeEndElement(); // sourceDesc
+		//		writer.writeEndElement(); // fileDesc
+		//		writer.writeEndElement(); // teiHeader
+		//		writer.writeStartElement("text");
+		//		writer.writeStartElement("back");
+		//		writeStructure(writer);
+		//		writer.writeEndElement(); // back
+		//		writer.writeEndElement(); // text
+		//		writer.writeEndElement(); // TEI
+		//		writer.close();
+
+		if (monitor != null) monitor.worked(1);
+
+		if (createArchive) {
+			if (monitor != null) monitor.subTask("Creating archive...");
+			File zipArchive = new File(outputDirectory+".urs");
+			Zip.compress(outputDirectory, zipArchive);
+			DeleteDir.deleteDirectory(outputDirectory);
+			System.out.println("Done: "+zipArchive);
+		} else {
+			System.out.println("Done: "+outputDirectory);
+		}
+
+		return true;
+	}
+
+	protected boolean processText(boolean standoff, File xmltxmFile, File xmltxmAnalecFile, String textid, int from, int to) throws Exception {
+		System.out.println("Processing text: "+textid);
+
+		// 1) copy the XML-TXM file
+		File xmltxmFileFromBin = new File(mainCorpus.getProjectDirectory(), "txm/"+mainCorpus.getName().toUpperCase()+"/"+textid+".xml");
+		if (!xmltxmFileFromBin.exists()) {
+			System.out.println("Error: could not find the XML-TXM reference file: "+xmltxmFileFromBin);
+			return false;
+		}
+
+		if (!FileCopy.copy(xmltxmFileFromBin, xmltxmFile)) {
+			System.out.println("Error: could not copy the XML-TXM reference file: "+xmltxmFileFromBin);
+			return false;
+		}
+
+		XMLStreamWriter writer = null;
+		HookableStaxIdentityParser identidywriter = null;
+		if (standoff) { // write a new file
+			writer = new StaxStackWriter(xmltxmAnalecFile);
+			PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
+			writer.setNamespaceContext(Nscontext);
+			writer.writeStartElement(StaxIdentityParser.TEINS, "TEI");
+			writer.writeNamespace("tei", StaxIdentityParser.TEINS);writer.writeCharacters("\n");
+			writer.writeStartElement("teiHeader");writer.writeCharacters("\n");
+			writer.writeStartElement("fileDesc");writer.writeCharacters("\n");
+			writer.writeStartElement("titleStmt");writer.writeCharacters("\n");
+			writer.writeStartElement("title");writer.writeCharacters("\n");
+			writer.writeCharacters(textid+" - annotations");
+			writer.writeEndElement(); // title
+			writer.writeCharacters("\n");
+			writer.writeStartElement("respStmt");writer.writeCharacters("\n");
+			writer.writeStartElement("resp");writer.writeCharacters("\n");
+			writer.writeCharacters("annotated by");
+			writer.writeEndElement(); // resp
+			writer.writeCharacters("\n");
+			writer.writeStartElement("name");writer.writeCharacters("\n");
+			writer.writeCharacters(System.getProperty("user.name"));
+			writer.writeEndElement(); // name
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // respStmt
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // titleStmt
+			writer.writeCharacters("\n");
+			writer.writeStartElement("publicationStmt");writer.writeCharacters("\n");
+			writer.writeStartElement("publisher");writer.writeCharacters("\n");
+			writer.writeCharacters("non renseigné");
+			writer.writeEndElement(); // publisher
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // publicationStmt
+			writer.writeCharacters("\n");
+			writer.writeStartElement("sourceDesc");writer.writeCharacters("\n");
+			writer.writeStartElement("bibl");writer.writeCharacters("\n");
+			writer.writeCharacters("non renseigné");
+			writer.writeEndElement(); // bibl
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // sourceDesc
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // fileDesc
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // teiHeader
+			writer.writeCharacters("\n");
+			writer.writeStartElement("text");writer.writeCharacters("\n");
+			writer.writeEndElement(); // text
+		} else {
+			identidywriter = new HookableStaxIdentityParser(xmltxmFile, "text");
+			identidywriter.process(xmltxmAnalecFile);
+			writer = identidywriter.getWriter();
+		}
+
+		try {
+			writer.writeStartElement("standOff");writer.writeCharacters("\n");
+			writer.writeStartElement("soHeader");writer.writeCharacters("\n");
+			writer.writeStartElement("titleStmt");writer.writeCharacters("\n");
+			writer.writeStartElement("title");writer.writeCharacters("\n");
+			writer.writeCharacters("URS annotations");
+			writer.writeEndElement(); // title
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // titleStmt
+			writer.writeCharacters("\n");
+			writer.writeStartElement("respStmt");writer.writeCharacters("\n");
+			writer.writeStartElement("resp");writer.writeCharacters("\n");
+			writer.writeStartElement("name");
+			writer.writeAttribute("id", System.getProperty("user.name"));
+			writer.writeCharacters("\n");
+			writer.writeCharacters(System.getProperty("user.name"));
+			writer.writeEndElement(); // name
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // resp
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // respStmt
+			writer.writeCharacters("\n");
+			writer.writeStartElement("revisionDesc");writer.writeCharacters("\n");
+			writer.writeStartElement("change");
+			writer.writeAttribute("who", "#"+System.getProperty("user.name"));
+			writer.writeAttribute("when", dateformat.format(Calendar.getInstance().getTime()));
+			writer.writeCharacters("\n");
+			writer.writeCharacters("Created with TXM "+BundleUtils.getBundleVersion("org.txm.rcp")+" and Analec extension "+BundleUtils.getBundleVersion("AnalecRCP")+" with 'XML-TEI-URS Export....' export command on "+mainCorpus.getName()+" corpus");
+			writer.writeEndElement(); // change
+			writer.writeEndElement(); // revisionDesc
+			writer.writeStartElement("encodingDesc");writer.writeCharacters("\n");
+			writer.writeStartElement("listPrefixDef");writer.writeCharacters("\n");
+			writer.writeStartElement("prefixDef");
+			writer.writeAttribute("ident", "text");
+			writer.writeAttribute("matchPattern", "(.+)");
+			writer.writeAttribute("replacementPattern", "../texts/"+xmltxmFile.getName()+"#$1");
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // prefixDef
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // listPrefixDef
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // encodingDesc
+			writer.writeCharacters("\n");
+			writer.writeEndElement(); // soHeader
+			writer.writeCharacters("\n");
+			writer.writeStartElement("annotations");
+			writer.writeAttribute("type", "coreference");
+			writer.writeCharacters("\n");
+			ArrayList<Element> writtenElements = new ArrayList<Element>();
+			writtenElements.addAll(writeUnits(writer, from, to));
+			writtenElements.addAll(writeRelations(writer, from, to));
+			writtenElements.addAll(writeSchemas(writer, from, to));
+			//			System.out.println("Written:");
+			//			for (Element e : writtenElements) System.out.print(" "+buildId(e));
+			//			System.out.println("");
+			writeProperties(writer, writtenElements);
+			//writeStructure(writer);
+			writer.writeEndElement(); // annotations
+			writer.writeEndElement(); // standOff
+
+			writtenElements.clear();
+
+			writer.writeEndElement(); // TEI
+
+			if (identidywriter != null) identidywriter.close();
+			else writer.close();
+		} catch(Exception e) {
+			writer.close();
+			System.out.println("Error: "+e.getLocalizedMessage());
+			e.printStackTrace();
+			return false;
+		}
+
+		return true;
+	}
+
+	protected String buildId(Element e) {
+		if (e instanceof Unite) return "u-"+analecVue.getIdElement(e);
+		else if (e instanceof Schema) return "s-"+analecVue.getIdElement(e);
+		else if (e instanceof Relation) return "r-"+analecVue.getIdElement(e);
+		else return "iderror:"+e;
+	}
+
+	protected HashSet<Element> writeUnits(XMLStreamWriter writer, int from, int to) throws Exception {
+		HashSet<Element> written = new HashSet<Element>();
+		
+		for (String type : analecCorpus.getStructure().getUnites()) {
+			ArrayList<Unite> unites = analecCorpus.getUnites(type);
+			Collections.sort(unites, new Comparator<Unite>() {
+				@Override
+				public int compare(Unite u1, Unite u2) {
+					if (u1.getDeb() < u2.getDeb()) return -1;
+					if (u1.getDeb() > u2.getDeb()) return 1;
+					if (u1.getFin() < u2.getFin()) return -1;
+					if (u1.getFin() > u2.getFin()) return 1;
+					return 0;
+				}
+			});
+			writer.writeStartElement("annotationGrp");
+			writer.writeAttribute("type", "Unit");
+			writer.writeAttribute("subtype", type);
+			writer.writeCharacters("\n");
+			for (Unite unite : unites) {
+				if (unite.getDeb() > to) continue; // commence apres le texte
+				if (unite.getFin() < from) continue; // termine avant le texte
+
+				String id = buildId(unite);
+				writer.writeStartElement("span");
+				writer.writeAttribute("id", id);
+				int[] cpos = {unite.getDeb(), unite.getFin()};
+				String[] wordids = CQPSearchEngine.getCqiClient().cpos2Str(wordid.getQualifiedName(), cpos);
+				writer.writeAttribute("from", "text:"+wordids[0]);
+				writer.writeAttribute("to", "text:"+wordids[1]);
+				writer.writeAttribute("ana", "#"+id+"-fs");
+				writer.writeEndElement(); // span
+				writer.writeCharacters("\n");
+				written.add(unite);
+			}
+			writer.writeEndElement(); // spanGrp
+			writer.writeCharacters("\n");
+		}
+		return written;
+	}
+
+	protected HashSet<Element> writeRelations(XMLStreamWriter writer, int from, int to) throws XMLStreamException {
+		HashSet<Element> written = new HashSet<Element>();
+		for (String type : analecCorpus.getStructure().getRelations()) {
+			ArrayList<Relation> relations = analecCorpus.getRelations(type);
+			Collections.sort(relations, new Comparator<Relation>() {
+				@Override
+				public int compare(Relation r1, Relation r2) {
+					Unite u1 = r1.getUnite0();
+					Unite u2 = r2.getUnite0();
+					if (u1.getDeb() < u2.getDeb()) return -1;
+					if (u1.getDeb() > u2.getDeb()) return 1;
+					if (u1.getFin() < u2.getFin()) return -1;
+					if (u1.getFin() > u2.getFin()) return 1;
+					return 0;
+				}
+			});
+			writer.writeStartElement("annotationGrp");
+			writer.writeAttribute("type", "Relation");
+			writer.writeAttribute("subtype", type);
+			writer.writeCharacters("\n");
+			for (Relation relation : relations) {
+
+				Element e1 = relation.getElt1();
+				Element e2 = relation.getElt2();
+				if (e1 instanceof Unite && e2 instanceof Unite) {
+					Unite u1 = (Unite)e1;
+					Unite u2 = (Unite)e2;
+					if (u1.getDeb() > to) continue; // commence apres le texte
+					if (u1.getFin() < from) continue; // termine avant le texte
+					if (u2.getDeb() > to) continue; // commence apres le texte
+					if (u2.getFin() < from) continue; // termine avant le texte
+				} else {
+					continue; // TODO: implement other cases
+				}
+				String id = buildId(relation);
+				writer.writeStartElement("link");
+				writer.writeAttribute("id", id);
+				writer.writeAttribute("target", "#"+buildId(e1)+" #"+buildId(e2));
+				writer.writeAttribute("ana", "#"+id+"-fs");
+				writer.writeEndElement(); // join
+				writer.writeCharacters("\n");
+				written.add(relation);
+			}
+			writer.writeEndElement(); // joinGrp
+			writer.writeCharacters("\n");
+		}
+
+		return written;
+	}
+
+	protected HashSet<Element> writeSchemas(XMLStreamWriter writer, int from, int to) throws XMLStreamException {
+		HashSet<Element> writtenSchemas = new HashSet<Element>();
+		for (String type : analecCorpus.getStructure().getSchemas()) {
+			ArrayList<Schema> schemas = analecCorpus.getSchemas(type);
+			Collections.sort(schemas, new Comparator<Schema>() {
+				@Override
+				public int compare(Schema s1, Schema s2) {
+					Unite u1 = s1.getUnite0();
+					if (u1 == null) return -1;
+					Unite u2 = s2.getUnite0();
+					if (u2 == null) return 1;
+					if (u1.getDeb() < u2.getDeb()) return -1;
+					if (u1.getDeb() > u2.getDeb()) return 1;
+					if (u1.getFin() < u2.getFin()) return -1;
+					if (u1.getFin() > u2.getFin()) return 1;
+					return 0;
+				}
+			});
+			writer.writeStartElement("annotationGrp");
+			writer.writeAttribute("type", "Schema");
+			writer.writeAttribute("subtype", type);
+			writer.writeCharacters("\n");
+			for (Schema schema : schemas) {
+
+				HashSet<String> elements = new HashSet<String>();
+				for (Element e : schema.getContenu()) {
+					if (e instanceof Unite) {
+						Unite unite = (Unite)e;
+						if (unite.getDeb() > to) continue; // commence apres le texte
+						if (unite.getFin() < from) continue; // termine avant le texte
+						elements.add("#"+buildId(unite));
+					} else {
+						continue;
+						// TODO: to implement
+					}
+				}
+				if (elements.size() == 0) continue;
+
+				String id = buildId(schema);
+				writer.writeStartElement("link");
+				writer.writeAttribute("id", id);
+				writer.writeAttribute("target", StringUtils.join(elements, " "));
+				writer.writeAttribute("ana", "#"+id+"-fs");
+				writer.writeEndElement(); // span
+				writer.writeCharacters("\n");
+
+				writtenSchemas.add(schema);
+			}
+			writer.writeEndElement(); // join
+			writer.writeCharacters("\n");
+		}
+		return writtenSchemas;
+	}
+
+	protected void writeProperties(XMLStreamWriter writer, ArrayList<Element> writtenElements) throws Exception {
+		//writer.writeStartElement("fvLib");
+		//writer.writeAttribute("type", "AnalecElementProperties");
+		//writer.writeCharacters("\n");
+		Collections.sort(writtenElements, new Comparator<Element>() {
+			@Override
+			public int compare(Element o1, Element o2) {
+				Unite u1 = o1.getUnite0();
+				Unite u2 = o2.getUnite0();
+				if (u1.getDeb() < u2.getDeb()) return -1;
+				if (u1.getDeb() > u2.getDeb()) return 1;
+				if (u1.getFin() < u2.getFin()) return -1;
+				if (u1.getFin() > u2.getFin()) return 1;
+				return 0;
+			}
+		});
+
+		String[] fstypes = {"unit-fs", "relation-fs", "schema-fs"};
+		Class[] classes = {Unite.class, Relation.class, Schema.class};
+		
+		for (int i = 0 ; i < fstypes.length ; i++) {
+			Class c = classes[i];
+			String type = fstypes[i];
+			
+			writer.writeStartElement("div");
+			writer.writeAttribute("type", type);
+			
+			for (Element e : writtenElements) {
+				
+				if (!(e.getClass().equals(c))) continue;
+				
+				writer.writeStartElement("fs");
+				writer.writeAttribute("id", buildId(e)+"-fs");
+				writer.writeCharacters("\n");
+				for (String p : e.getProps().keySet()) {
+					writer.writeStartElement("f");
+					writer.writeAttribute("name", p);
+					writer.writeStartElement("string");
+					writer.writeCharacters(e.getProps().get(p));
+					writer.writeEndElement(); // string
+					writer.writeEndElement(); // f
+					writer.writeCharacters("\n");
+				}
+				writer.writeEndElement(); // fs
+				writer.writeCharacters("\n");
+			}
+			writer.writeEndElement(); // div
+			writer.writeCharacters("\n");
+		}
+	}
+
+	protected void writeStructure(XMLStreamWriter writer) throws XMLStreamException {
+		Structure structure = analecCorpus.getStructure();
+		writer.writeStartElement("fvLib");
+		writer.writeAttribute("type", "AnalecStructure");
+		writer.writeCharacters("\n");
+		writeStructureClass(structure, Unite.class, writer);
+		writeStructureClass(structure, Relation.class, writer);
+		writeStructureClass(structure, Schema.class, writer);
+
+		writer.writeEndElement(); // fvLib
+	}
+
+	@SuppressWarnings("unchecked")
+	protected void writeStructureClass(Structure structure, Class clazz, XMLStreamWriter writer) throws XMLStreamException {
+		writer.writeStartElement("fs");
+		writer.writeAttribute("type", clazz.getSimpleName());
+		writer.writeCharacters("\n");
+		for (String type : structure.getTypes(clazz)) {
+			writer.writeStartElement("fs");
+			writer.writeAttribute("type", type);
+			writer.writeCharacters("\n");
+			for (String prop : structure.getNomsProps(clazz, type)) {
+				writer.writeStartElement("fs");
+				writer.writeAttribute("type", prop);
+				writer.writeCharacters("\n");
+				for (String v : structure.getValeursProp(clazz, type, prop)) {
+					writer.writeStartElement("f");
+					writer.writeStartElement("string");
+					writer.writeCharacters(v);
+					writer.writeEndElement(); // string
+					writer.writeEndElement(); // f
+					writer.writeCharacters("\n");
+				}
+				writer.writeEndElement(); // fs Unite prop
+				writer.writeCharacters("\n");
+			}
+			writer.writeEndElement(); // fs Unite type
+			writer.writeCharacters("\n");
+		}
+		writer.writeEndElement(); // fs Unite
+		writer.writeCharacters("\n");
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/AnalecAnnotationTEIExporter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/HookableStaxIdentityParser.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/HookableStaxIdentityParser.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/HookableStaxIdentityParser.java	(revision 1200)
@@ -0,0 +1,48 @@
+package org.txm.annotation.urs.export;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.txm.importer.StaxIdentityParser;
+
+public class HookableStaxIdentityParser extends StaxIdentityParser {
+
+	
+	String hookPath;
+	private XMLStreamWriter hookedwriter;
+	private BufferedOutputStream hookedoutput;
+	private XMLStreamReader hookedparser;
+	
+	public HookableStaxIdentityParser(File infile, String hookPath) throws IOException, XMLStreamException {
+		super(infile);
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean process(XMLStreamWriter awriter) throws XMLStreamException, IOException
+	{
+		this.writer = awriter;
+		goToEnd(hookPath); // write all until text is reached
+		this.hookedwriter = writer;
+		this.hookedoutput = output;
+		this.hookedparser = parser;
+		this.writer = null;
+		this.output = null;
+		this.parser = null;
+		return true;
+	}
+	
+	public XMLStreamWriter getWriter() {
+		return hookedwriter;
+	}
+	
+	public void close() throws XMLStreamException, IOException {
+		hookedwriter.close();
+		hookedoutput.close();
+		hookedparser.close();
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/HookableStaxIdentityParser.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/ExportToGlozzMacro.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/ExportToGlozzMacro.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/ExportToGlozzMacro.java	(revision 1200)
@@ -0,0 +1,163 @@
+package org.txm.annotation.urs.export;
+
+// @author: Bruno Oberlé
+// v1.0.0 2017-08-28
+
+/*
+ Cette macro exporte le corpus sélectionné et ses annotations vers deux fichiers de format Glozz:
+ - un fichier .ac contenant le corpus brut,
+ - un fichier .aa contenant les annotations au format XML utilisé par Glozz.
+ Le corpus sélectionné dans TXM devrait contenir une structure Analec avec au moins un type d'unité défini (e.g. MENTION, maillon, etc.). S'il n'y a pas de structure,
+ ce n'est pas grave: le fichier est exporter, mais aucune annotation n'est créer. Cela permet d'exporter n'importe quel corpus au format Glozz.
+ Pour exporter un texte au format Glozz *sans* les annotations qu'il contient, simplement mettre un unit_type qui n'existe pas (e.g. "foobar" au lieu de "MENTION").
+ La macro ne produit pour l'instant pas automatiquement de modèle Glozz (fichier .aam).  Cela n'est pas un problème pour ouvrir le résultat dans Glozz ou Analec.
+ */
+
+// STANDARD DECLARATIONS
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.txm.Toolbox;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.io.IOUtils;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.donnees.Structure;
+import visuAnalec.elements.Unite;
+
+public class ExportToGlozzMacro {
+
+	public void doExport(MainCorpus corpus, String unit_type, String filename) throws NumberFormatException, IOException, CqiServerError, CqiClientException {
+
+
+		int size = corpus.getSize(); // you may also use:
+										// corpus.getTextEndLimits() (= index of
+										// last token = size-1)
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+		Property word = corpus.getWordProperty();
+		// note: using "lbn" seems to work better than "pn" (some imported
+		// corpora are missing this information)
+		// pn = corpus.getProperty("pn")
+		// if (pn == null) pn = corpus.getProperty("div")
+		Property pn = corpus.getProperty("lbn");
+
+		// BUILD THE RAW TEXT, THE POSITIONS AND FIND THE PARAGRAPHS
+
+		String rawText = ""; // the corpus for the .ac file
+		ArrayList<int[]> positions = new ArrayList<int[]>(); // each element is an array
+												// [start, end] indicating the
+												// position in the rawText
+		int pnCount = 0; // the par counter, used for indexing the pns array
+		int lastPn = -1; // the last paragraph number
+		ArrayList<int[]> pns = new ArrayList<int[]>(); // each element is an array [start,
+											// end] representing the start and
+											// end of the paragraph in the
+											// rawText
+		int end = -1;
+		for (int i = 0; i < size; i++) {
+			String f = CQI.cpos2Str(word.getQualifiedName(), new int[] { i })[0];
+			int p = 0;
+			if (pn == null) {
+				p = 1;
+			} else {
+				p = Integer.parseInt(CQI.cpos2Str(pn.getQualifiedName(), new int[] { i })[0]);
+			}
+			int start = rawText.length();
+			rawText += f;
+			if (lastPn != p) {
+				pnCount++;
+				if (pnCount > 1 && pns.size() > 0) {
+					pns.get(pnCount - 2)[1] = end;
+				}
+				pns.add(new int[]{start, 0});
+			}
+			lastPn = p;
+			end = rawText.length(); // must be after setting it up in pns!
+			if (i != size - 1)
+				rawText += " ";
+			positions.add(new int[]{start, end});
+		}
+		pns.get(pnCount - 1)[1] = end;
+		System.out.println(pnCount + " paragraph(s) found.");
+
+		// CORPUS ANALEC (GET THE ANNOTATIONS)
+
+		// note that unit_type has been defined with an option of the dialog at
+		// the beginning
+		Corpus analecCorpus = AnalecCorpora.getCorpus(corpus);
+
+		// list of properties
+
+		Structure struct = analecCorpus.getStructure();
+		HashSet<String> propertyList = struct.getUniteProperties(unit_type);
+
+		// export to file (corpus)
+
+		String corpusFilename = filename + ".ac";
+		File corpusFile = new File(corpusFilename);
+		PrintWriter corpusFileWriter = IOUtils.getWriter(corpusFile);
+		corpusFileWriter.write(rawText);
+		corpusFileWriter.close();
+		System.out.println("Corpus written to `" + corpusFilename + "'.");
+
+		// export to file (annotations)
+
+		String annotFilename = filename + ".aa";
+		File annotFile = new File(annotFilename);
+		PrintWriter annotFileWriter = IOUtils.getWriter(corpusFile);
+		annotFileWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<annotations>"); // erase
+		int counter = 0;
+
+		// export paragraphs
+		for (int i = 0; i < pns.size(); i++) {
+			int start = pns.get(i)[0];
+			end = pns.get(i)[1];
+			annotFileWriter.println("<unit id=\"me_" + counter + "\">");
+			annotFileWriter.println("<metadata><author>me</author><creation-date>" + counter + "</creation-date></metadata>");
+			annotFileWriter.println("<characterisation><type>paragraph</type><featureSet /></characterisation>");
+			annotFileWriter.println("<positioning><start><singlePosition index=\"" + start + "\" /></start><end><singlePosition index=\"" + end + "\" /></end></positioning>");
+			annotFileWriter.println("</unit>");
+			counter++;
+		}
+
+		// export units
+		ArrayList<Unite> units = analecCorpus.getUnites(unit_type);
+		// units.sort() { a, b -> a.getDeb() <=> b.getDeb() ?: a.getFin() <=>
+		// b.getFin() };
+		int unitCount = 0;
+		for (Unite unit : units) {
+			unitCount++;
+			annotFileWriter.println("<unit id=\"me_" + counter + "\">");
+			annotFileWriter.println("<metadata><author>me</author><creation-date>" + counter + "</creation-date></metadata>");
+			annotFileWriter.println("<characterisation>");
+			annotFileWriter.println("<type>" + unit_type + "</type>");
+			annotFileWriter.println("<featureSet>");
+			for (String propertyName : propertyList) {
+				annotFileWriter.println("<feature name=\"" + propertyName + "\">" + unit.getProp(propertyName) + "</feature>");
+			}
+			annotFileWriter.println("</featureSet>");
+			annotFileWriter.println("</characterisation>");
+			int start = positions.get(unit.getDeb())[0];
+			end = positions.get(unit.getFin())[1];
+			annotFileWriter.println("<positioning><start><singlePosition index=\"" + start + "\" /></start><end><singlePosition index=\"" + end + "\" /></end></positioning>");
+			annotFileWriter.println("</unit>");
+			counter++;
+		}
+		annotFileWriter.println("</annotations>");
+		annotFileWriter.close();
+		System.out.println(unitCount + " unit(s) found.");
+
+		System.out.println("Annotations written to `" + annotFile + "'.");
+	}
+
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/export/ExportToGlozzMacro.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/Messages.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/Messages.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/Messages.java	(revision 1200)
@@ -0,0 +1,191 @@
+package org.txm.annotation.urs;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+public class Messages extends NLS {
+
+	public static String AnalecCorpora_3;
+	public static String AnalecCorpora_4;
+	
+	public static String DoInstallStep_10;
+	public static String DoInstallStep_11;
+	public static String DoInstallStep_17;
+	public static String DoInstallStep_18;
+	public static String DoInstallStep_2;
+	public static String DoInstallStep_5;
+	public static String DoInstallStep_6;
+	public static String DoInstallStep_7;
+	public static String DoInstallStep_9;
+	public static String EditStructure_0;
+	public static String ExportGlozzCorpus_0;
+	public static String ExportGlozzCorpus_1;
+	public static String ExportGlozzCorpus_2;
+	public static String ExportGlozzCorpus_3;
+	public static String ExportGlozzCorpus_4;
+	public static String ExportTEICorpus_0;
+	public static String ExportTEICorpus_1;
+	public static String ExportTEICorpus_2;
+	public static String ExportTEICorpus_3;
+	public static String ExportTEICorpus_4;
+	public static String ImportGlozzAnnotations_0;
+	public static String ImportGlozzAnnotations_1;
+	public static String ImportGlozzAnnotations_10;
+	public static String ImportGlozzAnnotations_2;
+	public static String ImportGlozzAnnotations_3;
+	public static String ImportGlozzAnnotations_4;
+	public static String ImportGlozzAnnotations_5;
+	public static String ImportGlozzAnnotations_6;
+	public static String ImportGlozzAnnotations_7;
+	public static String ImportGlozzAnnotations_8;
+	public static String ImportGlozzAnnotations_9;
+	public static String ImportGlozzCorpus_0;
+	public static String ImportGlozzCorpus_1;
+	public static String ImportGlozzCorpus_10;
+	public static String ImportGlozzCorpus_11;
+	public static String ImportGlozzCorpus_15;
+	public static String ImportGlozzCorpus_17;
+	public static String ImportGlozzCorpus_19;
+	public static String ImportGlozzCorpus_22;
+	public static String ImportGlozzCorpus_23;
+	public static String ImportGlozzCorpus_24;
+	public static String ImportGlozzCorpus_25;
+	public static String ImportGlozzCorpus_26;
+	public static String ImportGlozzCorpus_27;
+	public static String ImportGlozzCorpus_28;
+	public static String ImportGlozzCorpus_29;
+	public static String ImportGlozzCorpus_3;
+	public static String ImportGlozzCorpus_30;
+	public static String ImportGlozzCorpus_32;
+	public static String ImportGlozzCorpus_4;
+	public static String ImportGlozzCorpus_5;
+	public static String ImportGlozzCorpus_8;
+	public static String ImportGlozzCorpus_9;
+	public static String ImportTEIAnnotations_0;
+	public static String ImportTEIAnnotations_1;
+	public static String ImportTEIAnnotations_2;
+	public static String ImportTEIAnnotations_3;
+	public static String ImportTEIAnnotations_4;
+	public static String ImportTEIAnnotations_5;
+	public static String ImportTEIAnnotations_6;
+	public static String ImportTEIAnnotations_7;
+	public static String ImportTEIAnnotations_8;
+	public static String ImportTEICorpus_0;
+	public static String ImportTEICorpus_11;
+	public static String ImportTEICorpus_14;
+	public static String ImportTEICorpus_15;
+	public static String ImportTEICorpus_16;
+	public static String ImportTEICorpus_18;
+	public static String ImportTEICorpus_19;
+	public static String ImportTEICorpus_2;
+	public static String ImportTEICorpus_20;
+	public static String ImportTEICorpus_21;
+	public static String ImportTEICorpus_22;
+	public static String ImportTEICorpus_23;
+	public static String ImportTEICorpus_24;
+	public static String ImportTEICorpus_3;
+	public static String ImportTEICorpus_5;
+	public static String ImportTEICorpus_7;
+	public static String ImportTEICorpus_9;
+	public static String LoadCorpus_0;
+	public static String LoadCorpus_1;
+	public static String LoadCorpus_2;
+	public static String LoadCorpus_3;
+	public static String LoadCorpus_4;
+	public static String LoadCorpus_5;
+	public static String LoadStructure_0;
+	public static String LoadStructure_1;
+	public static String LoadStructure_2;
+	public static String LoadStructure_3;
+	public static String LoadStructureFromGlozz_0;
+	public static String LoadStructureFromGlozz_1;
+	public static String LoadStructureFromGlozz_2;
+	public static String LoadStructureFromGlozz_3;
+	public static String LoadStructureFromGlozz_4;
+	public static String LoadVue_0;
+	public static String LoadVue_1;
+	public static String LoadVue_2;
+	public static String LoadVue_3;
+	public static String SaveCorpus_0;
+	public static String SaveCorpus_1;
+	public static String SaveCorpus_3;
+	public static String SaveCorpus_5;
+	public static String SaveStructure_0;
+	public static String SaveStructure_3;
+	public static String SaveStructure_4;
+	public static String SaveStructure_5;
+	public static String SaveStructureAsGlozzModel_0;
+	public static String SaveStructureAsGlozzModel_1;
+	public static String SaveStructureAsGlozzModel_2;
+	public static String SaveStructureAsGlozzModel_3;
+	public static String SaveVue_0;
+	public static String SaveVue_3;
+	public static String SaveVue_4;
+	public static String SaveVue_5;
+	
+	public static String AnalecPreferencePage_3;
+	public static String AnalecPreferencePage_4;
+	public static String AnalecPreferencePage_9;
+	
+	public static String AnnotationToolbar_0;
+	public static String AnnotationToolbar_6;
+	public static String AnnotationToolbar_7;
+	public static String UnitToolbar_10;
+	public static String UnitToolbar_12;
+	public static String UnitToolbar_14;
+	public static String UnitToolbar_16;
+	public static String UnitToolbar_27;
+	public static String UnitToolbar_28;
+	public static String UnitToolbar_29;
+	public static String UnitToolbar_3;
+	public static String UnitToolbar_32;
+	public static String UnitToolbar_4;
+	public static String UnitToolbar_44;
+	public static String UnitToolbar_45;
+	public static String UnitToolbar_46;
+	public static String UnitToolbar_47;
+	public static String UnitToolbar_48;
+	public static String UnitToolbar_49;
+	public static String UnitToolbar_5;
+	public static String UnitToolbar_50;
+	public static String UnitToolbar_51;
+	public static String UnitToolbar_52;
+	public static String UnitToolbar_53;
+	public static String UnitToolbar_54;
+	public static String UnitToolbar_59;
+	public static String UnitToolbar_6;
+	public static String UnitToolbar_60;
+	public static String UnitToolbar_61;
+	public static String UnitToolbar_62;
+	public static String UnitToolbar_63;
+	public static String UnitToolbar_7;
+	public static String UnitToolbar_8;
+	
+	public static String StartButton_0;
+	public static String StartButton_1;
+	public static String StartButton_10;
+	public static String StartButton_11;
+	public static String StartButton_12;
+	public static String StartButton_2;
+	public static String StartButton_3;
+	public static String StartButton_4;
+	public static String StartButton_5;
+	public static String StartButton_6;
+	public static String StartButton_7;
+	public static String StartButton_8;
+	public static String StartButton_9;
+	
+	public static String NavigationField_0;
+	public static String NavigationField_2;
+	public static String NavigationField_3;
+	public static String NavigationField_4;
+	public static String NavigationField_5;
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(Messages.class);
+	}
+
+	private Messages() {
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/Messages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecCorpora.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecCorpora.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecCorpora.java	(revision 1200)
@@ -0,0 +1,219 @@
+package org.txm.annotation.urs;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.annotation.core.AnnotationEngine;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.Project;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.DeleteDir;
+
+import visuAnalec.donnees.Corpus;
+import visuAnalec.fichiers.FichiersJava;
+import visuAnalec.vue.Vue;
+
+/**
+ * Manages Analec corpus: the corpus are associated with TXM MainCorpus objects
+ * 
+ * @author mdecorde
+ *
+ */
+public class AnalecCorpora extends AnnotationEngine {
+
+	private static final HashMap<MainCorpus, Corpus> corpora = new HashMap<MainCorpus, Corpus>();
+	private static final HashMap<MainCorpus, Vue> vues = new HashMap<MainCorpus, Vue>();
+
+	/**
+	 * Create the ec file if needed, store a reference to the corpus if not already done.
+	 * 
+	 * @param mcorpus
+	 * @return the Corpus loaded and stored
+	 */
+	public static Corpus getCorpus(MainCorpus mcorpus) {
+		File fichierCorpus = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus.getID()+".ec"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		File fichierVue = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus.getID()+".ecv");
+		Corpus corpus = null;
+		if (AnalecCorpora.corpora.containsKey(mcorpus)) {
+			corpus = AnalecCorpora.corpora.get(mcorpus);
+		} else {
+			corpus = new Corpus();
+
+			if (fichierCorpus.exists()) {
+				if (!FichiersJava.ouvrirCorpus(corpus, fichierCorpus, false)) {
+					System.out.println(Messages.AnalecCorpora_3+fichierCorpus);
+					return null;
+				}
+			} else {
+				fichierCorpus.getParentFile().mkdirs();
+
+				if (!FichiersJava.enregistrerCorpus(corpus, fichierCorpus)) {
+					System.out.println(Messages.AnalecCorpora_4+fichierCorpus);
+					return null;
+				}
+			}
+
+			AnalecCorpora.corpora.put(mcorpus, corpus);
+
+			Vue vue = getVue(mcorpus);
+
+			//TODO: does not work :( 
+			if (fichierVue.exists()) {
+				if (!FichiersJava.ouvrirVue(vue, fichierVue)) {
+					System.out.println("Warning: Fail to open corpus Vue file: "+fichierVue);
+					//return null;
+				}
+				String[] types = vue.getTypesUnitesAVoir();
+				if (types == null || types.length == 0) {
+					vue.retablirVueParDefaut();
+				}
+			} else {
+				vue.retablirVueParDefaut(); // 
+				if (!FichiersJava.enregistrerVue(vue, fichierVue)) {
+					System.out.println("Warning: Fail to create corpus Vue file: "+fichierVue);
+					//return null;
+				}
+			}
+		}
+		return corpus;
+	}
+
+	public static boolean isAnnotationStructureReady(org.txm.searchengine.cqp.corpus.CQPCorpus corpus) {
+		return isAnnotationStructureReady(corpus.getMainCorpus());
+	}
+
+	public static boolean isAnnotationStructureReady(MainCorpus name) {
+		if (AnalecCorpora.corpora.containsKey(name)) {
+			return !AnalecCorpora.corpora.get(name).getStructure().isVide();
+		} else {
+			File fichierCorpus = new File(Toolbox.getTxmHomePath(), "corpora/"+name+"/analec/"+name+".ec"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			if (fichierCorpus.exists()) {
+				return !getCorpus(name).getStructure().isVide();
+			} else {
+				return false;
+			}
+		}
+	}
+
+	/**
+	 * need the corpus to be loaded
+	 * 
+	 * @param name
+	 * @return the corpus Vue
+	 */
+	public static Vue getVue(MainCorpus name) {
+		if (!vues.containsKey(name)) {
+			if (!corpora.containsKey(name)) {
+				getCorpus(name);
+			}
+			Corpus corpus = getCorpus(name);
+			Vue vue = new Vue(corpus);
+			vues.put(name, vue);
+		}
+		return vues.get(name);
+	}
+
+	public static boolean saveCorpus(MainCorpus mcorpus) {
+		Corpus corpus = getCorpus(mcorpus);
+		Vue vue = getVue(mcorpus);
+		File dir = new File(mcorpus.getProjectDirectory(), "analec/"); //$NON-NLS-1$ //$NON-NLS-2$
+		dir.mkdir();
+		File fichierCorpus = new File(dir, mcorpus+".ec"); //$NON-NLS-1$
+		File fichierVueCorpus = new File(dir, mcorpus+".ecv"); //$NON-NLS-1$
+		return FichiersJava.enregistrerCorpus(corpus, fichierCorpus) 
+				&& FichiersJava.enregistrerVue(vue, fichierVueCorpus);
+	}
+
+	public static Vue getVue(Corpus corpus) {
+		for (MainCorpus mcorpus : corpora.keySet()) {
+			if (corpora.get(mcorpus) == corpus) return vues.get(mcorpus);
+		}
+		return null;
+	}
+
+	public static boolean saveCorpus(Corpus corpus) {
+		for (MainCorpus mcorpus : corpora.keySet()) {
+			if (corpora.get(mcorpus) == corpus) return saveCorpus(mcorpus);
+		}
+		return false;
+	}
+
+	public static void removeCorpus(MainCorpus mcorpus) {
+		if (!vues.containsKey(mcorpus)) {vues.remove(mcorpus);}
+		if (!corpora.containsKey(mcorpus)) {corpora.remove(mcorpus);}
+	}
+
+	public static void revert(MainCorpus corpus) {
+		corpora.remove(corpus);
+		vues.remove(corpus);
+		corpus.setIsModified(false);
+	}
+
+	@Override
+	public boolean isRunning() {
+		return true;
+	}
+
+	@Override
+	public boolean initialize() throws Exception {
+		return true;
+	}
+
+	@Override
+	public boolean start(IProgressMonitor monitor) throws Exception {
+		return true;
+	}
+
+	@Override
+	public boolean stop() throws Exception {
+		return true;
+	}
+
+	@Override
+	public void notify(TXMResult r, String state) {
+		if (r instanceof MainCorpus && "clean".equals(state)) {
+			MainCorpus mcorpus = (MainCorpus)r;
+
+			AnalecCorpora.removeCorpus(mcorpus);
+
+			File fichierCorpus = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus.getID()+".ec"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			File fichierVue = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus.getID()+".ecv");
+			fichierCorpus.delete();
+			fichierVue.delete();
+		} else if (r instanceof Project) {
+			Project project = ((Project)r);
+			if ("clean".equals(state)) {
+				File analecDir = new File(project.getProjectDirectory(), "analec");
+				if (analecDir.exists()) {
+					DeleteDir.deleteDirectory(analecDir);
+				}
+			} else if ("save".equals(state)) {
+				for (TXMResult c : project.getChildren(MainCorpus.class)) {
+					AnalecCorpora.saveCorpus((MainCorpus)c);
+				}
+			}
+		}
+	}
+
+	@Override
+	public String getName() {
+		return "Analec";
+	}
+
+	@Override
+	public boolean isAutomatic() {
+		return false;
+	}
+
+	@Override
+	public boolean processFile(File xmlFile, File binaryCorpusDirectory, HashMap<String, Object> parameters) {
+		return false;
+	}
+
+	@Override
+	public String getDetails() {
+		return corpora.toString();
+	}
+}

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/AnalecCorpora.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_fr.properties
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_fr.properties	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_fr.properties	(revision 1200)
@@ -0,0 +1,170 @@
+AnalecCorpora_3=N/A_Fail to open corpus file: 
+AnalecCorpora_4=N/A_Fail to create corpus file: 
+DoInstallStep_10=N/A_. Aborting
+DoInstallStep_11=N/A_Previous version of Analec macros are moved to: 
+DoInstallStep_17=N/A_Error while coping Analec org/txm/macro/analec in 
+DoInstallStep_18=N/A_Analec post-installation done.
+DoInstallStep_2=N/A_Analec.DoInstallStep.install()
+DoInstallStep_5=N/A_No post-installation of Analec to do
+DoInstallStep_6=N/A_Post-installing Analec version=
+DoInstallStep_7=N/A_scripts/macro/org/txm/macro/analec
+DoInstallStep_9=N/A_Analec previous macro backup directory already exists: 
+EditStructure_0=N/A_Selection is not a corpus: 
+ExportGlozzCorpus_0=N/A_Selection is not a main corpus: 
+ExportGlozzCorpus_1=N/A_\ Glozz export
+ExportGlozzCorpus_2=N/A_Canceled.
+ExportGlozzCorpus_3=N/A_Error while exporting annotations : 
+ExportGlozzCorpus_4=N/A_Error while exporting annotations : 
+ExportTEICorpus_0=N/A_Selection is not a corpus: 
+ExportTEICorpus_1=N/A_\ annotations export...
+ExportTEICorpus_2=N/A_Error while exporting corpus.
+ExportTEICorpus_3=N/A_Error while exporting corpus to XML-Analec: 
+ExportTEICorpus_4=N/A_Error while exporting annotations: 
+ImportGlozzAnnotations_0=N/A_The AA AAM and AC files must exists.
+ImportGlozzAnnotations_1=N/A_Selection is not a main corpus: 
+ImportGlozzAnnotations_10=N/A_Done.
+ImportGlozzAnnotations_2=N/A_Importing Glozz model from: 
+ImportGlozzAnnotations_3=N/A_error while importing Glozz model.
+ImportGlozzAnnotations_4=N/A_Importing Glozz corpus from: 
+ImportGlozzAnnotations_5=N/A_\ and 
+ImportGlozzAnnotations_6=N/A_error while importing Glozz corpus.
+ImportGlozzAnnotations_7=N/A_Reindexing annotations with TXM words
+ImportGlozzAnnotations_8=N/A_error while re-indexing Analec annotations.
+ImportGlozzAnnotations_9=N/A_Saving annotations.
+ImportGlozzCorpus_0=N/A_The glozzDirectory directory must exists.
+ImportGlozzCorpus_1=N/A_Creating source directory: $srcDir
+ImportGlozzCorpus_10=N/A_No .aa files found in 
+ImportGlozzCorpus_11=N/A_Importing Glozz data from: 
+ImportGlozzCorpus_15=N/A_Error while importing Glozz data.
+ImportGlozzCorpus_17=N/A_Could not create the TXT source file $txtFile
+ImportGlozzCorpus_19=N/A_ERROR: could not save import configuration: 
+ImportGlozzCorpus_22=N/A_Error: no script found for import name ${importName}: $script
+ImportGlozzCorpus_23=N/A_Error during import
+ImportGlozzCorpus_24=N/A_Finalize Analec corpus import
+ImportGlozzCorpus_25=N/A_Importing Glozz model from: 
+ImportGlozzCorpus_26=N/A_Error while importing Glozz model.
+ImportGlozzCorpus_27=N/A_Reindexing annotations with TXM words.
+ImportGlozzCorpus_28=N/A_error while re-indexing Analec annotations.
+ImportGlozzCorpus_29=N/A_Saving annotations.
+ImportGlozzCorpus_3=N/A_Creating ec directory: $ecDir
+ImportGlozzCorpus_30=N/A_Done.
+ImportGlozzCorpus_32=N/A_ERROR while finalizing corpus import: 
+ImportGlozzCorpus_4=N/A_Could not create the source directory $srcDir
+ImportGlozzCorpus_5=N/A_Could not create the ec directory $ecDir
+ImportGlozzCorpus_8=N/A_No .aa files found in 
+ImportGlozzCorpus_9=N/A_No .ac files found in 
+ImportTEIAnnotations_0=N/A_Selection is not a corpus: 
+ImportTEIAnnotations_1=N/A_\ annotations import...
+ImportTEIAnnotations_2=N/A_Error while importing annotations.
+ImportTEIAnnotations_3=N/A_Error while importing annotations: 
+ImportTEIAnnotations_4=N/A_Error while exporting annotations: 
+ImportTEIAnnotations_5=N/A_Done: 
+ImportTEIAnnotations_6=N/A_\ unites 
+ImportTEIAnnotations_7=N/A_\ relations 
+ImportTEIAnnotations_8=N/A_\ schemas.
+ImportTEICorpus_0=N/A_The XML files must exists: 
+ImportTEICorpus_11=N/A_ERROR: could not save import configuration: 
+ImportTEICorpus_14=N/A_Error: no script found for import name ${importName}: $script
+ImportTEICorpus_15=N/A_Error during import
+ImportTEICorpus_16=N/A_Finalize Analec corpus import
+ImportTEICorpus_18=N/A_Importing TEI model from: 
+ImportTEICorpus_19=N/A_Error while importing TEI model.
+ImportTEICorpus_2=N/A_Creating source directory: $srcDir
+ImportTEICorpus_20=N/A_Reindexing annotations with TXM words.
+ImportTEICorpus_21=N/A_error while re-indexing Analec annotations.
+ImportTEICorpus_22=N/A_Saving annotations.
+ImportTEICorpus_23=N/A_Done.
+ImportTEICorpus_24=N/A_Error while finalizing corpus import: 
+ImportTEICorpus_3=N/A_Could not create the source directory $srcDir
+ImportTEICorpus_5=N/A_Importing TEI data from: 
+ImportTEICorpus_7=N/A_Error while importing TEI data.
+ImportTEICorpus_9=N/A_Could not create the TXT source file $txtFile
+LoadCorpus_0=N/A_Selection is not a main corpus: 
+LoadCorpus_1=N/A_Loading corpus from file...
+LoadCorpus_2=N/A_The EC files must exists.
+LoadCorpus_3=N/A_Loading corpus from file: 
+LoadCorpus_4=N/A_Fail to load structure.
+LoadCorpus_5=N/A_Done: 
+LoadStructure_0=N/A_Selection is not a main corpus: 
+LoadStructure_1=N/A_Loading structure for corpus=
+LoadStructure_2=N/A_Fail to load structure.
+LoadStructure_3=N/A_Done: 
+LoadStructureFromGlozz_0=N/A_Selection is not a main corpus: 
+LoadStructureFromGlozz_1=N/A_Importing Glozz model for corpus=
+LoadStructureFromGlozz_2=N/A_The AAM file must exists.
+LoadStructureFromGlozz_3=N/A_Fail to load structure from Glozz model.
+LoadStructureFromGlozz_4=N/A_Done.
+LoadVue_0=N/A_Selection is not a main corpus: 
+LoadVue_1=N/A_Loading vue for corpus=
+LoadVue_2=N/A_Fail to load structure.
+LoadVue_3=N/A_Done: 
+SaveCorpus_0=N/A_Selection is not a main corpus: 
+SaveCorpus_1=N/A_\ in 
+SaveCorpus_3=N/A_Saving structure for corpus=
+SaveCorpus_5=N/A_Erreur lors de la sauvegarde du corpus.
+SaveStructure_0=N/A_Selection is not a main corpus: 
+SaveStructure_3=N/A_Saving structure for corpus=
+SaveStructure_4=N/A_\ in 
+SaveStructure_5=N/A_Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_0=N/A_Selection is not a main corpus: 
+SaveStructureAsGlozzModel_1=N/A_Saving structure as Glozz model for corpus=
+SaveStructureAsGlozzModel_2=N/A_Erreur lors de la sauvegarde de la structure.
+SaveStructureAsGlozzModel_3=N/A_Done.
+SaveVue_0=N/A_Selection is not a main corpus: 
+SaveVue_3=N/A_Saving vue for corpus=
+SaveVue_4=N/A_\ in 
+SaveVue_5=N/A_Erreur lors de la sauvegarde de la vue.
+AnalecPreferencePage_3=N/A_Use Analec scheme to fix unit limits
+AnalecPreferencePage_4=N/A_Autocompletion search pattern of field is prefix (instead of infixe)
+AnalecPreferencePage_9=N/A_Unit highlight color palette
+AnnotationToolbar_0=N/A_No selection found. Aborting.
+AnnotationToolbar_6=N/A_Error: QueryResult matches size is 
+AnnotationToolbar_7=N/A_\ query was 
+UnitToolbar_10=N/A_Supprimer
+UnitToolbar_12=N/A_Corriger la limite gauche en cliquant sur un mot
+UnitToolbar_14=N/A_Corriger les limites gauche et droite avec une nouvelle s?lection de mot
+UnitToolbar_16=N/A_Corriger la limite droite en cliquant sur un mot
+UnitToolbar_27=N/A_You must select a word. Try again\!
+UnitToolbar_28=N/A_An error occured when updating unit limits with id=
+UnitToolbar_29=N/A_Select 
+UnitToolbar_3=N/A_** Could not retrieve 
+UnitToolbar_32=N/A_Select 
+UnitToolbar_4=N/A_\ size: 
+UnitToolbar_44=N/A_Creating unit with start=
+UnitToolbar_45=N/A_\ end=
+UnitToolbar_46=N/A_org.txm.analec.delete
+UnitToolbar_47=N/A_Delete unit 
+UnitToolbar_48=N/A_Do you really want to delete unit 
+UnitToolbar_49=N/A_\ ?
+UnitToolbar_5=N/A_Type d'unit? :
+UnitToolbar_50=N/A_Aborting annotation limit update
+UnitToolbar_51=N/A_Identifiants SelectionListener: 
+UnitToolbar_52=N/A_Types SelectionListener: 
+UnitToolbar_53=N/A_Reloading identifiants combo values.
+UnitToolbar_54=N/A_< type d'unit? >
+UnitToolbar_59=N/A_Error no word found for id=
+UnitToolbar_6=N/A_Type d'unit?
+UnitToolbar_60=N/A_Updating annotation limits: 
+UnitToolbar_61=N/A_\ -> 
+UnitToolbar_62=N/A_\ with word id=
+UnitToolbar_63=N/A_\ with pos=
+UnitToolbar_7=N/A_Type d'unit?
+UnitToolbar_8=N/A_Cr?er
+StartButton_0=N/A_Units
+StartButton_1=N/A_Schemas
+StartButton_10=N/A_), then call the Analec > Import Structure command
+StartButton_11=N/A_Save and close annotation tools: 
+StartButton_12=N/A_D?marrer l'annotation Analec
+StartButton_2=N/A_Saving analec annotations...
+StartButton_3=N/A_Saving analec annotations...
+StartButton_4=N/A_Error: corpus not saved.
+StartButton_5=N/A_Done.
+StartButton_6=N/A_You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+StartButton_7=N/A_), then call the Analec > Import Structure command
+StartButton_8=N/A_Save and close annotation tools: 
+StartButton_9=N/A_You need to import an annotation structure before starting to annotate. Select the edition main corpus (
+NavigationField_0=N/A_<identifiant>
+NavigationField_2=N/A_Wrong unit ID: 
+NavigationField_3=N/A_Wrong unit ID: 
+NavigationField_4=N/A_Rechercher par les propri?t?s de ce type d'unit?
+NavigationField_5=N/A_<identifiant>

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/testers/IsCorpusAnnotated.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/testers/IsCorpusAnnotated.java	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/testers/IsCorpusAnnotated.java	(revision 1200)
@@ -0,0 +1,39 @@
+package org.txm.annotation.urs.testers;
+
+import java.util.List;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.txm.annotation.urs.AnalecCorpora;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+
+public class IsCorpusAnnotated extends PropertyTester {
+
+	public static final String PROPERTY_NAMESPACE = "org.txm.analec.testers"; //$NON-NLS-1$
+	public static final String PROPERTY_CAN_SAVE = "canAnnotate";
+	
+	@Override
+	public boolean test(Object receiver, String property, Object[] args,
+			Object expectedValue) {
+
+		if (receiver instanceof List) {
+			@SuppressWarnings("unchecked")
+			List<Object> list = (List<Object>)receiver;
+			if (list.size() == 0) return false;
+			receiver = list.get(0);
+		}
+		
+		//System.out.println("test org.txm.analec.testers.canAnnotate with "+receiver.getClass());
+		if (receiver instanceof CQPCorpus) {
+			return testCorpus((CQPCorpus)receiver);
+		}
+		return false;
+	}
+
+	protected boolean testCorpus(CQPCorpus c) {
+		MainCorpus mc = c.getMainCorpus();
+		boolean ret = AnalecCorpora.isAnnotationStructureReady(mc);
+		//System.out.println(" Corpus:"+c+" org.txm.analec.testers.canAnnotate: "+ret);
+		return ret;
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/testers/IsCorpusAnnotated.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.analec.rcp/src/org/eclipse/jface/fieldassist/TXMSimpleContentProposalProvider.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/eclipse/jface/fieldassist/TXMSimpleContentProposalProvider.java	(revision 1199)
+++ tmp/org.txm.analec.rcp/src/org/eclipse/jface/fieldassist/TXMSimpleContentProposalProvider.java	(revision 1200)
@@ -13,8 +13,8 @@
 
 import java.util.ArrayList;
 
-import org.txm.analec.preferences.AnalecPreferencePage;
-import org.txm.analec.preferences.AnalecPreferences;
+import org.txm.annotation.urs.preferences.AnalecPreferencePage;
+import org.txm.annotation.urs.preferences.AnalecPreferences;
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.rcp.TxmPreferences;
 
Index: tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_ru.properties
===================================================================
--- tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 1199)
+++ tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 1200)
@@ -1,4 +1,4 @@
-Bundle-Name.0=org.txm.analec.rcp
-menu.label=Analec
+Bundle-Name.0=org.txm.annotation.urs.rcp
+menu.label=URS
 command.name.16=N/A_ Edit view
-page.name=Analec
+page.name=URS
Index: tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 1199)
+++ tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 1200)
@@ -2,9 +2,9 @@
 command.name.16 = \u00C9diter la vue
 
 #Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
-#Properties file for AnalecRCP
+#Properties file for Annotations URSRCP
 
-Bundle-Name = Analec
+Bundle-Name = Annotations URS
 
 Bundle-Vendor = Textometrie.org
 
@@ -30,7 +30,7 @@
 
 command.name.13 = Export XML-TEI URS...
 
-command.name.14 = XML-TEI URS
+command.name.14 = XML-TEI Analec
 
 command.name.15 = Aligner les annotations Glozz avec les mots TXM
 
@@ -50,11 +50,11 @@
 
 command.name.9 = Importer les annotations Glozz...
 
-menu.label.0 = Analec
+menu.label.0 = URS
 
-menu.mnemonic = A
+menu.mnemonic = U
 
-menu.mnemonic.0 = A
+menu.mnemonic.0 = U
 
 view.name = Propri\u00E9t\u00E9s
 
Index: tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties	(revision 1199)
+++ tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties	(revision 1200)
@@ -1,9 +1,9 @@
 #Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
 #Properties file for AnalecRCP
 
-Bundle-Name = AnalecRCP
+Bundle-Name = URS Annotation
 
-Bundle-Name.0 = org.txm.analec.rcp
+Bundle-Name.0 = org.txm.annotation.urs.rcp
 
 Bundle-Vendor = Textometrie.org
 
@@ -18,7 +18,7 @@
 command.name.11 = Import XML-TEI URS annotations...
 command.name.12 = Export to XML Glozz...
 command.name.13 = Export to XML-TEI URS...
-command.name.14 = XML-TEI URS
+command.name.14 = XML-TEI Analec
 command.name.15 = Align Glozz annotations with TXM corpus words
 command.name.16 = Edit view
 command.name.2  = Import Glozz model...
@@ -30,12 +30,12 @@
 command.name.8  = Glozz
 command.name.9  = Import Glozz annotations...
 
-menu.label      = Analec
-menu.label.0    = Analec
+menu.label      = URS
+menu.label.0    = URS
 menu.mnemonic   = A
 menu.mnemonic.0 = A
 
-page.name = Analec
+page.name = URS
 
 view.name   = Properties
 view.name.0 = Search
Index: tmp/org.txm.analec.rcp/plugin.xml
===================================================================
--- tmp/org.txm.analec.rcp/plugin.xml	(revision 1199)
+++ tmp/org.txm.analec.rcp/plugin.xml	(revision 1200)
@@ -10,7 +10,7 @@
                label="%menu.label"
                mnemonic="%menu.mnemonic">
             <command
-                  commandId="org.txm.analec.commands.LoadStructureFromGlozz"
+                  commandId="org.txm.annotation.urs.commands.LoadStructureFromGlozz"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -20,7 +20,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.EditAnnotationStructure"
+                  commandId="org.txm.annotation.urs.commands.EditAnnotationStructure"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -30,7 +30,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.EditVue"
+                  commandId="org.txm.annotation.urs.commands.EditVue"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -40,7 +40,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.SaveCorpus"
+                  commandId="org.txm.annotation.urs.commands.SaveCorpus"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -54,7 +54,7 @@
                   visible="true">
             </separator>
             <command
-                  commandId="org.txm.analec.commands.ImportTEIAnnotations"
+                  commandId="org.txm.annotation.urs.commands.ImportTEIAnnotations"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -72,7 +72,7 @@
                label="%menu.label.0"
                mnemonic="%menu.mnemonic.0">
             <command
-                  commandId="org.txm.analec.commands.LoadStructureFromGlozz"
+                  commandId="org.txm.annotation.urs.commands.LoadStructureFromGlozz"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -82,7 +82,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.EditAnnotationStructure"
+                  commandId="org.txm.annotation.urs.commands.EditAnnotationStructure"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -92,7 +92,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.SaveCorpus"
+                  commandId="org.txm.annotation.urs.commands.SaveCorpus"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -102,7 +102,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.ExportGlozzCorpus"
+                  commandId="org.txm.annotation.urs.commands.ExportGlozzCorpus"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -112,7 +112,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.ExportTEICorpus"
+                  commandId="org.txm.annotation.urs.commands.ExportTEICorpus"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -122,7 +122,7 @@
                </visibleWhen>
             </command>
             <command
-                  commandId="org.txm.analec.commands.ImportTEIAnnotations"
+                  commandId="org.txm.annotation.urs.commands.ImportTEIAnnotations"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -136,12 +136,12 @@
       <menuContribution
             locationURI="menu:menu.file.export">
          <command
-               commandId="org.txm.analec.commands.ExportTEICorpus"
+               commandId="org.txm.annotation.urs.commands.ExportTEICorpus"
                label="%command.label.0"
                style="push">
          </command>
          <command
-               commandId="org.txm.analec.commands.ExportGlozzCorpus"
+               commandId="org.txm.annotation.urs.commands.ExportGlozzCorpus"
                label="%command.label.1"
                style="push">
          </command>
@@ -149,11 +149,11 @@
       <menuContribution
             locationURI="menu:menu.file.import?before=menu.file.import.separator.software">
          <command
-               commandId="org.txm.analec.commands.ImportGlozzCorpus"
+               commandId="org.txm.annotation.urs.commands.ImportGlozzCorpus"
                style="push">
          </command>
          <command
-               commandId="org.txm.analec.commands.ImportTEICorpus"
+               commandId="org.txm.annotation.urs.commands.ImportTEICorpus"
                label="%command.label.2"
                style="push">
          </command>
@@ -163,103 +163,103 @@
          point="org.eclipse.ui.commands">
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.LoadStructure"
-            id="org.txm.analec.commands.LoadStructure"
+            defaultHandler="org.txm.annotation.urs.commands.LoadStructure"
+            id="org.txm.annotation.urs.commands.LoadStructure"
             name="%command.name">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.EditStructure"
-            id="org.txm.analec.commands.EditAnnotationStructure"
+            defaultHandler="org.txm.annotation.urs.commands.EditStructure"
+            id="org.txm.annotation.urs.commands.EditAnnotationStructure"
             name="%command.name.0">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.SaveStructure"
-            id="org.txm.analec.commands.SaveStructure"
+            defaultHandler="org.txm.annotation.urs.commands.SaveStructure"
+            id="org.txm.annotation.urs.commands.SaveStructure"
             name="%command.name.1">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.LoadStructureFromGlozz"
-            id="org.txm.analec.commands.LoadStructureFromGlozz"
+            defaultHandler="org.txm.annotation.urs.commands.LoadStructureFromGlozz"
+            id="org.txm.annotation.urs.commands.LoadStructureFromGlozz"
             name="%command.name.2">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.LoadCorpus"
-            id="org.txm.analec.commands.LoadCorpus"
+            defaultHandler="org.txm.annotation.urs.commands.LoadCorpus"
+            id="org.txm.annotation.urs.commands.LoadCorpus"
             name="%command.name.3">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.SaveCorpus"
-            id="org.txm.analec.commands.SaveCorpus"
+            defaultHandler="org.txm.annotation.urs.commands.SaveCorpus"
+            id="org.txm.annotation.urs.commands.SaveCorpus"
             name="%command.name.4">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.LoadVue"
-            id="org.txm.analec.commands.LoadVue"
+            defaultHandler="org.txm.annotation.urs.commands.LoadVue"
+            id="org.txm.annotation.urs.commands.LoadVue"
             name="%command.name.5">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.SaveVue"
-            id="org.txm.analec.commands.SaveVue"
+            defaultHandler="org.txm.annotation.urs.commands.SaveVue"
+            id="org.txm.annotation.urs.commands.SaveVue"
             name="%command.name.6">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.SaveStructureAsGlozzModel"
-            id="org.txm.analec.commands.SaveStructureAsGlozzModel"
+            defaultHandler="org.txm.annotation.urs.commands.SaveStructureAsGlozzModel"
+            id="org.txm.annotation.urs.commands.SaveStructureAsGlozzModel"
             name="%command.name.7">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ImportGlozzCorpus"
-            id="org.txm.analec.commands.ImportGlozzCorpus"
+            defaultHandler="org.txm.annotation.urs.commands.ImportGlozzCorpus"
+            id="org.txm.annotation.urs.commands.ImportGlozzCorpus"
             name="%command.name.8">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ImportGlozzAnnotations"
-            id="org.txm.analec.commands.ImportGlozzAnnotations"
+            defaultHandler="org.txm.annotation.urs.commands.ImportGlozzAnnotations"
+            id="org.txm.annotation.urs.commands.ImportGlozzAnnotations"
             name="%command.name.9">
       </command>
       <command
-            defaultHandler="org.txm.analec.commands.DoInstallStep"
-            id="org.txm.analec.commands.DoInstallStep"
+            defaultHandler="org.txm.annotation.urs.commands.DoInstallStep"
+            id="org.txm.annotation.urs.commands.DoInstallStep"
             name="%command.name.10">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ExportGlozzCorpus"
-            id="org.txm.analec.commands.ExportGlozzCorpus"
+            defaultHandler="org.txm.annotation.urs.commands.ExportGlozzCorpus"
+            id="org.txm.annotation.urs.commands.ExportGlozzCorpus"
             name="%command.name.12">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ExportTEICorpus"
-            id="org.txm.analec.commands.ExportTEICorpus"
+            defaultHandler="org.txm.annotation.urs.commands.ExportTEICorpus"
+            id="org.txm.annotation.urs.commands.ExportTEICorpus"
             name="%command.name.13">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ImportTEICorpus"
-            id="org.txm.analec.commands.ImportTEICorpus"
+            defaultHandler="org.txm.annotation.urs.commands.ImportTEICorpus"
+            id="org.txm.annotation.urs.commands.ImportTEICorpus"
             name="%command.name.14">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.ImportTEIAnnotations"
-            id="org.txm.analec.commands.ImportTEIAnnotations"
+            defaultHandler="org.txm.annotation.urs.commands.ImportTEIAnnotations"
+            id="org.txm.annotation.urs.commands.ImportTEIAnnotations"
             name="%command.name.11">
       </command>
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.analec.commands.EditVue"
-            id="org.txm.analec.commands.EditVue"
+            defaultHandler="org.txm.annotation.urs.commands.EditVue"
+            id="org.txm.annotation.urs.commands.EditVue"
             name="%command.name.16">
       </command>
    </extension>
@@ -268,18 +268,18 @@
       <view
             allowMultiple="false"
             category="org.txm.rcp"
-            class="org.txm.analec.view.ElementPropertiesView"
+            class="org.txm.annotation.urs.view.ElementPropertiesView"
             icon="icons/pencil.png"
-            id="org.txm.analec.view.ElementPropertiesView"
+            id="org.txm.annotation.urs.view.ElementPropertiesView"
             name="%view.name"
             restorable="true">
       </view>
       <view
             allowMultiple="false"
             category="org.txm.rcp"
-            class="org.txm.analec.view.ElementSearchView"
+            class="org.txm.annotation.urs.view.ElementSearchView"
             icon="platform:/plugin/org.txm.rcp/icons/functions/Search.png"
-            id="org.txm.analec.view.ElementSearchView"
+            id="org.txm.annotation.urs.view.ElementSearchView"
             name="%view.name.0"
             restorable="true">
       </view>
@@ -287,7 +287,7 @@
    <extension
          point="org.txm.rcp.extentionpoint.command">
       <installcommand
-            class="org.txm.analec.commands.DoInstallStep"></installcommand>
+            class="org.txm.annotation.urs.commands.DoInstallStep"></installcommand>
    </extension>
    <extension
          point="org.eclipse.core.expressions.definitions">
@@ -295,16 +295,16 @@
             id="CanAnnotateWithAnalec">
          <test
                forcePluginActivation="true"
-               property="org.txm.analec.testers.canAnnotate">
+               property="org.txm.annotation.urs.testers.canAnnotate">
          </test>
       </definition>
    </extension>
    <extension
          point="org.eclipse.core.expressions.propertyTesters">
       <propertyTester
-            class="org.txm.analec.testers.IsCorpusAnnotated"
-            id="org.txm.analec.testers.IsCorpusAnnotated"
-            namespace="org.txm.analec.testers"
+            class="org.txm.annotation.urs.testers.IsCorpusAnnotated"
+            id="org.txm.annotation.urs.testers.IsCorpusAnnotated"
+            namespace="org.txm.annotation.urs.testers"
             properties="canAnnotate"
             type="java.lang.Object">
       </propertyTester>
@@ -313,26 +313,26 @@
          point="org.eclipse.ui.preferencePages">
       <page
             category="org.txm.rcp.preferences.UserPreferencePage"
-            class="org.txm.analec.preferences.AnalecPreferencePage"
-            id="org.txm.analec.preferences.AnalecPreferencePage"
+            class="org.txm.annotation.urs.preferences.AnalecPreferencePage"
+            id="org.txm.annotation.urs.preferences.AnalecPreferencePage"
             name="%page.name">
       </page>
    </extension>
    <extension
          point="org.txm.annotation.rcp.editor.AnnotationArea">
       <annotationtoolbar
-            class="org.txm.analec.toolbar.UnitToolbar"
+            class="org.txm.annotation.urs.toolbar.UnitToolbar"
             position="1">
       </annotationtoolbar>
       <annotationtoolbar
-            class="org.txm.analec.toolbar.SchemaToolbar"
+            class="org.txm.annotation.urs.toolbar.SchemaToolbar"
             position="2">
       </annotationtoolbar>
    </extension>
    <extension
          point="org.txm.PostTXMHOMEInstallationStep">
       <PostTXMHOMEInstallationStep
-            class="org.txm.analec.InstallAnalecFiles"
+            class="org.txm.annotation.urs.InstallAnalecFiles"
             description="Install analec Files"
             name="Analec macro">
       </PostTXMHOMEInstallationStep>
@@ -340,7 +340,7 @@
    <extension
          point="org.txm.annotation.core.AnnotationEngine">
       <AnnotationEngine
-            class="org.txm.analec.AnalecCorpora"
+            class="org.txm.annotation.urs.AnalecCorpora"
             description="Analec annotations">
       </AnnotationEngine>
    </extension>
Index: tmp/org.txm.analec.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.analec.rcp/META-INF/MANIFEST.MF	(revision 1199)
+++ tmp/org.txm.analec.rcp/META-INF/MANIFEST.MF	(revision 1200)
@@ -156,15 +156,15 @@
  org.jfree.xml.util,
  org.jfree.xml.writer,
  org.jfree.xml.writer.coretypes,
- org.txm.analec,
- org.txm.analec.commands,
- org.txm.analec.export,
- org.txm.analec.imports,
- org.txm.analec.preferences,
- org.txm.analec.testers,
- org.txm.analec.toolbar,
- org.txm.analec.view,
- org.txm.analec.widgets,
+ org.txm.annotation.urs,
+ org.txm.annotation.urs.commands,
+ org.txm.annotation.urs.export,
+ org.txm.annotation.urs.imports,
+ org.txm.annotation.urs.preferences,
+ org.txm.annotation.urs.testers,
+ org.txm.annotation.urs.toolbar,
+ org.txm.annotation.urs.view,
+ org.txm.annotation.urs.widgets,
  org.txm.macro.analec,
  org.txm.macro.analec.edit,
  org.txm.macro.analec.exploit,
@@ -187,6 +187,6 @@
 Bundle-Name: %Bundle-Name.0
 Bundle-ManifestVersion: 2
 Bundle-Activator: analecrcp.Activator
-Bundle-SymbolicName: org.txm.analec.rcp;singleton:=true
+Bundle-SymbolicName: org.txm.annotation.urs.rcp;singleton:=true
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 
Index: tmp/org.txm.analec.rcp/.project
===================================================================
--- tmp/org.txm.analec.rcp/.project	(revision 1199)
+++ tmp/org.txm.analec.rcp/.project	(revision 1200)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>org.txm.analec.rcp</name>
+	<name>org.txm.annotation.urs.rcp</name>
 	<comment></comment>
 	<projects>
 	</projects>
@@ -26,7 +26,4 @@
 		<nature>org.eclipse.pde.PluginNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
-	<filteredResources>
-		
-	</filteredResources>
 </projectDescription>
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 1199)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 1200)
@@ -458,4 +458,8 @@
 	public void notify(TXMResult r, String state) {
 		// TODO Auto-generated method stub
 	}
+
+	public static CQPSearchEngine getEngine() {
+		return (CQPSearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP");
+	}
 }
Index: tmp/org.txm.para.core/src/org/txm/para/core/functions/ParaBrowser.java
===================================================================
--- tmp/org.txm.para.core/src/org/txm/para/core/functions/ParaBrowser.java	(revision 1199)
+++ tmp/org.txm.para.core/src/org/txm/para/core/functions/ParaBrowser.java	(revision 1200)
@@ -214,7 +214,7 @@
 				return new Pair<String, QueryResult>("error", null);
 			} 
 			return new Pair<String, QueryResult>(LangFormater.format(text, corpus
-					.getLang()), result);
+					.getLanguage()), result);
 		}
 		// return keywordsViewPropValues;
 		return new Pair<String, QueryResult>("error no property", null);
Index: tmp/org.txm.analec.feature/.project
===================================================================
--- tmp/org.txm.analec.feature/.project	(revision 1199)
+++ tmp/org.txm.analec.feature/.project	(revision 1200)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>org.txm.analec.feature</name>
+	<name>org.txm.annotation.urs.feature</name>
 	<comment></comment>
 	<projects>
 	</projects>
Index: tmp/org.txm.analec.feature/feature.xml
===================================================================
--- tmp/org.txm.analec.feature/feature.xml	(revision 1199)
+++ tmp/org.txm.analec.feature/feature.xml	(revision 1200)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <feature
-      id="org.txm.analec.feature"
+      id="org.txm.annotation.urs.feature"
       label="Annotation URS (Unité-Relation-Schéma)"
       version="1.0.0.qualifier"
       provider-name="Textometrie.org">
@@ -83,7 +83,7 @@
    </requires>
 
    <plugin
-         id="org.txm.analec.rcp"
+         id="org.txm.annotation.urs.rcp"
          download-size="0"
          install-size="0"
          version="0.0.0"
Index: tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 1199)
+++ tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 1200)
@@ -773,9 +773,9 @@
 		return getProject().getFont();
 	}
 	
-	public String getLang( ) {
-		return getProject().getLang();
-	}
+//	public String getLang( ) {
+//		return getProject().getLang();
+//	}
 	
 	/**
 	 * Gets the description.
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1199)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1200)
@@ -746,6 +746,8 @@
 		File binarydir = this.getProjectDirectory();
 
 		if (binarydir.exists() && exportzip.getParentFile().exists()) {
+			this.save();
+			
 			try {
 				Zip.compress(binarydir, exportzip, monitor);
 			} catch (IOException e) {
@@ -1227,7 +1229,7 @@
 	 * 
 	 * @return
 	 */
-	// FIXME: SJ: need to see if we need this, it doesn't seem.
+	// FIXME: SJ: need to see if we need this, it doesn't seem. MD: I need this for exporting corpus and saving import parameters 
 	public boolean save() {
 		try {
 			ProjectScope scope = this.getPreferencesScope();
@@ -1245,6 +1247,8 @@
 					TXMPreferences.flush(r);
 				}
 			}
+			
+			Toolbox.notifyEngines(this, "save"); // save things before exporting or else
 		} catch (Exception e) {
 			e.printStackTrace();
 			return false;
Index: tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java
===================================================================
--- tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java	(revision 1199)
+++ tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java	(revision 1200)
@@ -1,5 +1,6 @@
 package org.txm.annotation.kr.core.storage.temporary;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -35,7 +36,8 @@
 	 * @return
 	 */
 	public static HashMap<String, Object> getInitialisationProperties(Class clazz, MainCorpus corpus) {
-		String path = corpus.getProjectDirectory().getAbsolutePath()+"/temporary_annotations/db";
+		File path = new File(corpus.getProjectDirectory(), "temporary_annotations/"+corpus.getID()+"/db");
+		path.getParentFile().mkdirs();
 		
 		HashMap<String, Object> properties = new HashMap<String, Object>();
 		//System.out.println("CLASSLOADER: "+Toolbox.class.getClassLoader());
Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/SearchStringsToTranslate.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/SearchStringsToTranslate.java	(revision 0)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/SearchStringsToTranslate.java	(revision 1200)
@@ -0,0 +1,58 @@
+package org.txm.rcp.translate;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.search.ui.text.TextSearchQueryProvider;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.views.navigator.ResourceNavigator;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+
+public class SearchStringsToTranslate extends BaseAbstractHandler {
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		IProject newProject = CreateTranslateProject.getOrCreateProject();
+
+		// project should exists now, we can show it
+		try {
+			openSearchView(newProject);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
+	public static final String SEARCHVIEW_ID = "org.eclipse.search.ui.views.SearchView";
+	public static void openSearchView(IProject newProject) throws CoreException {
+
+		IViewPart view = CreateTranslateProject.openView();
+		if (view != null) {
+			CreateTranslateProject.openTranslateWorkingSet(view, newProject);
+
+			ResourceNavigator navigator = (ResourceNavigator)view;
+			IWorkingSet wk = navigator.getWorkingSet();
+			ArrayList<IResource> res = new ArrayList<IResource>();
+			for (IAdaptable a : wk.getElements()) {
+				if (a instanceof IResource) {
+					res.add((IResource) a);
+				}
+			}
+			
+			TextSearchQueryProvider provider= TextSearchQueryProvider.getPreferred();
+			ISearchQuery query = provider.createQuery("NA_", res.toArray(new IResource[res.size()]));
+
+			NewSearchUI.runQueryInBackground(query);
+		}
+	}
+}

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

Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/CreateTranslateProject.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/CreateTranslateProject.java	(revision 1199)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/CreateTranslateProject.java	(revision 1200)
@@ -12,8 +12,6 @@
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ProjectScope;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -36,8 +34,63 @@
 
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+
+		IProject newProject = getOrCreateProject();
+
+		// project should exists now, we can show it
+		IViewPart view = openView();
+		if (view != null) {
+			openTranslateWorkingSet(view, newProject);
+		}
+
+		return null;
+	}
+
+	public static void openTranslateWorkingSet(IViewPart view, IProject newProject) {
+		ResourceNavigator navigator = (ResourceNavigator)view;
+		try {
+			IFolder plugins = newProject.getFolder("plugins");
+
+			//focus on plugins in the plugins directory (link) 
+			navigator.getTreeViewer().setSelection(new StructuredSelection(plugins));
+			FrameList fm = navigator.getFrameList();
+			GoIntoAction a = new GoIntoAction(fm);
+			a.run();
+
+			// show only the properties files
+			ArrayList<IResource> propertiesFiles = new ArrayList<>();
+			ExportTranslateProject.findPropertiesFile(plugins, propertiesFiles);
+			IResource[] elements = propertiesFiles.toArray(new IResource[propertiesFiles.size()]);
+
+			WorkingSet wk = new WorkingSet("Translate TXM", "Translate TXM", elements);
+			navigator.setWorkingSet(wk);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	public static final String NAVIGATOR_ID = "org.eclipse.ui.views.ResourceNavigator";
+	public static IViewPart openView() {
+		// open Element View if not opened
+		try {
+			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+			IViewPart view = page.findView(NAVIGATOR_ID);
+			if (view == null) {
+				view = page.showView(NAVIGATOR_ID);
+			}
+
+			return view;
+		} catch (PartInitException e1) {
+			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
+			Log.printStackTrace(e1);
+		}
+		return null;
+	}
+	
+	public static IProject getOrCreateProject() {
 		IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
 		IProject newProject = workspace.getRoot().getProject("translate");
 		IScopeContext projectScope = new ProjectScope(newProject);
 
@@ -88,50 +141,7 @@
 				e.printStackTrace();
 			}
 		} 
-
-		// project should exists now, we can show it
-		IViewPart view = openView();
-		if (view != null) {
-			ResourceNavigator navigator = (ResourceNavigator)view;
-			try {
-				IFolder plugins = newProject.getFolder("plugins");
-
-				//focus on plugins in the plugins directory (link) 
-				navigator.getTreeViewer().setSelection(new StructuredSelection(plugins));
-				FrameList fm = navigator.getFrameList();
-				GoIntoAction a = new GoIntoAction(fm);
-				a.run();
-
-				// show only the properties files
-				ArrayList<IResource> propertiesFiles = new ArrayList<>();
-				ExportTranslateProject.findPropertiesFile(plugins, propertiesFiles);
-				IResource[] elements = propertiesFiles.toArray(new IResource[propertiesFiles.size()]);
-
-				navigator.setWorkingSet(new WorkingSet("Translate TXM", "Translate TXM", elements));
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-
-		return null;
+		
+		return newProject;
 	}
-
-	public static final String NAVIGATOR_ID = "org.eclipse.ui.views.ResourceNavigator";
-	public static IViewPart openView() {
-		// open Element View if not opened
-		try {
-			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-			IViewPart view = page.findView(NAVIGATOR_ID);
-			if (view == null) {
-				view = page.showView(NAVIGATOR_ID);
-			}
-
-			return view;
-		} catch (PartInitException e1) {
-			System.out.println("Part initialisation error: "+e1.getLocalizedMessage());
-			Log.printStackTrace(e1);
-		}
-		return null;
-	}
 }
Index: tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle.properties	(revision 1199)
+++ tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle.properties	(revision 1200)
@@ -10,4 +10,6 @@
 command.label.2 = Export translation
 command.name.1 = CreateTranslateProject
 command.name.2 = ExportTranslateProject
-Bundle-Name.0 = org.txm.translate.rcp
\ No newline at end of file
+Bundle-Name.0 = org.txm.translate.rcp
+command.label.3 = Search strings to translate
+command.name.3 = Search strings to translate
\ No newline at end of file
Index: tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 1200)
@@ -0,0 +1,15 @@
+#Properties file for org.txm.translate.rcp
+menu.label = Traduire
+command.label = Ouvrir les outils de traduction
+command.label.0 = Exporter les chaines traduites
+command.name = Ouvrir les outils de traduction
+command.name.0 = Exporter les traductions
+Bundle-Name = org.txm.translate.rcp
+menu.label.0 = Traduire
+command.label.1 = Ouvrir les outils de traduction
+command.label.2 = Exporter les chaines traduites
+command.name.1 = Ouvrir les outils de traduction
+command.name.2 = Exporter les chaines traduites
+Bundle-Name.0 = org.txm.translate.rcp
+command.label.3 = Rechercher des cha\u00EEnes \u00E0 traduire
+command.name.3 = Rechercher des cha\u00EEnes \u00E0 traduire
\ No newline at end of file

Property changes on: tmp/org.txm.translate.rcp/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.translate.rcp/plugin.xml
===================================================================
--- tmp/org.txm.translate.rcp/plugin.xml	(revision 1199)
+++ tmp/org.txm.translate.rcp/plugin.xml	(revision 1200)
@@ -11,10 +11,17 @@
                label="%menu.label.0">
             <command
                   commandId="org.txm.rcp.translate.CreateTranslateProject"
+                  icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
                   label="%command.label.1">
             </command>
             <command
+                  commandId="org.txm.rcp.translate.SearchStringsToTranslate"
+                  icon="platform:/plugin/org.eclipse.search/icons/full/etool16/search.png"
+                  label="%command.label.3">
+            </command>
+            <command
                   commandId="org.txm.rcp.translate.ExportTranslateProject"
+                  icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/export_wiz.png"
                   label="%command.label.2">
             </command>
          </menu>
@@ -32,6 +39,11 @@
             id="org.txm.rcp.translate.ExportTranslateProject"
             name="%command.name.2">
       </command>
+      <command
+            defaultHandler="org.txm.rcp.translate.SearchStringsToTranslate"
+            id="org.txm.rcp.translate.SearchStringsToTranslate"
+            name="%command.name.3">
+      </command>
    </extension>
 
 </plugin>
Index: tmp/org.txm.translate.rcp/.settings/org.eclipse.core.resources.prefs
===================================================================
--- tmp/org.txm.translate.rcp/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ tmp/org.txm.translate.rcp/.settings/org.eclipse.core.resources.prefs	(revision 1200)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//OSGI-INF/l10n/bundle_fr.properties=UTF-8

Property changes on: tmp/org.txm.translate.rcp/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.translate.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.translate.rcp/META-INF/MANIFEST.MF	(revision 1199)
+++ tmp/org.txm.translate.rcp/META-INF/MANIFEST.MF	(revision 1200)
@@ -5,4 +5,5 @@
 Bundle-Version: 1.0.0.qualifier
 Automatic-Module-Name: org.txm.translate.rcp
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.txm.rcp;bundle-version="0.8.0"
+Require-Bundle: org.txm.rcp;bundle-version="0.8.0",
+ org.eclipse.search;bundle-version="3.11.100"
Index: tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java
===================================================================
--- tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java	(revision 1199)
+++ tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java	(revision 1200)
@@ -73,7 +73,7 @@
 			if (selection instanceof CQPCorpus) {
 				try {
 					CQPCorpus corpus = (CQPCorpus) selection; 
-					String lang = corpus.getLang();
+					String lang = corpus.getLanguage();
 					CQLQuery query;
 					if (corpus.getProperty(lang + "pos") != null) { //$NON-NLS-1$
 						query = new CQLQuery(WordCloud.getQueryForLang(lang));
