Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/importer.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/importer.groovy	(revision 2056)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/importer.groovy	(revision 2057)
@@ -34,6 +34,7 @@
 import org.txm.scripts.*;
 import org.txm.importer.cwb.CwbEncode
 import org.txm.importer.cwb.CwbMakeAll
+import org.txm.utils.ConsoleProgressBar
 import org.txm.utils.io.FileCopy;
 import org.txm.importer.scripts.xmltxm.*;
 
@@ -102,8 +103,9 @@
 		println (srcfiles.size()+ " texts found in "+srcfile)
 
 		println("Tokenizing files ("+srcfiles.size()+")")
+		ConsoleProgressBar cpb = new ConsoleProgressBar(srcfiles.size())
 		for (File f : srcfiles) {
-			print "."
+			cpb.tick()
 			File resultfile = new File(tokenizeDir, f.getName());
 			try {
 				def builder = new SimpleTokenizerXml(f, resultfile, lang);
@@ -115,12 +117,13 @@
 			}
 			catch(Exception e){org.txm.utils.logger.Log.printStackTrace(e); println "Failed to tokenize: "+f; return false;}
 		}
-		println ""
+		cpb.done()
 		
 		List<File> stokenfiles = tokenizeDir.listFiles();	
 		println("Tagging sentences of "+stokenfiles.size()+" files")
+		cpb = new ConsoleProgressBar(stokenfiles.size())
 		for (File f : stokenfiles) {
-			print "."
+			cpb.tick()
 			Sequence S = new Sequence();
 			Filter F1 = new CutHeader();
 			Filter F7 = new TagSentences();
@@ -144,13 +147,14 @@
 			S.clean();
 			headerfile.delete();//remove the prepared file to clean
 		}
-		println ""
+		cpb.done()
 
 		//TRANSFORM INTO XML-TEI-TXM
 		List<File> tokenfiles = stokenizeDir.listFiles()
 		println("Building xml-tei-txm ("+tokenfiles.size()+" files)")
+		cpb = new ConsoleProgressBar(tokenfiles.size())
 		for (File f : tokenfiles) {
-			print "."
+			cpb.tick()
 			File file = f;
 			File txmfile = new File(txmDir, f.getName());
 
@@ -179,7 +183,7 @@
 				txmfile.delete();
 			}
 		}
-		println ""
+		cpb.done()
 		return true;
 	}
 }
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/RebuildTRSEditionMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/RebuildTRSEditionMacro.groovy	(revision 0)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/RebuildTRSEditionMacro.groovy	(revision 2057)
@@ -0,0 +1,185 @@
+//package org.txm.macro.xsl;
+// STANDARD DECLARATIONS
+
+//import org.kohsuke.args4j.*
+//import groovy.transform.Field
+//import org.txm.rcpapplication.swt.widget.parameters.*
+//import org.txm.importer.ApplyXsl2;
+
+package org.txm.macro.edition
+// STANDARD DECLARATIONS
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.objects.*
+import org.txm.searchengine.cqp.corpus.*;
+import org.w3c.dom.*
+import org.txm.importer.*
+import org.txm.Toolbox
+import java.io.*
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.txm.rcpapplication.commands.*
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.txm.utils.io.FileCopy
+
+try { println "ARGS=$args";} catch(Exception e) {args = [:]}
+
+def corpus = null
+if (args.size() == 0) {
+	if (!(corpusViewSelection instanceof MainCorpus)) {
+		println "This marcro works with a MainCorpus selection. Aborting"
+		return;
+	}
+	println "Working on $corpusViewSelection corpus"
+	corpus = corpusViewSelection
+} else {
+	monitor = args["monitor"];
+}
+
+// Les paramètres dont on a besoin :
+// Nom du Corpus dans TXM on le récupère de l amême façon que EditionUpdaterMacro...
+// Nom du répertoire dans lequel sont les trs utilisables avec transcriber (i.e. ceux à partir desquels on trouve les fichiers sons).
+// Nom de l'édition à modifier.
+
+
+println "Corpora selection: "+corpusViewSelection
+println "corpusName ="+corpus.getName()
+def corpusName=corpusViewSelection.getName()
+
+//Je voudrais mettre en dur la feuille xsl ? (ou pas....)
+// BEGINNING OF PARAMETERS
+//@Field @Option(name="corpusTXM",usage="nom du corpus dans TXM", widget="String", required=true, def="")
+def corpusTXM=corpusViewSelection
+
+@Field @Option(name="placeInitCorpus", usage="directory où se trouve/trouvait initialement le corpus : trs et fichiers Sons", widget="Folder", required=true, def="")
+def placeInitCorpus
+
+@Field @Option(name="editionName",usage="The edition name to produce", widget="String", required=false, def="default")
+String editionName
+
+// BEGINNING OF PARAMETERS
+//@Field @Option(name="XSLFile",usage="an example file", widget="File", required=true, def="file.xsl")
+//def XSLFile = new File(System.getProperty("user.home"),"TXM/xsl/identity.xsl")
+//def XSLFile
+
+//@Field @Option(name="intputDirectory",usage="an example folder", widget="Folder", required=true, def="in")
+//def intputDirectory = new File(System.getProperty("user.home"),"xml/TESTS2/xml")
+//def intputDirectory
+
+//@Field @Option(name="outputDirectory",usage="an example folder", widget="Folder", required=true, def="out")
+////def outputDirectory = new File("/tmp/xsltest")
+//def outputDirectory
+
+//@Field @Option(name="parameters",usage="an example folder", widget="Text", required=false, def="")
+//def parameters = ""
+
+//@Field @Option(name="debug",usage="Show debug messages, value = true|false", widget="String", required=true, def="false")
+//def debug
+
+if (!ParametersDialog.open(this)) return;
+// END OF PARAMETERS
+
+binDirectory = corpus.getProjectDirectory()
+File HTMLDirectory = new File(binDirectory, "HTML")
+File HTMLCorpusDirectory = new File(HTMLDirectory, corpusName)
+println HTMLCorpusDirectory
+File defaultEditionDirectory = new File(HTMLCorpusDirectory, editionName)
+println defaultEditionDirectory
+
+//On cherche récursivement les trs dans placeInitCorpus
+
+println "place init corpus : "+placeInitCorpus.getAbsolutePath()
+
+placeInitCorpus.eachFileRecurse{ AFile ->
+	String name = AFile.getName()
+    if (name.matches(/.+\.trs/)){
+		println name
+		println "Path absolu :"+AFile.getAbsolutePath()
+		//on le parse pour trouver le audio file name
+		parser=new XmlSlurper();
+		parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
+		parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+		list=parser.parse(AFile)
+		def transNode=list
+		def fichierSon=transNode.@audio_filename
+		println "   fichierSon : ->"+fichierSon
+		
+		File parentFolder = new File(AFile.getParent());
+		File soundF = new File(parentFolder, ""+fichierSon);
+		String fichierSonAbsolu = soundF.getCanonicalPath(); // may throw IOException
+		//String fichierSonAbsolu="toto"
+		println "Son absolu :"+fichierSonAbsolu
+		
+		//maintenant, on veut trouver le fichier son pour de vrai !
+		//C'est là qu'il faut voir si on trouve : 
+		// fichierSonAbsolu, ou fichierSonAbsolu+.mp3 ou fichierSonAbsolu+.MP3 ou
+		// fichierSonAbsolu+.wav ou fichierSonAbsolu+.WAV
+		//Deux types de problèmes possibles : n'en trouver aucun
+		//                                    en trouver plusieurs !
+		File sonFichier=new File(fichierSonAbsolu)
+		if (sonFichier.exists()){
+			println "   OK, fichierSon trouvé";
+			found = true;
+		}
+		else{
+			String[] exts = [".wav", ".WAV", ".mp3", ".MP3"];
+			found = false;
+			fini = false;
+			index=0;
+			while (!found && !fini){
+				fichierSonAbsoluTest=fichierSonAbsolu+exts[index];
+				println("   On teste "+fichierSonAbsoluTest);
+				sonFichier=new File(fichierSonAbsoluTest);
+				found=sonFichier.exists();
+				if (found){
+					fichierSonAbsolu = fichierSonAbsoluTest;
+				}
+				else{
+					index = index +1;
+					fini = (index >= exts.length);
+				}
+			}
+		}
+		if (!found){
+			println(" Pas de fichier son trouvé pour : "+name);
+		}	
+		else{
+		
+				baseN = name[0..-4]
+				htmlRegex = ".*${baseN}.*\\.html"
+				println "HtmlRegex = "+htmlRegex
+		
+				String xslPath = Toolbox.getTxmHomePath()+"/scripts/groovy/user/org/txm/macro/edition/"+"refaireEditionTRS.xsl"
+				ApplyXsl2 a = new ApplyXsl2(xslPath)
+				outputDirectory = defaultEditionDirectory
+				defaultEditionDirectory.eachFileRecurse{ HtmlFile ->
+				//println "   ?"+HtmlFile
+				if (HtmlFile ==~ /${htmlRegex}/){
+					println "   OK "+HtmlFile
+					a.SetParam("soundFile", fichierSonAbsolu)
+					def outFile = new File(outputDirectory, HtmlFile.getName()+".bis")
+					a.process(HtmlFile, outFile);
+					// On renome les fichiers :
+					println "nouveau nom : "+defaultEditionDirectory.getCanonicalPath()+"/"+HtmlFile.getName()+".orig"
+					oldName=HtmlFile.getCanonicalPath()
+					//HtmlFile.renameTo (defaultEditionDirectory.getCanonicalPath()+"/"+HtmlFile.getName()+".orig")
+					HtmlFile.renameTo (defaultEditionDirectory.getCanonicalPath()+File.separator+HtmlFile.getName()+".orig")
+					// Il semble que windows n'aime pas le renomage....
+					//outFile.renameTo oldName
+					//donc on teste une copie...
+					HtmlFile << outFile.text
+				
+					a.resetParams()
+				
+				}
+			
+			}
+		}
+	}
+}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/refaireEditionTRS.xsl
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/refaireEditionTRS.xsl	(revision 0)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/refaireEditionTRS.xsl	(revision 2057)
@@ -0,0 +1,204 @@
+<?xml version="1.0"?>
+
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:atilf="http://www.atilf.fr" version="2.0">
+
+  <xsl:output method="xml"/>
+  
+  <xsl:param name="soundFile"/>
+
+
+  
+  
+  <xsl:function name="atilf:traduireTemps">
+    <xsl:param name="t"/>
+
+    <xsl:choose>
+      <xsl:when test="count($t) != 0">
+	<xsl:analyze-string select="$t" regex="([0-9]+):([0-9]+):([0-9]+)">
+	  <xsl:matching-substring>
+	    <xsl:value-of select="number(regex-group(1))*3600+number(regex-group(2))*60+number(regex-group(3))"/>
+	  </xsl:matching-substring>
+	  <xsl:non-matching-substring><xsl:text>0</xsl:text></xsl:non-matching-substring>
+	</xsl:analyze-string>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>0</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:function>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+
+  <xsl:template match="html">
+    <xsl:copy>
+      <xsl:apply-templates select="meta"/>
+      <xsl:apply-templates select="head"/>
+      <xsl:apply-templates select="link"/>
+      <xsl:apply-templates select="*[not(self::meta) and not(self::head) and
+				   not(self::link) and not(self::body) and not(self::tei:body)]"/>
+      <xsl:apply-templates select="tei:body"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:apply-templates select="@* | node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@* | text() | comment() | processing-instruction()">
+    <xsl:copy/>
+  </xsl:template>
+
+ 
+
+  <xsl:template match="tei:body">
+    <xsl:copy>
+	<script>
+	  <!-- Element.prototype.documentOffsetTop = function () {
+	  return this.offsetTop + ( this.offsetParent ? this.offsetParent.documentOffsetTop() : 0 );
+	  };
+	  
+	 
+	  function myFunc2(event) {
+	  document.getElementById('tracktime').innerHTML = Math.floor(event.currentTime) + ' / ' + Math.floor(event.duration);
+	  };
+	     function myFunc3(event) {
+	     var x = document.getElementsByTagName("span");
+	     for (index = 0; index &lt; x.length; index++){
+	     if ((x[index].getAttribute("begin") &lt; event.currentTime)
+	        &amp;&amp;
+	        (x[index].getAttribute("end") &gt; event.currentTime)){
+	    
+		x[index].className = "spk_hi";
+		/*x[index].scrollIntoView( true );*/
+		/*var top = x[index].documentOffsetTop() - ( window.innerHeight / 2 );
+	
+		window.scrollTo(0, top );*/
+		
+		var topPos = x[index].offsetTop;
+		document.getElementById('scrollDiv').scrollTop = topPos-110;
+		}
+		else{
+		x[index].className="spk";
+		}
+	     };
+	    };-->
+	    
+	       function moveInSound(t){
+	       var player = document.getElementById("audioPlay");
+	       
+	       if (player.paused){
+	          player.currentTime = t;
+	          player.play();
+		  }
+		  else{
+		  player.pause();
+		  }
+	       };
+
+	        function stopSound(t){
+	       var player = document.getElementById("audioPlay");
+
+	       player.pause();
+	     };
+	</script>
+	 <audio id="audioPlay" controls="controls" style="height:100px; display:none">
+	    <source src="{$soundFile}"/>
+	  </audio>
+	<xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+
+  <!-- En fait, on veut mettre un bouton play, stop -->
+  <xsl:template match="span[@class='spk']">
+
+    <!-- <button type="button" style='background: url("play.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+    </button> -->
+      
+ 
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates select="node()"/>
+
+    </xsl:copy>
+    
+    <!-- <button type="button"  style='background: url("pause.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>stopSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+</button> -->
+ 
+  </xsl:template>
+
+  <xsl:template match="span[@class='sync']">
+
+    <!-- <button type="button" style='background: url("play.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+    </button> -->
+      
+ 
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(./text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates select="node()"/>
+
+    </xsl:copy>
+    
+    <!-- <button type="button"  style='background: url("pause.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>stopSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+</button> -->
+ 
+  </xsl:template>
+
+  <xsl:template match="span[@class='word']">
+
+    <!-- <button type="button" style='background: url("play.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+    </button> -->
+      
+ 
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:attribute name="onclick">
+	<xsl:text>moveInSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(preceding::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:apply-templates select="node()"/>
+
+    </xsl:copy>
+    
+    <!-- <button type="button"  style='background: url("pause.png") no-repeat; width:25px;height:25px;background-size:100%;'>
+       <xsl:attribute name="onclick">
+	<xsl:text>stopSound(</xsl:text><xsl:value-of select="atilf:traduireTemps(following::span[@class='sync'][1]/text())"/><xsl:text>)</xsl:text>
+      </xsl:attribute>
+      <xsl:text> </xsl:text>
+</button> -->
+ 
+  </xsl:template>
+
+  
+</xsl:stylesheet>
\ No newline at end of file

Property changes on: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/refaireEditionTRS.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 2056)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 2057)
@@ -1010,12 +1010,16 @@
 				return null;
 			}
 
-			//TODO until the TXMResult don't know if its parameters are set by the user or by the default preference value, we need to use the AUTO_COMPUTE_ON_EDITOR_OPEN preference
-			// compute the result only if the editor wasn't already opened
-			if (!wasAlreadyOpened && (RCPPreferences.getInstance().getBoolean(RCPPreferences.AUTO_COMPUTE_ON_EDITOR_OPEN)))	{
-				editor.compute(false);
+			if (wasAlreadyOpened) {
+				
 			} else {
-				editor.refresh(false);
+				//TODO until the TXMResult don't know if its parameters are set by the user or by the default preference value, we need to use the AUTO_COMPUTE_ON_EDITOR_OPEN preference
+				// compute the result only if the editor wasn't already opened
+				if ((RCPPreferences.getInstance().getBoolean(RCPPreferences.AUTO_COMPUTE_ON_EDITOR_OPEN)))	{
+					editor.compute(false);
+				} else {
+					editor.refresh(false);
+				}
 			}
 		}
 		catch (Exception e) {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 2056)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 2057)
@@ -297,6 +297,8 @@
 				if (sel.length == 0)
 					return;
 
+				CorporaView.this.setFocus(); // force focus on the corpora view -> ensure the active selection is the corpora view selection
+				
 				ISelection tsel = treeViewer.getSelection();
 				if (!(tsel instanceof TreeSelection)) return;
 
