Index: TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java
===================================================================
--- TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java	(revision 3396)
+++ TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java	(revision 3397)
@@ -28,24 +28,12 @@
 package org.txm.backtomedia.commands.function;
 
 import java.io.File;
-import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
-import java.net.URLEncoder;
 
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPage;
Index: TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java
===================================================================
--- TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 3396)
+++ TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 3397)
@@ -20,13 +20,10 @@
 import org.eclipse.swt.widgets.ToolItem;
 import org.txm.annotation.rcp.messages.AnnotationUIMessages;
 import org.txm.concordance.core.functions.Concordance;
-import org.txm.core.preferences.TBXPreferences;
 import org.txm.core.results.TXMResult;
 import org.txm.objects.Text;
-import org.txm.rcp.IImageKeys;
 import org.txm.rcp.commands.workspace.UpdateCorpus;
 import org.txm.rcp.editors.TXMEditorExtension;
-import org.txm.rcp.editors.TXMEditorToolBar;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.corpora.CorporaView;
@@ -81,8 +78,10 @@
 			try {
 				Object o = celement.createExecutableExtension("class"); //$NON-NLS-1$
 				AnnotationArea aa = (AnnotationArea) o;
-				
-				if (!aa.getAnnotatedTXMResultClass().equals(editor.getResult().getClass())) {
+				Class<? extends TXMResult> cc = aa.getAnnotatedTXMResultClass();
+				TXMResult r = editor.getResult();
+				if (r == null) return;
+				if (!cc.equals(r.getClass())) {
 					continue;
 				}
 				Log.finer("Installing AnnotationExtension: " + aa.getName());
@@ -107,7 +106,7 @@
 				});
 			}
 			catch (Exception exx) {
-				exx.printStackTrace();
+				Log.printStackTrace(exx);
 			}
 		}
 		
@@ -156,8 +155,7 @@
 					notifyDoSave();
 				}
 				catch (Exception e1) {
-					// TODO Auto-generated catch block
-					e1.printStackTrace();
+					Log.printStackTrace(e1);
 				}
 			}
 			
@@ -348,7 +346,7 @@
 						return Status.OK_STATUS;
 					}
 				} catch(ThreadDeath ex) {
-					Log.info(TXMUIMessages.executionCanceled);
+					Log.warning(TXMUIMessages.executionCanceled);
 					return Status.CANCEL_STATUS;
 				}
 			}
Index: TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java	(revision 3396)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/logger/Log.java	(revision 3397)
@@ -59,7 +59,7 @@
 	protected static FileHandler fh;
 
 	public static int MAX_LINE_LENGTH = 1000;
-	
+
 	/**
 	 * The CONSOLE flags indicates if messages with level < INFO are printed in
 	 * console
@@ -224,13 +224,13 @@
 	 * @param message
 	 */
 	public static void severe(String message) {
-		
+
 		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
 			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
-			}
-message = message.replace("\n", "⏎");
-		
+		}
+		message = message.replace("\n", "⏎");
 
+
 		if (Level.SEVERE.intValue() >= txm.getLevel().intValue()) {
 			System.out.println(message);
 
@@ -293,13 +293,13 @@
 	 * @param message
 	 */
 	public static void warning(String message) {
-		
+
 		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
 			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
-			}
-message = message.replace("\n", "⏎");
-		
-		
+		}
+		message = message.replace("\n", "⏎");
+
+
 		if (Level.WARNING.intValue() >= txm.getLevel().intValue()) {
 			System.out.println(message);
 			// System.out.print("AT: ");
@@ -336,7 +336,7 @@
 	public static void info(String message) {
 		info(message, true);
 	}
-	
+
 	/**
 	 * Log an info message
 	 * 
@@ -345,13 +345,13 @@
 	 *            where to print the message
 	 */
 	public static void info(String message, boolean newline) {
-		
+
 		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
 			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
-			}
-message = message.replace("\n", "⏎");
-		
-		
+		}
+		message = message.replace("\n", "⏎");
+
+
 		if (Level.INFO.intValue() >= txm.getLevel().intValue()) {
 			if (newline) System.out.println(message);
 			else  System.out.print(message);
@@ -403,7 +403,7 @@
 	public static void fine(String message) {
 		fine(message, true);
 	}
-	
+
 	/**
 	 * Log an info message
 	 * 
Index: TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java
===================================================================
--- TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 3396)
+++ TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 3397)
@@ -51,7 +51,6 @@
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.core.results.Parameter;
 import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
 import org.txm.objects.Match;
 import org.txm.searchengine.core.IQuery;
 import org.txm.searchengine.core.QueryBasedTXMResult;
@@ -260,7 +259,7 @@
 			String refPropertyNames = this.getStringParameterValue(ConcordancePreferences.VIEW_REFERENCE_PATTERN);
 			String refPropertyNames2 = this.getCorpus().getProject().getCommandPreferences("concordance").get(ConcordancePreferences.VIEW_REFERENCE_PATTERN);
 			if (refPropertyNames2 != null && refPropertyNames2.length() > 0) {
-				ReferencePattern ref = ReferencePattern.stringToReferencePattern(this.getCorpus(), refPropertyNames);
+				ReferencePattern ref = ReferencePattern.stringToReferencePattern(this.getCorpus(), refPropertyNames2);
 				if (ref.getProperties().size() > 0) { // ensure the ref properties is well set
 					refPropertyNames = refPropertyNames2;
 				}
@@ -597,30 +596,52 @@
 		if (to >= nLines) to = nLines - 1;
 		
 		List<? extends Match> matches = queryResult.getMatches(from, to);
-//		boolean hasTarget = false;
-//		for (Match m : matches) {
-//			if (m.getTarget() >= 0) {
-//				hasTarget = true;
-//				break;
-//			}
-//		}
+		//		boolean hasTarget = false;
+		//		for (Match m : matches) {
+		//			if (m.getTarget() >= 0) {
+		//				hasTarget = true;
+		//				break;
+		//			}
+		//		}
 		
 		// System.out.println("cqllimit="+cql_limit);
 		// System.out.println("CQLLimitStarts="+CQLLimitStarts);
 		if (pLimitCQL != null && CQLLimitStarts == null) { // initialize text limits
 			try {
-				Log.fine("Get CQL limit for query=" + pLimitCQL);
-				CQLLimitStarts = this.getCorpus().getStartLimits(pLimitCQL);
-				if (CQLLimitStarts.length > 0 && CQLLimitStarts[0] != 0) {
-					int[] tmp = new int[CQLLimitStarts.length + 1];
-					System.arraycopy(CQLLimitStarts, 0, tmp, 1, CQLLimitStarts.length);
-					CQLLimitStarts = tmp;
-				}
+//				CorpusCommandPreferences prefs = getProject().getCommandPreferences("concordance");
+//				if (prefs != null && "list".equals(prefs.get("context_limits_type"))) {
+//					String str = prefs.get("context_limits");
+//					TreeSet<Integer> positions = new TreeSet<Integer>();
+//						String[] ss = str.split(",");
+//						
+//						for (String s : ss) {
+//							int[] tmp = this.getCorpus().getStartLimits("<" + s + "> []");
+//							for (int i = 0 ; i < tmp.length ; i++) positions.add(tmp[i]);
+//							tmp = this.getCorpus().getStartLimits("[] </" + s + ">");
+//							for (int i = 0 ; i < tmp.length ; i++) positions.add(tmp[i]);
+//						}
+//						
+//						CQLLimitStarts = new int[positions.size()];
+//						int i = 0;
+//						for (int p : positions) {
+//							CQLLimitStarts[i] = p;
+//							i++;
+//						}
+//				} else {
+					Log.fine("Get CQL limit for query=" + pLimitCQL);
+					CQLLimitStarts = this.getCorpus().getStartLimits(pLimitCQL);
+					if (CQLLimitStarts.length > 0 && CQLLimitStarts[0] != 0) {
+						int[] tmp = new int[CQLLimitStarts.length + 1];
+						System.arraycopy(CQLLimitStarts, 0, tmp, 1, CQLLimitStarts.length);
+						CQLLimitStarts = tmp;
+					}
+//				}
 			}
 			catch (Exception e) {
 				org.txm.utils.logger.Log.printStackTrace(e);
 				Log.severe(NLS.bind(ConcordanceCoreMessages.failedToGetTextsLimitsColonP0, e));
 			}
+			
 		}
 		
 		int currentCQLLimit = 0;
@@ -662,21 +683,21 @@
 					currentKeywordPos = match.getStart();
 					currentKeywordEndPos = match.getEnd();
 					
-//					if (hasTarget) {
-//						if (Concordance.TARGET_SELECT.equals(pTargetStrategy)) {
-//							currentKeywordPos = match.getTarget();
-//							currentKeywordEndPos = match.getTarget();
-//						} else if (Concordance.TARGET_KEEPLEFT.equals(pTargetStrategy)) {
-//							currentKeywordPos = match.getStart();
-//							currentKeywordEndPos = match.getTarget();
-//						} else if (Concordance.TARGET_KEEPRIGHT.equals(pTargetStrategy)) {
-//							currentKeywordPos = match.getTarget();
-//							currentKeywordEndPos = match.getEnd();
-//						} else if (Concordance.TARGET_SHOW.equals(pTargetStrategy)) {
-//							currentKeywordPos = match.getStart();
-//							currentKeywordEndPos = match.getEnd();
-//						}
-//					}
+					//					if (hasTarget) {
+					//						if (Concordance.TARGET_SELECT.equals(pTargetStrategy)) {
+					//							currentKeywordPos = match.getTarget();
+					//							currentKeywordEndPos = match.getTarget();
+					//						} else if (Concordance.TARGET_KEEPLEFT.equals(pTargetStrategy)) {
+					//							currentKeywordPos = match.getStart();
+					//							currentKeywordEndPos = match.getTarget();
+					//						} else if (Concordance.TARGET_KEEPRIGHT.equals(pTargetStrategy)) {
+					//							currentKeywordPos = match.getTarget();
+					//							currentKeywordEndPos = match.getEnd();
+					//						} else if (Concordance.TARGET_SHOW.equals(pTargetStrategy)) {
+					//							currentKeywordPos = match.getStart();
+					//							currentKeywordEndPos = match.getEnd();
+					//						}
+					//					}
 					
 					if (CQLLimitStarts != null && currentCQLLimit < CQLLimitStarts.length) {
 						while (currentCQLLimit < CQLLimitStarts.length && CQLLimitStarts[currentCQLLimit] <= currentKeywordPos) { // find the match's text
@@ -707,11 +728,11 @@
 					// TARGET POSITION
 					
 					
-//					if (Concordance.TARGET_SELECT.equals(pTargetStrategy) || Concordance.TARGET_KEEPLEFT.equals(pTargetStrategy) || Concordance.TARGET_KEEPRIGHT.equals(pTargetStrategy)) {
-//						targetPositions.add(match.getTarget());
-//					} else if (Concordance.TARGET_SHOW.equals(pTargetStrategy)) {
-						targetPositions.add(match.getTarget());
-//					}
+					//					if (Concordance.TARGET_SELECT.equals(pTargetStrategy) || Concordance.TARGET_KEEPLEFT.equals(pTargetStrategy) || Concordance.TARGET_KEEPRIGHT.equals(pTargetStrategy)) {
+					//						targetPositions.add(match.getTarget());
+					//					} else if (Concordance.TARGET_SHOW.equals(pTargetStrategy)) {
+					targetPositions.add(match.getTarget());
+					//					}
 					
 					// check if the end of keyword pass a text limit
 					currentKeywordPos = currentKeywordEndPos;
Index: TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java	(revision 3396)
+++ TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java	(revision 3397)
@@ -26,6 +26,7 @@
 import org.txm.objects.Workspace;
 import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.tokenizer.TokenizerClasses;
+import org.txm.utils.DeleteDir;
 import org.txm.utils.ExecTimer;
 import org.txm.utils.logger.Log;
 
@@ -85,6 +86,17 @@
 					TXMResult child = project.getChildren().get(0);
 					child.delete();
 				}
+				
+				// clear files
+				for (File f : project.getProjectDirectory().listFiles()) {
+					if (".settings".equals(f.getName())) continue;
+					if (".project".equals(f.getName())) continue;
+					if (f.isDirectory()) {
+						DeleteDir.deleteDirectory(f);
+					} else {
+						f.delete();
+					}
+				}
 				// System.out.println("TXM FILES: " + Arrays.asList(new File(project.getProjectDirectory(), "txm/" + project.getName()).list()));
 			}
 			
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/cqp/edition/XTZEditionBuilderMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/cqp/edition/XTZEditionBuilderMacro.groovy	(revision 0)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/cqp/edition/XTZEditionBuilderMacro.groovy	(revision 3397)
@@ -0,0 +1,165 @@
+package org.txm.macroproto.edition
+
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcp.swt.widget.parameters.*
+import org.txm.macro.edition.BuildFacsEditions;
+import org.txm.macro.edition.RemoveTag;
+import org.txm.objects.*
+import org.txm.searchengine.cqp.corpus.*;
+import org.w3c.dom.*
+import org.txm.utils.xml.DomUtils
+import org.txm.Toolbox
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.txm.rcp.commands.*
+
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+println "Corpus view selection is: "+corpusViewSelection
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "This marcro works with a MainCorpus selection. Aborting"
+	return;
+}
+def corpus = corpusViewSelection
+debug = false
+def editionName = corpus.getDefaultEdition()
+
+// PARAMETERS
+@Field @Option(name="wordsPerPage", usage="Number of words per page", widget="Integer", required=true, def="500")
+int wordsPerPage
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+File binDirectory = corpus.getProject().getProjectDirectory()
+File txmDirectory = new File(binDirectory, "txm/"+corpus.getID().toUpperCase())
+
+File HTMLDirectory = new File(binDirectory, "HTML")
+File newEditionDirectory = new File(HTMLDirectory, corpus.getID().toUpperCase()+"/"+editionName)
+
+BaseParameters parameters = corpus.getProject().params
+
+if (!HTMLDirectory.exists()) {
+	println "ERROR: can't find this corpus 'HTML' directory: $HTMLDirectory. Aborting"
+	return false;
+}
+
+File workDirectory = txmDirectory
+if (!workDirectory.exists()) {
+	println "XML-TXM directory ($txmDirectory) not found. Using XML tokenized directory instead: "+tokenizedDirectory
+	workDirectory = tokenizedDirectory
+}
+if (!workDirectory.exists()) {
+	println "XML tokenized directory not found: "+tokenizedDirectory
+	println "Aborting."
+	return false
+}
+
+println "Work directory=$workDirectory"
+
+//0- clean previous edition if any : html files, import.xml
+if (newEditionDirectory.exists()) {
+	println "** Old version of $editionName edition found."
+	println " removing the 'edition' reference from the corpus configuration."
+	File tempParam = new File(binDirectory, "import.xml.cpy")
+	RemoveTag rt = new RemoveTag(
+			parameters.root.getOwnerDocument(), // will be updated
+			null, // don't create a new import.xml
+			"//edition[@name='$editionName']"
+			)
+	println " delete $newEditionDirectory"
+	newEditionDirectory.deleteDir()
+	
+	printDOM(parameters.root.getOwnerDocument())
+}
+
+//2- fix import.xml
+println "** Updating corpus configuration..."
+// for edition list
+def corpusElem = parameters.getCorpusElement()
+parameters.addEditionDefinition(corpusElem, editionName, "groovy", "FacsEditionBuilderMacro");
+
+//1- create HTML files
+println "** Building new edition HTML files..."
+
+println " Creating edition $editionName directory: $newEditionDirectory"
+newEditionDirectory.mkdir()
+for (def xmlFile : workDirectory.listFiles()) {
+	if (xmlFile.isHidden() || xmlFile.isDirectory()) continue // ignore
+	String txtname = xmlFile.getName()
+	int idx = txtname.lastIndexOf(".")
+	if (idx > 0) txtname = txtname.substring(0,idx)
+
+	println " Build HTML pages of text=$txtname"
+	BuildFacsEditions builder = new BuildFacsEditions(xmlFile, newEditionDirectory, parameters.name, txtname, wordsPerPage);
+	def newPages = builder.process()
+	if (newPages == null || newPages.size() == 0) {
+		println "WARNING: no edition files created with $xmlFile"
+	} 
+		
+	println " Build edition references in corpus configuration"
+	
+	Element textElem = corpus.getText(txtname).getSelfElement()
+	Element editionElem = parameters.addEdition(textElem, editionName, newEditionDirectory.getAbsolutePath(), "html");
+	//println "$textElem $editionElem"
+	for (def pagedef : newPages) {
+		parameters.addPage(editionElem, pagedef[0], pagedef[1]);
+	}
+}
+
+	printDOM(parameters.root.getOwnerDocument())
+
+//3- Save and reload the corpus
+println " Saving corpus configuration..."
+File paramFile = new File(binDirectory, "import.xml");
+DomUtils.save(parameters.root.getOwnerDocument(), paramFile);
+
+
+//4- Reload Corpora
+Toolbox.restart();
+monitor.syncExec(new Runnable() {
+			public void run() {
+				println "RELOAD VIEWS"
+				RestartTXM.reloadViews();
+				println "RELOAD VIEWS2"
+			}
+		});
+
+//5- Done
+println "New edition created. Be sure to copy images files in $newEditionDirectory"
+
+printDOM(parameters.root.getOwnerDocument())
+
+def printDOM(def doc) {
+	if (!debug) return;
+	try {
+		// Création de la source DOM
+		Source source = new DOMSource(doc);
+		
+		// Création du fichier de sortie
+		StreamResult resultat = new StreamResult(new PrintWriter(System.out));
+		
+		// Configuration du transformer
+		TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+		Transformer transformer = fabrique.newTransformer();
+		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");  //$NON-NLS-1$
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");  //$NON-NLS-1$
+		
+		// Transformation
+		transformer.transform(source, resultat);
+		// writer.close();
+		return true;
+	} catch (Exception e) {
+		e.printStackTrace();
+		return false;
+	}
+}
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3396)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3397)
@@ -111,6 +111,7 @@
 		
 		//prepare metadata if any
 		File allMetadataFile = Metadatas.findMetadataFile(inputDirectory);
+		println "ALLMETADATAFILE="+allMetadataFile
 		if (allMetadataFile.exists()) {
 			File copy = new File(binDir, allMetadataFile.getName())
 			if (!FileCopy.copy(allMetadataFile, copy)) {
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/filters/Tokeniser/OneTagPerLine.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/filters/Tokeniser/OneTagPerLine.groovy	(revision 3396)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/filters/Tokeniser/OneTagPerLine.groovy	(revision 3397)
@@ -33,7 +33,6 @@
 import javax.xml.stream.*;
 import java.net.URL;
 import org.txm.importer.scripts.filters.*;
-import java.net.URLEncoder;
 
 // TODO: Auto-generated Javadoc
 /**
@@ -226,8 +225,6 @@
 									}
 								//replace & by &amp; ; < by &lt; ; insecable space by space
 								chars.append(parser.getText().substring(start).replace("\t", " ").replace("&","&amp;").replace("<","&lt;").replace(" "," ").trim()+ " ");
-								//String text = URLEncoder.encode(parser.getText().substring(start))
-								//output.write(text);
 							}
 							break;
 					}
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages_fr.properties
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages_fr.properties	(revision 3396)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages_fr.properties	(revision 3397)
@@ -52,11 +52,11 @@
 
 noEditionFound = Édition introuvable 
 
-noEditionFoundForTextEqualsP0AndEditionEqualsP1 = Aucune édition ''{1}'' trouvée pour le texte ''{0}''
+noEditionFoundForTextEqualsP0AndEditionEqualsP1 = Aucune édition ''{0}'' trouvée pour le texte ''{1}''.
 
 noEditionToOpen = Pas d'édition disponible.
 
-noEditionWithNameEqualsP0AvailableForTextEqualsP1 = Aucune édition "{1}" trouvée pour le texte {0}.
+noEditionWithNameEqualsP0AvailableForTextEqualsP1 = Aucune édition ''{0}'' trouvée pour le texte ''{1}''.
 
 openingDefaultEditionsColonP0 = Ouverture de l'édition [{0}]...
 
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages.properties
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages.properties	(revision 3396)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages.properties	(revision 3397)
@@ -52,11 +52,11 @@
 
 noEditionFound = Edition not found
 
-noEditionFoundForTextEqualsP0AndEditionEqualsP1 = No ''{1}'' edition found for text {0}
+noEditionFoundForTextEqualsP0AndEditionEqualsP1 = No ''{0}'' edition found for text ''{1}''.
 
 noEditionToOpen = No edition available.
 
-noEditionWithNameEqualsP0AvailableForTextEqualsP1 = No "{1}" edition found for text {0}.
+noEditionWithNameEqualsP0AvailableForTextEqualsP1 = No ''{0}'' edition found for text ''{1}''.
 
 openingDefaultEditionsColonP0 = Opening [{0}] edition...
 
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java	(revision 3396)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java	(revision 3397)
@@ -2,7 +2,6 @@
 
 import java.io.File;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -44,6 +43,7 @@
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.editors.CommandLink;
 import org.txm.rcp.utils.IOClipboard;
+import org.txm.rcp.utils.URLUtils;
 import org.txm.utils.io.IOUtils;
 import org.txm.utils.logger.Log;
 
@@ -55,8 +55,11 @@
 	// private List<String> lineids;
 	/** The edition. */
 	Text currentText;
+	
 	String editionName;
+	
 	Edition currentEdition;
+	
 	Page currentPage;
 	
 	protected SynopticEditionEditor synopticEditionEditor;
@@ -122,7 +125,7 @@
 			// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
 			// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
 			"} catch (e) { };"; //$NON-NLS-1$
-	
+			
 	public static final String highlightscriptRuleFast = "sheet.insertRule(\"#%s {background-color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
 	
 	public static final String colorscriptRuleFast = "sheet.insertRule(\"#%s {color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
@@ -259,46 +262,53 @@
 	private ArrayList<ProgressListener> beforeHighlighListeners;
 	
 	public ArrayList<ProgressListener> getBeforeHighlighListeners() {
+		
 		return beforeHighlighListeners;
 	}
 	
 	private ArrayList<ProgressListener> afterHighlighListeners;
 	
 	public ArrayList<ProgressListener> getAfterHighlighListeners() {
+		
 		return beforeHighlighListeners;
 	}
 	
 	public Object evaluate(String code) {
+		
 		if (Log.getLevel().intValue() <= Level.FINEST.intValue()) System.out.println(code);
 		try {
 			if (getBrowser() == null) return null;
 			return getBrowser().evaluate(code);
-		} catch(Exception e) {
+		}
+		catch (Exception e) {
 			String error = e.getMessage();
-			Log.severe("Browser evaluate error: "+e);
+			Log.severe("Browser evaluate error: " + e);
 			Log.printStackTrace(e);
 		}
 		return null;
 	}
 	
 	public boolean execute(String code) {
+		
 		if (Log.getLevel().intValue() <= Level.FINEST.intValue()) System.out.println(code);
 		try {
 			return getBrowser().execute(code);
-		} catch(Exception e) {
+		}
+		catch (Exception e) {
 			String error = e.getMessage();
-			Log.severe("Browser execute error: "+e);
+			Log.severe("Browser execute error: " + e);
 			Log.printStackTrace(e);
 		}
 		return false;
 	}
 	
 	public EditionPanel(SynopticEditionEditor synopticEditionEditor, Composite parent, int style, String editionName) {
+		
 		super(parent, style);
 		this.synopticEditionEditor = synopticEditionEditor;
 		this.editionName = editionName;
-		//		this.currentEdition = edition;
-		//		this.currentText = currentEdition.getText();
+		// this.currentEdition = edition;
+		// this.currentText = currentEdition.getText();
 		
 		File functionsFile = null;
 		try {
@@ -323,16 +333,16 @@
 			
 			@Override
 			public synchronized void completed(ProgressEvent event) {
-				Object o = getBrowser().evaluate("return typeof "+CommandLink.FCT+";");
+				
+				Object o = getBrowser().evaluate("return typeof " + CommandLink.FCT + ";");
 				if ("undefined".equals(o)) {
 					new CommandLink(synopticEditionEditor, getBrowser());
 				}
-				o = getBrowser().evaluate("return typeof "+EditionLink.FCT+";");
+				o = getBrowser().evaluate("return typeof " + EditionLink.FCT + ";");
 				if ("undefined".equals(o)) {
 					new EditionLink(synopticEditionEditor, getBrowser());
 				}
 				
-				
 				Object rez = evaluate("return typeof sheet;"); //$NON-NLS-1$
 				if ("undefined".equals(rez)) { //$NON-NLS-1$
 					Object loadResult = evaluate(functions);
@@ -421,10 +431,10 @@
 							// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
 							s = "try { document.getElementById(\"" + wordid + "\").style.backgroundColor=\"rgba(" + composite.r + "," + composite.g + "," + composite.b + "," + composite.a + ")\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 									+
-									// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
-									// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
-									// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
-									// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
+							// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
+							// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
+							// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
+							// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
 									"} catch (e) { };"; //$NON-NLS-1$
 						}
 						else {
@@ -505,10 +515,10 @@
 						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
 						s = "try { document.getElementById(\"" + wordid + "\").style.fontWeight=\"" + fontWeightPerWordIDS.get(wordid) + "\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 								+
-								// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
-								// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
-								// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
-								// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
+						// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
+						// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
+						// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
+						// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
 								"} catch (e) { };"; //$NON-NLS-1$
 						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
 						// s = "try { var elt = document.getElementById(\"" + wordid + "\");" + //$NON-NLS-1$ //$NON-NLS-2$
@@ -590,12 +600,14 @@
 			
 			@Override
 			public void mouseDoubleClick(MouseEvent e) {
+				
 				if (debug) Log.finest("DOUBLE CLICK"); //$NON-NLS-1$
 				dblClick = true;
 			}
 			
 			@Override
 			public void mouseDown(MouseEvent e) {
+				
 				if (debug) Log.finest("MOUSE DOWN"); //$NON-NLS-1$
 				dblClick = false;
 				t = e.time;
@@ -605,6 +617,7 @@
 			
 			@Override
 			public void mouseUp(MouseEvent e) {
+				
 				if (dblClick) { // doucle click raised by mouseDoubleClick
 					dblClick = false;
 					return; // stop right now ! :-o
@@ -639,11 +652,13 @@
 			
 			@Override
 			public void keyReleased(KeyEvent e) {
+				
 				if (debug) Log.finest(" KEY RELEASED: " + e); //$NON-NLS-1$
 			}
 			
 			@Override
 			public void keyPressed(KeyEvent e) {
+				
 				if (debug) Log.finest(" KEY PRESSED: " + e); //$NON-NLS-1$
 				if (e.keyCode == 'f' && (e.stateMask & SWT.CTRL) != 0) {
 					synopticEditionEditor.getSearchEditionToolbar().openSearch(getTextSelection());
@@ -661,6 +676,7 @@
 	 */
 	@Override
 	public Browser getBrowser() {
+		
 		return super.getBrowser();
 	}
 	
@@ -668,14 +684,17 @@
 	 * Bypass BrowserViewer restriction on the getBrowser method
 	 */
 	public String getDOM() {
+		
 		return "";// execute("return document.innerHTML"; //$NON-NLS-1$
 	}
 	
 	public ISelectionProvider getSelectionProvider() {
+		
 		return selProvider;
 	}
 	
 	public void setHighlightWordsById(RGBA color, HashSet<String> wordids) {
+		
 		for (String wordid : wordids) {
 			if (this.highlightedColorPerWordIDS.get(wordid) != null) {
 				removeHighlightWordsById(color, wordid);
@@ -687,6 +706,7 @@
 	}
 	
 	public void addHighlightWordsById(RGBA color, String wordid) {
+		
 		if (!this.highlightedColorPerWordIDS.containsKey(wordid)) {
 			this.highlightedColorPerWordIDS.put(wordid, new ArrayList<RGBA>());
 		}
@@ -697,16 +717,19 @@
 	 * Can be called to refresh the page word styles but only when the page is loaded
 	 */
 	public void updateWordStyles() {
+		
 		progressListener.completed(null);
 	}
 	
 	public void addHighlightWordsById(RGBA color, Collection<String> wordids) {
+		
 		for (String wordid : wordids) {
 			addHighlightWordsById(color, wordid);
 		}
 	}
 	
 	public void removeHighlightWordsById(RGBA color, Collection<String> wordids) {
+		
 		// System.out.println("Call removeHighlightWordsById: "+wordids+" color="+color);
 		StringBuffer buffer = new StringBuffer();
 		for (String wordid : wordids) {
@@ -720,6 +743,7 @@
 	}
 	
 	public void removeHighlightWordsById(RGBA color, String wordid) {
+		
 		if (highlightedColorPerWordIDS.get(wordid) == null) return; // nothing to do
 		
 		// System.out.println("remove color="+color+" from id="+wordid);
@@ -738,7 +762,7 @@
 	 */
 	public boolean backToText(Text text, String line_wordid) {
 		
-		//String name = currentEdition.getName();
+		// String name = currentEdition.getName();
 		Edition edition = text.getEdition(editionName);
 		
 		if (edition == null) {
@@ -768,6 +792,9 @@
 	 * First page.
 	 */
 	public void firstPage() {
+		
+		if (currentEdition == null) return;
+		
 		// System.out.println(Messages.TxmBrowser_1+currentPage);
 		currentPage = currentEdition.getFirstPage();
 		currentText = currentEdition.getText();
@@ -783,11 +810,9 @@
 	
 	@Override
 	public void setURL(String url) {
+		
 		if (!this.browser.isDisposed()) {
-			int begin = url.indexOf(":/");
-			String start = url.substring(0, begin);
-			String end = URLEncoder.encode(url.substring(begin+2));
-			super.setURL(start+":/"+end);
+			super.setURL(URLUtils.encodeURL(url));
 		}
 	}
 	
@@ -796,6 +821,7 @@
 	 */
 	public void lastPage() {
 		// System.out.println(Messages.TxmBrowser_2+currentPage);
+		if (currentEdition == null) return;
 		
 		if (currentPage != null && currentPage.getFile().equals(currentEdition.getLastPage().getFile())) {
 			return;
@@ -809,6 +835,9 @@
 	 * Previous page.
 	 */
 	public void previousPage() {
+		
+		if (currentEdition == null) return;
+		
 		// System.out.println(Messages.TxmBrowser_3+currentPage);
 		if (currentPage != null) {
 			Page previous = currentEdition.getPreviousPage(currentPage);
@@ -834,6 +863,9 @@
 	 * Next page.
 	 */
 	public void nextPage() {
+		
+		if (currentEdition == null) return;
+		
 		// System.out.println(Messages.TxmBrowser_4+currentPage);
 		if (currentPage != null) {
 			Page next = currentEdition.getNextPage(currentPage);
@@ -854,6 +886,7 @@
 	
 	
 	public void firstText() {
+		
 		// Text current = this.currentPage.getEdition().getText();
 		Project project = currentText.getProject();
 		String id;
@@ -888,6 +921,7 @@
 	 * Next text.
 	 */
 	public void lastText() {
+		
 		// Text current = this.currentPage.getEdition().getText();
 		Project project = currentText.getProject();
 		String id;
@@ -981,6 +1015,7 @@
 	 * Next text.
 	 */
 	public void nextText() {
+		
 		// Text current = this.currentPage.getEdition().getText();
 		Project project = currentText.getProject();
 		String id;
@@ -1027,7 +1062,8 @@
 	
 	
 	public void setText(Text text, boolean refresh) {
-		//String editionName = currentEdition.getName();
+		
+		// String editionName = currentEdition.getName();
 		Edition tmp = text.getEdition(this.editionName);
 		if (tmp == null) {
 			System.out.println(EditionUIMessages.bind(EditionUIMessages.noEditionWithNameEqualsP0AvailableForTextEqualsP1, this.editionName, text.getName()));
@@ -1055,6 +1091,7 @@
 	 * @return the current page
 	 */
 	public Page getCurrentPage() {
+		
 		return currentPage;
 	}
 	
@@ -1064,6 +1101,7 @@
 	 * @return the current page
 	 */
 	public Text getCurrentText() {
+		
 		return currentText;
 	}
 	
@@ -1073,6 +1111,7 @@
 	 * @return the string
 	 */
 	public String makePageLabel() {
+		
 		return currentPage.getName() + " / " + currentPage.getEdition().getNumPages(); //$NON-NLS-1$
 	}
 	
@@ -1082,6 +1121,8 @@
 	 * @param page the page
 	 */
 	public void showPage(Page page) {
+		
+		if (currentEdition == null) return;
 		// System.out.println("SHOW PAGE "+page);
 		currentEdition = page.getEdition();
 		currentText = currentEdition.getText();
@@ -1093,6 +1134,7 @@
 	 * Reload the browser with the currentPage URL
 	 */
 	public void reloadPage() {
+		
 		this.setURL(currentPage.toURL());
 	}
 	
@@ -1123,6 +1165,7 @@
 			"return html"; //$NON-NLS-1$
 	
 	public String getTextSelectionDOM() {
+		
 		String t = ((String) evaluate(SCRIPT01));
 		Log.finest("HTML text selection=" + t);
 		return t;
@@ -1168,7 +1211,7 @@
 				+ "\n}" //$NON-NLS-1$
 				// +"alert('result='+all)"
 				+ "\nreturn all;"; //$NON-NLS-1$
-		
+				
 		// System.out.println(functions);
 		// System.out.println(SCRIPT02_getspans);
 		
@@ -1197,6 +1240,7 @@
 	}
 	
 	public String getTextSelection() {
+		
 		// System.out.println("DOM="+getTextSelectionDOM());
 		String dom = getTextSelectionDOM();
 		if (dom == null) return "";
@@ -1211,6 +1255,7 @@
 	
 	@Override
 	public ISelection getSelection() {
+		
 		return new SynopticTextSelection(this);
 	}
 	
@@ -1226,28 +1271,34 @@
 		String str;
 		
 		public SynopticTextSelection(EditionPanel panel) {
+			
 			this.str = panel.getTextSelection();
 		}
 		
 		@Override
 		public boolean isEmpty() {
+			
 			return str != null && str.length() > 0;
 		}
 		
 		public String getTextSelection() {
+			
 			return str;
 		}
 	}
 	
 	public Edition getEdition() {
+		
 		return currentEdition;
 	}
 	
 	public MenuManager getMenuManager() {
+		
 		return menuManager;
 	}
 	
 	public void initMenu() {
+		
 		// create a new menu
 		menuManager = new MenuManager();
 		
@@ -1257,6 +1308,7 @@
 			
 			@Override
 			public void menuShown(MenuEvent e) {
+				
 				Menu menu = menuManager.getMenu();
 				if (menu == null) return;
 				new MenuItem(menu, SWT.SEPARATOR);
@@ -1267,6 +1319,7 @@
 					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
+						
 						String text = EditionPanel.this.getTextSelection();
 						synopticEditionEditor.getSearchEditionToolbar().openSearch(text);
 					}
@@ -1281,6 +1334,7 @@
 					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
+						
 						String text = EditionPanel.this.getTextSelection();
 						if (text != null && text.length() > 0) {
 							IOClipboard.write(text);
@@ -1299,6 +1353,7 @@
 					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
+						
 						EditionPanel.this.getBrowser().refresh();
 					}
 					
@@ -1311,6 +1366,7 @@
 					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
+						
 						EditionPanel.this.getBrowser().back();
 					}
 					
@@ -1323,6 +1379,7 @@
 					
 					@Override
 					public void widgetSelected(SelectionEvent e) {
+						
 						EditionPanel.this.getBrowser().forward();
 					}
 					
@@ -1356,6 +1413,7 @@
 	}
 	
 	public void initSelectionProvider() {
+		
 		selProvider = new ISelectionProvider() {
 			
 			@Override
@@ -1366,35 +1424,42 @@
 			
 			@Override
 			public ISelection getSelection() {
+				
 				ITextSelection sel = new ITextSelection() {
 					
 					@Override
 					public boolean isEmpty() {
+						
 						return EditionPanel.this.getTextSelection().length() == 0;
 					}
 					
 					@Override
 					public String getText() {
+						
 						return EditionPanel.this.getTextSelection();
 					}
 					
 					@Override
 					public int getStartLine() {
+						
 						return 0;
 					}
 					
 					@Override
 					public int getOffset() {
+						
 						return 0;
 					}
 					
 					@Override
 					public int getLength() {
+						
 						return 0;
 					}
 					
 					@Override
 					public int getEndLine() {
+						
 						return 0;
 					}
 				};
@@ -1409,6 +1474,7 @@
 	
 	
 	public void goToPage(String text, String name) {
+		
 		if (text != null) {
 			Text newText = this.synopticEditionEditor.getCorpus().getProject().getText(text);
 			if (newText == null) {
@@ -1431,14 +1497,17 @@
 	}
 	
 	public void setFocusedWordID(String focusid) {
+		
 		this.focusedWordID = focusid;
 	}
 	
 	public void setHighlightedArea(HashSet<int[]> positions) {
+		
 		Log.finer("Highlight area: not implemented");
 	}
 	
 	public void expandSelectionTo(String[] ids) {
+		
 		// expand selection
 		if (ids == null) return;
 		if (ids.length == 0) return;
@@ -1468,27 +1537,31 @@
 				+ "sel.addRange(range);\n" //$NON-NLS-1$
 				+ "\n" //$NON-NLS-1$
 				+ "return null;"; //$NON-NLS-1$
-		
+				
 		// System.out.println("Eval...\n"+SCRIPT02_expand);
 		evaluate(SCRIPT02_expand);
 		return;
 	}
 	
 	public void addFontWeightWordsById(String weight, List<String> wordids) {
+		
 		for (String wordid : wordids) {
 			addFontWeightWordsById(weight, wordid);
 		}
 	}
 	
 	public void addFontWeightWordsById(String weight, String wordid) {
+		
 		this.fontWeightPerWordIDS.put(wordid, weight);
 	}
 	
 	public void removeFontWeightWordsById(String wordid) {
+		
 		this.fontWeightPerWordIDS.remove(wordid);
 	}
 	
 	public void removeFontWeightWordsById(List<String> wordids) {
+		
 		for (String wordid : wordids) {
 			removeFontWeightWordsById(wordid);
 		}
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 3396)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 3397)
@@ -131,7 +131,9 @@
 	public Text getResult() {
 		
 		for (EditionPanel panel : editionPanels.values()) {
-			return panel.getCurrentText();
+			if (panel.getCurrentText() != null) {
+				return panel.getCurrentText();
+			}
 		}
 		
 		if (textIdToOpen != null) {
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/utils/URLUtils.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/utils/URLUtils.java	(revision 0)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/utils/URLUtils.java	(revision 3397)
@@ -0,0 +1,31 @@
+package org.txm.rcp.utils;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import org.apache.commons.lang.StringUtils;
+
+public class URLUtils {
+	
+	public static String encodeURL(String url) {
+		StringBuilder buffer = new StringBuilder();
+		int begin = url.indexOf(":/");
+		buffer.append(url.substring(0, begin+2));
+		url = url.substring(begin+2);
+		String[] split = url.split("/");
+		String[] ps = new String[split.length];
+		for (int i = 0 ; i < split.length ; i++) {
+			if (split[i].length() > 0) {
+				ps[i] = URLEncoder.encode(split[i]);
+			} else {
+				ps[i] = split[i];
+			}
+		}
+		buffer.append(StringUtils.join(ps, "/"));
+		return buffer.toString();
+	}
+	
+	public static URL encodeURL(URL url) throws MalformedURLException {
+		return new URL(encodeURL(url.toString()));
+	}
+}

Property changes on: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/utils/URLUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java	(revision 3396)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java	(revision 3397)
@@ -131,6 +131,7 @@
 		if (this.section != null && !section.isDisposed()) {
 			CorpusCommandPreferences concPrefs = project.getCommandPreferences("concordance");
 			concPrefs.set("context_limits_type", "list");
+			concPrefs.set("context_limits", structLimitsText.getText());
 			
 			concPrefs.set("view_reference_pattern", 
 					ReferencePattern.referenceToString(
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 3396)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 3397)
@@ -527,7 +527,6 @@
 			}
 			
 			this.setDirty(this.dirty);
-			
 		}
 		catch (Throwable e) {
 			Log.severe(TXMCoreMessages.bind("TXMEditor.createPartControl(): can not create the editor for result {0}.", this.getResult())); //$NON-NLS-1$
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 3396)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 3397)
@@ -91,6 +91,7 @@
 		// -configuration is set
 		try {
 			Log.info("Looking for TXM updates...");
+			
 			ProvisioningUI pui = ProvisioningUI.getDefaultUI();
 			
 			String profileId = pui.getProfileId();
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenBrowser.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenBrowser.java	(revision 3396)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenBrowser.java	(revision 3397)
@@ -29,7 +29,6 @@
 
 import java.io.File;
 import java.net.URL;
-import java.net.URLEncoder;
 
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -49,6 +48,7 @@
 import org.txm.rcp.editors.TXMBrowserEditor;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.URLUtils;
 import org.txm.utils.logger.Log;
 
 // TODO: Auto-generated Javadoc
@@ -185,15 +185,14 @@
 				url = localfile.toURI().toURL();
 			} else {
 				url = new URL(filepath);
+				
+				url = URLUtils.encodeURL(url);
 			}
 			
-			String s = url.toString();
-			int begin = s.indexOf(":/");
-			String start = s.substring(0, begin);
-			String end = URLEncoder.encode(s.substring(begin+2));
 			
-			WebBrowserEditorInput editorInput = new WebBrowserEditorInput(new URL(start+":/"+end), BrowserViewer.BUTTON_BAR | BrowserViewer.LOCATION_BAR);
 			
+			WebBrowserEditorInput editorInput = new WebBrowserEditorInput(url, BrowserViewer.BUTTON_BAR | BrowserViewer.LOCATION_BAR);
+			
 			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
 			IWorkbenchPage page = window.getActivePage();
 			
Index: TXM/trunk/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 3396)
+++ TXM/trunk/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 3397)
@@ -262,21 +262,21 @@
 			}
 		}
 		
-		if (updateEdition) {
+		if (!updateCorpus || updateEdition) {
 			Tpager.start();
 		}
 		
 		if (multithread) Tcompiler.join(); // wait for both threads to end
 		
-		if (updateEdition) {
+		if (!updateCorpus || updateEdition) {
 			Tpager.join();
+		} else {
+			Log.info("Warning: editions not updated.");
 		}
 		
 		if (isSuccessful) { // all done TODO remove this code when Text._compute() will be implemented
-			if (updateEdition) {
-				for (Text t : project.getTexts()) {
-					t.compute(false);
-				}
+			for (Text t : project.getTexts()) {
+				t.compute(false);
 			}
 			
 			project.setDoUpdate(false, false);
