Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java	(revision 2983)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java	(revision 2984)
@@ -19,66 +19,75 @@
 import org.txm.objects.Project;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.treetagger.core.preferences.TreeTaggerPreferences;
+import org.txm.utils.FileUtils;
 import org.txm.utils.io.IOUtils;
 
 public class LangSection extends ImportEditorSection {
-
+	
 	private static final int SECTION_SIZE = 1;
-
+	
 	Button btnDefaultLang;
+	
 	Button btnGuessLang;
+	
 	Button btnSelectAnnotate;
+	
 	Button btnSelectLang;
+	
 	Combo langcombo;
-
+	
 	public LangSection(FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style) {
 		super(toolkit2, form2, parent, style);
-
+		
 		this.section.setText(TXMUIMessages.mainLanguage);
 		TableWrapLayout layout = new TableWrapLayout();
 		layout.makeColumnsEqualWidth = true;
 		this.section.setLayout(layout);
 		this.section.setLayoutData(getSectionGridData(SECTION_SIZE));
 		this.section.setEnabled(false);
-
+		
 		this.section.addExpansionListener(new ExpansionAdapter() {
+			
 			@Override
-			public void expansionStateChanged(ExpansionEvent e) {form.layout(true);}
+			public void expansionStateChanged(ExpansionEvent e) {
+				form.layout(true);
+			}
 		});
-
-		//filesection.setDescription("Select how to find source files");
+		
+		// filesection.setDescription("Select how to find source files");
 		final Composite sectionClient = toolkit.createComposite(this.section);
 		TableWrapLayout slayout = new TableWrapLayout();
 		slayout.numColumns = 2;
 		slayout.makeColumnsEqualWidth = false;
 		sectionClient.setLayout(slayout);
 		this.section.setClient(sectionClient);
-
-		btnSelectAnnotate = toolkit.createButton(sectionClient, TXMUIMessages.annotateTheCorpus, SWT.CHECK); 
+		
+		btnSelectAnnotate = toolkit.createButton(sectionClient, TXMUIMessages.annotateTheCorpus, SWT.CHECK);
 		toolkit.createLabel(sectionClient, ""); //$NON-NLS-1$
-
+		
 		btnGuessLang = toolkit.createButton(sectionClient, TXMUIMessages.guessColon, SWT.RADIO);
 		toolkit.createLabel(sectionClient, ""); //$NON-NLS-1$
-
+		
 		btnSelectLang = toolkit.createButton(sectionClient, TXMUIMessages.selectColon, SWT.RADIO);
-
+		
 		langcombo = new Combo(sectionClient, SWT.BORDER);
 		TableWrapData gdata = getTextGridData();
 		langcombo.setLayoutData(gdata);
 		langcombo.setToolTipText("Sources lang (show only the TreeTagger common language)");
-		//if widget selected change the radio buttons value
+		// if widget selected change the radio buttons value
 		langcombo.addSelectionListener(new SelectionListener() {
+			
 			@Override
-			public void widgetDefaultSelected(SelectionEvent e) { }
-
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				btnSelectLang.setSelection(true);
 				btnGuessLang.setSelection(false);
-				//btnDefaultLang.setSelection(false);
+				// btnDefaultLang.setSelection(false);
 			}
 		});
-
+		
 		String locale = Locale.getDefault().getLanguage().toLowerCase();
 		int langToSelectIndex = -1;
 		int added = 0;
@@ -87,8 +96,7 @@
 		if (files != null && files.length > 0) {
 			for (File model : files) {
 				if (!model.getName().endsWith(".par")) continue;
-				String lang = model.getName();
-				lang = lang.substring(0, lang.lastIndexOf(".par"));
+				String lang = FileUtils.stripExtension(model);
 				langcombo.add(lang);
 				if (locale.equals(lang)) {
 					langToSelectIndex = added;
@@ -97,7 +105,7 @@
 			}
 		}
 		if (added == 0) {
-			String[] langs = {"bg","cat","zh","cop","cs","dk","nl","en","ee","fi ","fr","gl","gr","de","ne","it","kr","lat","mn","pl","pt","ro","ru","sk","sl","es","tz"};
+			String[] langs = { "bg", "cat", "zh", "cop", "cs", "dk", "nl", "en", "ee", "fi ", "fr", "gl", "gr", "de", "ne", "it", "kr", "lat", "mn", "pl", "pt", "ro", "ru", "sk", "sl", "es", "tz" };
 			Arrays.sort(langs);
 			langToSelectIndex = Arrays.binarySearch(langs, locale);
 			langcombo.setItems(langs);
@@ -107,70 +115,73 @@
 			langcombo.select(langToSelectIndex);
 		}
 	}
-
+	
 	@Override
 	public void update(Project project) {
 		if (this.section.isDisposed()) return;
 		if (project == null) return;
-
+		
 		String lang = project.getLang();
 		boolean annotate = project.getAnnotate();
-
-		//fill combo and select default language
+		
+		// fill combo and select default language
 		String defaultLang = Locale.getDefault().getLanguage().toLowerCase();
 		if ("??".equals(lang)) { //$NON-NLS-1$
 			btnSelectLang.setSelection(false);
 			btnGuessLang.setSelection(true);
-		} else if (lang == null) {
+		}
+		else if (lang == null) {
 			btnSelectLang.setSelection(true);
 			btnGuessLang.setSelection(false);
-		} else {
+		}
+		else {
 			btnSelectLang.setSelection(true);
 			btnGuessLang.setSelection(false);
 			defaultLang = lang;
 		}
-
+		
 		String[] data = langcombo.getItems();
-		for (int i = 0 ; i < langcombo.getItemCount() ; i++) {
+		for (int i = 0; i < langcombo.getItemCount(); i++) {
 			String l = data[i];
 			if (l.equals(defaultLang)) {
 				langcombo.select(i);
 				break;
 			}
 		}
-
+		
 		langcombo.setText(defaultLang);
 		btnSelectAnnotate.setSelection(annotate);
 	}
-
+	
 	@Override
 	public boolean save(Project project) {
 		if (!this.section.isDisposed()) {
-			//LANGUAGE
+			// LANGUAGE
 			String lang = null, annotate = null;
-
+			
 			if (btnGuessLang != null && btnGuessLang.getSelection()) {
 				lang = "??"; //$NON-NLS-1$
-			} else if (langcombo != null)
+			}
+			else if (langcombo != null)
 				lang = langcombo.getText();
-
+			
 			if (lang == null || lang.length() == 0)
 				lang = Locale.getDefault().getLanguage();
-
-			project.setAnnotate(btnSelectAnnotate.getSelection()); //$NON-NLS-1$
-			project.setLang(lang); //$NON-NLS-1$
+			
+			project.setAnnotate(btnSelectAnnotate.getSelection());
+			project.setLang(lang);
 			return true;
 		}
 		return true;
 	}
-
+	
 	@Override
 	public boolean checkFields() {
 		return true;
 	}
-
+	
 	@Override
 	public int getSectionSize() {
 		return SECTION_SIZE;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy
===================================================================
--- tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 2983)
+++ tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 2984)
@@ -7,6 +7,7 @@
 import org.txm.metadatas.Metadatas
 import org.txm.scripts.importer.xtz.*
 import org.txm.utils.BundleUtils
+import org.txm.utils.FileUtils
 import org.txm.utils.io.FileCopy
 import org.txm.utils.io.IOUtils
 
@@ -128,8 +129,7 @@
 
 		module.orderedFiles = new ArrayList<String>();
 		for (def f : xmlFiles) {
-			String id = f.getName()
-			id = id.substring(0, id.lastIndexOf(".xml"))
+			String id = FileUtils.stripExtension(f)
 			module.orderedFiles.add(id)
 		}
 		isSuccessFul = outputDirectory.listFiles(IOUtils.HIDDENFILE_FILTER).size() > 0
Index: tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/TEI2ProjectMacro.groovy
===================================================================
--- tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/TEI2ProjectMacro.groovy	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/TEI2ProjectMacro.groovy	(revision 2984)
@@ -51,7 +51,7 @@
 
 File xmlFileParentDirectory = xmlFile.getParentFile()
 String projectName = xmlFile.getName()
-if (projectName.indexOf(".") > 0) projectName = projectName.substring(0, projectName.indexOf("."))
+if (projectName.lastIndexOf(".") > 0) projectName = projectName.substring(0, projectName.lastIndexOf("."))
 File projectDirectory = new File(xmlFileParentDirectory, projectName)
 projectDirectory.deleteDir()
 if (projectDirectory.exists()) {
Index: tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/OntologiesProjection.groovy
===================================================================
--- tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/OntologiesProjection.groovy	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/OntologiesProjection.groovy	(revision 2984)
@@ -4,6 +4,7 @@
 import org.codehaus.groovy.transform.trait.SuperCallTraitTransformer;
 import org.txm.importer.StaxIdentityParser;
 import org.txm.scripts.importer.StaxParser;
+import org.txm.utils.FileUtils
 
 class OntologiesProjection extends StaxIdentityParser {
 
@@ -29,9 +30,7 @@
 		this.xmlFile = xmlFile
 		this.ontologies_links_directory = new File(corpusDirectory, "ontologies_links")
 
-		textname = xmlFile.getName()
-		int idx = textname.lastIndexOf(".xml")
-		if (idx > 0) textname = textname.substring(0, idx)
+		textname = FileUtils.stripExtension(xmlFile)
 		textname = textname.replaceAll("-c", "")
 
 		this.wordTag = "c";
Index: tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/Project2XTZMacro.groovy
===================================================================
--- tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/Project2XTZMacro.groovy	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/Project2XTZMacro.groovy	(revision 2984)
@@ -93,11 +93,11 @@
 
 for (File xmlFile : xmlFiles) {
 	if (xmlFile.getName().endsWith("-w.xml")) {
-		String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"))
+		String name = FileUtils.stripExtension(xmlFile);
 		wDirectory = new File(txmDirectory, name)
 		wFile = xmlFile
 	} else if (xmlFile.getName().endsWith("-c.xml")) {
-		String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"))
+		String name = FileUtils.stripExtension(xmlFile);
 		cDirectory = new File(txmDirectory, name)
 		cFile = xmlFile
 	}
Index: tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/CoordsProjection.groovy
===================================================================
--- tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/CoordsProjection.groovy	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/groovy/org/txm/macro/oriflamms/prepare/CoordsProjection.groovy	(revision 2984)
@@ -2,6 +2,7 @@
 
 import org.txm.importer.StaxIdentityParser;
 import org.txm.scripts.importer.StaxParser;
+import org.txm.utils.FileUtils
 
 class CoordsProjection extends StaxIdentityParser {
 
@@ -30,11 +31,9 @@
 		this.zones_directory = zones_directory
 		this.wordTag = wordTag;
 
-		textname = xmlFile.getName()
-		int idx = textname.lastIndexOf(".xml")
-		if (idx > 0) textname = textname.substring(0, idx)
+		textname = FileUtils.stripExtension(xmlFile)
 
-		idx = textname.indexOf("-w")
+		int idx = textname.indexOf("-w")
 		if (idx > 0) {
 			textname = textname.substring(0, idx)
 			xmlType = "word"
Index: tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Project2XTZ.java
===================================================================
--- tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Project2XTZ.java	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Project2XTZ.java	(revision 2984)
@@ -14,131 +14,136 @@
 import org.txm.utils.AsciiUtils;
 import org.txm.utils.BundleUtils;
 import org.txm.utils.DeleteDir;
+import org.txm.utils.FileUtils;
 import org.txm.utils.io.FileCopy;
 import org.txm.utils.io.IOUtils;
 import org.txm.utils.xml.UpdateXSLParameters;
 import org.xml.sax.SAXException;
 
 public class Project2XTZ {
+	
 	File projectDirectory;
+	
 	public Project2XTZ(File projectDirectory) {
 		this.projectDirectory = projectDirectory;
 	}
-
+	
 	public boolean process() throws IOException, TransformerException, ParserConfigurationException, SAXException, XMLStreamException {
 		File oriflammsMacroDirectory = new File(BundleUtils.getBundleFile("org.txm.oriflamms.rcp"), "res");
-		System.out.println("Ressources files directory: "+oriflammsMacroDirectory);
+		System.out.println("Ressources files directory: " + oriflammsMacroDirectory);
 		if (!oriflammsMacroDirectory.exists()) {
-			System.out.println("Oriflamms macro directory not found: "+oriflammsMacroDirectory+". Aborting");
+			System.out.println("Oriflamms macro directory not found: " + oriflammsMacroDirectory + ". Aborting");
 			return false;
 		}
 		File wFrontXSLFile = new File(oriflammsMacroDirectory, "txm-front-teioriflammsw-xtz.xsl");
 		if (!wFrontXSLFile.exists()) {
-			System.out.println("Oriflamms to XML-XTZ front XSL file is missing: "+wFrontXSLFile+". Aborting");
+			System.out.println("Oriflamms to XML-XTZ front XSL file is missing: " + wFrontXSLFile + ". Aborting");
 			return false;
 		}
 		File cFrontXSLFile = new File(oriflammsMacroDirectory, "txm-front-teioriflammsc-xtz.xsl");
 		if (!cFrontXSLFile.exists()) {
-			System.out.println("Oriflamms to XML-XTZ front XSL file is missing: "+cFrontXSLFile+". Aborting");
+			System.out.println("Oriflamms to XML-XTZ front XSL file is missing: " + cFrontXSLFile + ". Aborting");
 			return false;
 		}
-
+		
 		File cSplitXSLFile = new File(oriflammsMacroDirectory, "1-oriflamms-split-surfaces.xsl");
 		if (!cSplitXSLFile.exists()) {
-			System.out.println("Oriflamms to XML-XTZ split XSL file is missing: "+cSplitXSLFile+". Aborting");
+			System.out.println("Oriflamms to XML-XTZ split XSL file is missing: " + cSplitXSLFile + ". Aborting");
 			return false;
 		}
-
+		
 		File editionXSLFile1 = new File(oriflammsMacroDirectory, "1-default-html.xsl");
 		if (!editionXSLFile1.exists()) {
-			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: "+editionXSLFile1+".");
+			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: " + editionXSLFile1 + ".");
 			return false;
 		}
 		File editionXSLFile2 = new File(oriflammsMacroDirectory, "2-default-pager.xsl");
 		if (!editionXSLFile2.exists()) {
-			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: "+editionXSLFile2+".");
+			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: " + editionXSLFile2 + ".");
 			return false;
 		}
 		File editionXSLFile3 = new File(oriflammsMacroDirectory, "3-facsimile-pager.xsl");
 		if (!editionXSLFile3.exists()) {
-			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: "+editionXSLFile3+".");
+			System.out.println("Oriflamms to XML-XTZ edition XSL file is missing: " + editionXSLFile3 + ".");
 			return false;
 		}
 		File cssDirectory = new File(oriflammsMacroDirectory, "css");
 		if (!cssDirectory.exists()) {
-			System.out.println("Oriflamms css directory is missing: "+cssDirectory+".");
+			System.out.println("Oriflamms css directory is missing: " + cssDirectory + ".");
 			return false;
 		}
 		File jsDirectory = new File(oriflammsMacroDirectory, "js");
 		if (!jsDirectory.exists()) {
-			System.out.println("Oriflamms js directory is missing: "+jsDirectory+".");
+			System.out.println("Oriflamms js directory is missing: " + jsDirectory + ".");
 			return false;
 		}
 		File imagesDirectory = new File(oriflammsMacroDirectory, "images");
 		if (!imagesDirectory.exists()) {
-			System.out.println("Oriflamms images directory is missing: "+imagesDirectory+".");
+			System.out.println("Oriflamms images directory is missing: " + imagesDirectory + ".");
 			return false;
 		}
-
+		
 		File textDirectory = new File(projectDirectory, "texts");
-
+		
 		File txmDirectory = new File(projectDirectory, "txm");
 		if (txmDirectory.exists()) DeleteDir.deleteDirectory(txmDirectory);
 		txmDirectory.mkdir();
 		if (!txmDirectory.exists()) {
-			System.out.println("Error: the 'txm' directory could not be created: "+txmDirectory+". Aborting.");
+			System.out.println("Error: the 'txm' directory could not be created: " + txmDirectory + ". Aborting.");
 			return false;
 		}
-
+		
 		File wDirectory = null;
 		File cDirectory = null;
 		File wFile = null;
 		File cFile = null;
-
+		
 		File[] xmlFiles = textDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
 		if (xmlFiles == null) return false;
-
+		
 		for (File xmlFile : xmlFiles) {
 			if (xmlFile.getName().endsWith("-w.xml")) {
-				String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"));
+				String name = FileUtils.stripExtension(xmlFile);
 				wDirectory = new File(txmDirectory, name);
 				wFile = xmlFile;
-			} else if (xmlFile.getName().endsWith("-c.xml")) {
-				String name = xmlFile.getName().substring(0, xmlFile.getName().lastIndexOf(".xml"));
+			}
+			else if (xmlFile.getName().endsWith("-c.xml")) {
+				String name = FileUtils.stripExtension(xmlFile);
 				cDirectory = new File(txmDirectory, name);
 				cFile = xmlFile;
 			}
 		}
-
+		
 		if (wDirectory == null) {
-			System.out.println("The Word corpus XML file was not found in "+textDirectory+". Aborting.");
+			System.out.println("The Word corpus XML file was not found in " + textDirectory + ". Aborting.");
 			return false;
 		}
 		if (cDirectory == null) {
-			System.out.println("The Letter corpus XML file was not found in "+textDirectory+". Aborting.");
+			System.out.println("The Letter corpus XML file was not found in " + textDirectory + ". Aborting.");
 			return false;
 		}
-
-		//Create XML-XTZ source directories
+		
+		// Create XML-XTZ source directories
 		wDirectory.mkdirs();
 		cDirectory.mkdirs();
-
+		
 		// Copy XML files and split character XML file
 		FileCopy.copy(wFile, new File(wDirectory, wFile.getName()));
-
+		
 		ApplyXsl2 builder = new ApplyXsl2(cSplitXSLFile);
-		HashMap<String, String> xslParams = new HashMap<String, String>();
+		HashMap<String, String> xslParams = new HashMap<>();
 		xslParams.put("output-directory", cDirectory.getAbsoluteFile().toURI().toString());
-		for (String name : xslParams.keySet()) builder.setParam(name, xslParams.get(name));
+		for (String name : xslParams.keySet())
+			builder.setParam(name, xslParams.get(name));
 		if (!builder.process(cFile, null)) {
-			System.out.println("Error: fail to split "+cFile);
+			System.out.println("Error: fail to split " + cFile);
 			return false;
 		}
 		if (!ApplyXsl2.processImportSources(cFrontXSLFile, ApplyXsl2.listFiles(cDirectory), new HashMap<String, Object>())) {
-			System.out.println("Error: fail to apply front XSL with "+cDirectory+" files");
+			System.out.println("Error: fail to apply front XSL with " + cDirectory + " files");
 			return false;
 		}
-		// INJECT ontologies 
+		// INJECT ontologies
 		System.out.println("Injecting ontologies...");
 		for (File f : cDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
 			if (f.getName().startsWith(cDirectory.getName())) {
@@ -146,14 +151,15 @@
 				File outputFile = new File(cDirectory, "temp.xml");
 				cp.process(outputFile);
 				if (outputFile.exists() && f.delete() && outputFile.renameTo(f)) {
-
-				} else {
-					System.out.println("Failed to replace XML file "+f+" with "+outputFile);
+					
+				}
+				else {
+					System.out.println("Failed to replace XML file " + f + " with " + outputFile);
 					return false;
 				}
 			}
 		}
-
+		
 		// INJECT word's coordinates
 		System.out.println("Injecting coordinates...");
 		File xmlFile = new File(wDirectory, wFile.getName());
@@ -163,39 +169,41 @@
 		CoordsProjection cp = new CoordsProjection(xmlFile, img_links_directory, zones_directory, "w");
 		if (cp.process(outputFile)) {
 			if (outputFile.exists() && xmlFile.delete() && outputFile.renameTo(xmlFile)) {
-
-			} else {
-				System.out.println("Failed to replace XML file "+xmlFile+" with "+outputFile);
+				
+			}
+			else {
+				System.out.println("Failed to replace XML file " + xmlFile + " with " + outputFile);
 				return false;
 			}
-		} else {
+		}
+		else {
 			System.out.println("Coordinates injection failed. Aborting");
 			return false;
 		}
-
+		
 		// Create XSL directories
-
+		
 		File wXSLDirectory = new File(wDirectory, "xsl");
 		File cXSLDirectory = new File(cDirectory, "xsl");
-
-		//File cSplitXSLDirectory = new File(cXSLDirectory, "1-split-merge")
-		//cSplitXSLDirectory.mkdirs()
-
+		
+		// File cSplitXSLDirectory = new File(cXSLDirectory, "1-split-merge")
+		// cSplitXSLDirectory.mkdirs()
+		
 		File wFrontXSLDirectory = new File(wXSLDirectory, "2-front");
-		//File cFrontXSLDirectory = new File(cXSLDirectory, "2-front")
+		// File cFrontXSLDirectory = new File(cXSLDirectory, "2-front")
 		wFrontXSLDirectory.mkdirs();
-		//cFrontXSLDirectory.mkdirs()
-
+		// cFrontXSLDirectory.mkdirs()
+		
 		// Copy Split XSL file
-		//File newCSplitXSLFile = new File(cSplitXSLDirectory, cSplitXSLFile.getName())
-		//FileCopy.copy(cSplitXSLFile, newCSplitXSLFile);
-
+		// File newCSplitXSLFile = new File(cSplitXSLDirectory, cSplitXSLFile.getName())
+		// FileCopy.copy(cSplitXSLFile, newCSplitXSLFile);
+		
 		// Copy Front XSL file
 		File newWFrontXSLFile = new File(wFrontXSLDirectory, wFrontXSLFile.getName());
-		//File newCFrontXSLFile = new File(cFrontXSLDirectory, cFrontXSLFile.getName())
+		// File newCFrontXSLFile = new File(cFrontXSLDirectory, cFrontXSLFile.getName())
 		FileCopy.copy(wFrontXSLFile, newWFrontXSLFile);
-		//FileCopy.copy(cFrontXSLFile, newCFrontXSLFile);
-
+		// FileCopy.copy(cFrontXSLFile, newCFrontXSLFile);
+		
 		// Copy edition XSL file
 		File wEditionXSLDirectory = new File(wXSLDirectory, "4-edition");
 		File cEditionXSLDirectory = new File(cXSLDirectory, "4-edition");
@@ -213,40 +221,40 @@
 		File newCEditionXSLFile3 = new File(cEditionXSLDirectory, editionXSLFile3.getName());
 		FileCopy.copy(editionXSLFile3, newWEditionXSLFile3);
 		FileCopy.copy(editionXSLFile3, newCEditionXSLFile3);
-
-		//patch XSL files with image directory path and set the 'word-element' xsl param
+		
+		// patch XSL files with image directory path and set the 'word-element' xsl param
 		File projectImgDirectory = new File(projectDirectory, "img");
-		HashMap<String, String> parameters = new HashMap<String, String>();
+		HashMap<String, String> parameters = new HashMap<>();
 		parameters.put("image-directory", projectImgDirectory.getAbsolutePath());
 		parameters.put("word-element", "w");
-		System.out.println("update "+newWEditionXSLFile3+" with "+parameters);
+		System.out.println("update " + newWEditionXSLFile3 + " with " + parameters);
 		UpdateXSLParameters p = new UpdateXSLParameters(newWEditionXSLFile3);
 		if (!p.process(parameters)) {
-			System.out.println("Fail to patch "+newWEditionXSLFile3);
+			System.out.println("Fail to patch " + newWEditionXSLFile3);
 			return false;
 		}
-		parameters = new HashMap<String, String>();
+		parameters = new HashMap<>();
 		parameters.put("image-directory", projectImgDirectory.getAbsolutePath());
 		parameters.put("word-element", "c");
-		System.out.println("update "+newCEditionXSLFile3+" with "+parameters);
+		System.out.println("update " + newCEditionXSLFile3 + " with " + parameters);
 		UpdateXSLParameters p2 = new UpdateXSLParameters(newCEditionXSLFile3);
 		if (!p2.process(parameters)) {
-			System.out.println("Fail to patch "+newCEditionXSLFile3);
+			System.out.println("Fail to patch " + newCEditionXSLFile3);
 			return false;
 		}
-
+		
 		// Copy js and images directories
-		File wCSSDirectory =  new File(wDirectory, cssDirectory.getName());
+		File wCSSDirectory = new File(wDirectory, cssDirectory.getName());
 		wCSSDirectory.mkdir();
-		File wJsDirectory =  new File(wDirectory, jsDirectory.getName());
+		File wJsDirectory = new File(wDirectory, jsDirectory.getName());
 		wJsDirectory.mkdir();
-		File wImagesDirectory =  new File(wDirectory, imagesDirectory.getName());
+		File wImagesDirectory = new File(wDirectory, imagesDirectory.getName());
 		wImagesDirectory.mkdir();
-		File cCSSDirectory =  new File(cDirectory, cssDirectory.getName());
+		File cCSSDirectory = new File(cDirectory, cssDirectory.getName());
 		cCSSDirectory.mkdir();
-		File cJsDirectory =  new File(cDirectory, jsDirectory.getName());
+		File cJsDirectory = new File(cDirectory, jsDirectory.getName());
 		cJsDirectory.mkdir();
-		File cImagesDirectory =  new File(cDirectory, imagesDirectory.getName());
+		File cImagesDirectory = new File(cDirectory, imagesDirectory.getName());
 		cImagesDirectory.mkdir();
 		FileCopy.copyFiles(cssDirectory, wCSSDirectory);
 		FileCopy.copyFiles(jsDirectory, wJsDirectory);
@@ -254,11 +262,11 @@
 		FileCopy.copyFiles(cssDirectory, cCSSDirectory);
 		FileCopy.copyFiles(jsDirectory, cJsDirectory);
 		FileCopy.copyFiles(imagesDirectory, cImagesDirectory);
-
+		
 		// Prepare import.xml files
 		File wImportXMLFile = new File(wDirectory, "import.xml");
 		File cImportXMLFile = new File(cDirectory, "import.xml");
-
+		
 		BaseOldParameters.createEmptyParams(wImportXMLFile, AsciiUtils.buildId(wDirectory.getName()).toUpperCase());
 		BaseOldParameters wParams = new BaseOldParameters(wImportXMLFile);
 		wParams.load();
@@ -267,12 +275,12 @@
 		wParams.setDoAnnotation(false);
 		wParams.setAnnotationLang("fr");
 		wParams.setWordsPerPage(9999999);
-		wParams.setTextualPlans("", "note", "teiHeader,facsimile","pb,cb,lb");
+		wParams.setTextualPlans("", "note", "teiHeader,facsimile", "pb,cb,lb");
 		wParams.getCorpusElement().setAttribute("font", "Junicode");
 		wParams.getEditionsElement(wParams.getCorpusElement()).setAttribute("default", "default,facsimile");
 		wParams.getCorpusElement().setAttribute("name", AsciiUtils.buildId(wDirectory.getName()).toUpperCase());
-
-
+		
+		
 		BaseOldParameters.createEmptyParams(cImportXMLFile, AsciiUtils.buildId(cDirectory.getName()).toUpperCase());
 		BaseOldParameters cParams = new BaseOldParameters(cImportXMLFile);
 		cParams.load();
@@ -281,11 +289,11 @@
 		cParams.setDoAnnotation(false);
 		cParams.setAnnotationLang("fr");
 		cParams.setWordsPerPage(9999999);
-		cParams.setTextualPlans("", "note", "teiHeader,facsimile","pb,cb,lb");
+		cParams.setTextualPlans("", "note", "teiHeader,facsimile", "pb,cb,lb");
 		cParams.getCorpusElement().setAttribute("font", "Junicode");
 		cParams.getEditionsElement(cParams.getCorpusElement()).setAttribute("default", "default,facsimile");
 		cParams.getCorpusElement().setAttribute("name", AsciiUtils.buildId(cDirectory.getName()).toUpperCase());
-
+		
 		return cParams.save() && wParams.save();
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OntologiesProjection.java
===================================================================
--- tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OntologiesProjection.java	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OntologiesProjection.java	(revision 2984)
@@ -13,62 +13,73 @@
 
 import org.txm.importer.StaxIdentityParser;
 import org.txm.scripts.importer.StaxParser;
+import org.txm.utils.FileUtils;
 
 class OntologiesProjection extends StaxIdentityParser {
-
+	
 	File xmlFile;
-
+	
 	String wordTag;
+	
 	String textname;
+	
 	String milestone;
+	
 	String group;
-
-	HashMap<String, String[]> links = new HashMap<String, String[]>();
-	HashMap<String, List<Serializable>> prefixDefsPatterns = new HashMap<String, List<Serializable>>();
-	HashMap<String, HashMap<String, HashMap<String, String>>> ggly_ontologies = new HashMap<String, HashMap<String, HashMap<String, String>>>();
-	HashMap<String, HashMap<String, String>> ggly_ontologies_unicodechars = new HashMap<String, HashMap<String, String>>();
-	HashMap<String, HashMap> lgly_ontologies = new HashMap<String, HashMap>();
-
+	
+	HashMap<String, String[]> links = new HashMap<>();
+	
+	HashMap<String, List<Serializable>> prefixDefsPatterns = new HashMap<>();
+	
+	HashMap<String, HashMap<String, HashMap<String, String>>> ggly_ontologies = new HashMap<>();
+	
+	HashMap<String, HashMap<String, String>> ggly_ontologies_unicodechars = new HashMap<>();
+	
+	HashMap<String, HashMap> lgly_ontologies = new HashMap<>();
+	
 	String current_ontology_link_file_name = "";
-
+	
 	File ontologies_links_directory;
-
+	
 	public OntologiesProjection(File xmlFile, File corpusDirectory) throws IOException, XMLStreamException {
 		super(xmlFile);
-
+		
 		this.xmlFile = xmlFile;
 		this.ontologies_links_directory = new File(corpusDirectory, "ontologies_links");
-
-		textname = xmlFile.getName();
-		int idx = textname.lastIndexOf(".xml");
-		if (idx > 0) textname = textname.substring(0, idx);
+		
+		textname = FileUtils.stripExtension(xmlFile);
 		textname = textname.replaceAll("-c", "");
-
+		
 		this.wordTag = "c";
 	}
-
+	
 	public boolean buildGGlyOntology(String prefix) {
-		String path = (String)prefixDefsPatterns.get(prefix).get(1);
+		String path = (String) prefixDefsPatterns.get(prefix).get(1);
 		int idx = path.indexOf("#");
 		if (idx > 0) path = path.substring(0, idx);
-
-		File ggly_ontology_file = new File(xmlFile.getParentFile(), "../"+path);
+		
+		File ggly_ontology_file = new File(xmlFile.getParentFile(), "../" + path);
 		if (!ggly_ontology_file.exists()) {
-			System.out.println("WARNING: cannot found global ontology file: "+ggly_ontology_file);
+			System.out.println("WARNING: cannot found global ontology file: " + ggly_ontology_file);
 			return false;
 		}
-		final HashMap<String, HashMap<String, String>> global_ontologies = new HashMap<String, HashMap<String, String>>();
-		final HashMap<String, String> unicode_global_ontologies = new HashMap<String, String>();
+		final HashMap<String, HashMap<String, String>> global_ontologies = new HashMap<>();
+		final HashMap<String, String> unicode_global_ontologies = new HashMap<>();
 		StaxParser pontologies = new StaxParser(ggly_ontology_file) {
+			
 			boolean startChar = false, startLocalName = false, startValue = false, startMapping = false;
+			
 			String unicodeChar, standardizedChar, subtype, type;
+			
 			String id, charLocalName, charValue;
+			
 			StringBuilder c = new StringBuilder();
-
+			
+			@Override
 			public void processStartElement() {
 				if (localname.equals("char")) {
 					// get id
-					for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
 						if (parser.getAttributeLocalName(i).equals("id")) {
 							id = parser.getAttributeValue(i);
 							break;
@@ -76,336 +87,369 @@
 					}
 					startChar = true;
 					c.setLength(0);
-				} else if (localname.equals("mapping")) {
+				}
+				else if (localname.equals("mapping")) {
 					subtype = "";
 					type = "";
-					for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
 						if (parser.getAttributeLocalName(i).equals("subtype")) {
 							subtype = parser.getAttributeValue(i);
-						} else if (parser.getAttributeLocalName(i).equals("type")) {
+						}
+						else if (parser.getAttributeLocalName(i).equals("type")) {
 							type = parser.getAttributeValue(i);
 						}
 					}
 					startMapping = true;
 					c.setLength(0);
-				} else if (localname.equals("localName")) {
+				}
+				else if (localname.equals("localName")) {
 					startLocalName = true;
 					c.setLength(0);
-				} else if (localname.equals("value")) {
+				}
+				else if (localname.equals("value")) {
 					startLocalName = true;
 					c.setLength(0);
 				}
 			}
-
+			
+			@Override
 			public void processCharacters() {
 				if (startMapping) c.append(parser.getText());
 				else if (startLocalName) c.append(parser.getText());
 				else if (startValue) c.append(parser.getText());
 			}
-
+			
+			@Override
 			public void processEndElement() {
 				if (localname.equals("char")) {
 					startChar = false;
-					HashMap<String, String> h = new HashMap<String, String>();
-					h.put("standard",standardizedChar);
+					HashMap<String, String> h = new HashMap<>();
+					h.put("standard", standardizedChar);
 					h.put("unicode", unicodeChar);
-					h.put("value",charValue);
-					h.put("localname",charLocalName);
+					h.put("value", charValue);
+					h.put("localname", charLocalName);
 					global_ontologies.put(id, h);
 					unicode_global_ontologies.put(unicodeChar, standardizedChar);
-				} else if (localname.equals("mapping")) {
+				}
+				else if (localname.equals("mapping")) {
 					if (subtype.equals("Unicode")) {
 						unicodeChar = c.toString().trim();
-					} else if (type.equals("standardized")) {
+					}
+					else if (type.equals("standardized")) {
 						standardizedChar = c.toString().trim();
 					}
 					startMapping = false;
-				} else if (localname.equals("localName")) {
+				}
+				else if (localname.equals("localName")) {
 					charLocalName = c.toString().trim();
 					startLocalName = false;
-				} else if (localname.equals("value")) {
+				}
+				else if (localname.equals("value")) {
 					charValue = c.toString().trim();
 					startValue = false;
 				}
 			}
-				};
+		};
 		pontologies.process();
 		ggly_ontologies.put(prefix, global_ontologies);
 		ggly_ontologies_unicodechars.put(prefix, unicode_global_ontologies);
-		//System.out.println(ggly_ontologies
+		// System.out.println(ggly_ontologies
 		return true;
 	}
-
+	
 	public boolean buildLGlyOntology(String prefix) {
-		String path = (String)prefixDefsPatterns.get(prefix).get(1);
+		String path = (String) prefixDefsPatterns.get(prefix).get(1);
 		int idx = path.indexOf("#");
 		if (idx > 0) path = path.substring(0, idx);
-
-		File lgly_ontology_file = new File(ontologies_links_directory, textname+"-ontolinks.xml"); // add "../" because we are in txm/<corpus>-c directory
+		
+		File lgly_ontology_file = new File(ontologies_links_directory, textname + "-ontolinks.xml"); // add "../" because we are in txm/<corpus>-c directory
 		if (!lgly_ontology_file.exists()) {
-			System.out.println("WARNING: cannot find Local ontology file "+lgly_ontology_file);
+			System.out.println("WARNING: cannot find Local ontology file " + lgly_ontology_file);
 			return false;
 		}
-
-		final HashMap<String, HashMap> local_ontologies = new HashMap<String, HashMap>();
+		
+		final HashMap<String, HashMap> local_ontologies = new HashMap<>();
 		StaxParser pontologies = new StaxParser(lgly_ontology_file) {
-					boolean startNote = false;
-					String id, change, parent;
-					StringBuilder c = new StringBuilder();
-					HashMap<String, String> glyph = new HashMap<String, String>();
-
-					public void processStartElement() {
-						if (localname.equals("glyph")) {
-							// get id
-							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-								change = "";
-								if (parser.getAttributeLocalName(i).equals("id")) {
-									id = parser.getAttributeValue(i);
-								} else if (parser.getAttributeLocalName(i).equals("change")) {
-									change = parser.getAttributeValue(i);
-								}
-							}
-							glyph = new HashMap<String, String>();
-							glyph.put("change",change);
-							glyph.put("id", id); // new glyph
-							parent = null;
-						} else if (localname.equals("note")) {
-							startNote = true;
-							c.setLength(0);
+			
+			boolean startNote = false;
+			
+			String id, change, parent;
+			
+			StringBuilder c = new StringBuilder();
+			
+			HashMap<String, String> glyph = new HashMap<>();
+			
+			@Override
+			public void processStartElement() {
+				if (localname.equals("glyph")) {
+					// get id
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						change = "";
+						if (parser.getAttributeLocalName(i).equals("id")) {
+							id = parser.getAttributeValue(i);
 						}
-					}
-
-					public void processCharacters() {
-						if (startNote) c.append(parser.getText());
-					}
-
-					public void processEndElement() {
-						if (localname.equals("char")) {
-							if (parent != null)
-								glyph.put("parent", glyph.get(parent));
-							local_ontologies.put(id, glyph);
-						} else if (localname.equals("note")) {
-							parent = c.toString().trim();
-							startNote = false;
+						else if (parser.getAttributeLocalName(i).equals("change")) {
+							change = parser.getAttributeValue(i);
 						}
 					}
-				};
+					glyph = new HashMap<>();
+					glyph.put("change", change);
+					glyph.put("id", id); // new glyph
+					parent = null;
+				}
+				else if (localname.equals("note")) {
+					startNote = true;
+					c.setLength(0);
+				}
+			}
+			
+			@Override
+			public void processCharacters() {
+				if (startNote) c.append(parser.getText());
+			}
+			
+			@Override
+			public void processEndElement() {
+				if (localname.equals("char")) {
+					if (parent != null)
+						glyph.put("parent", glyph.get(parent));
+					local_ontologies.put(id, glyph);
+				}
+				else if (localname.equals("note")) {
+					parent = c.toString().trim();
+					startNote = false;
+				}
+			}
+		};
 		pontologies.process();
 		lgly_ontologies.put(prefix, local_ontologies);
-
+		
 		return true;
 	}
-
+	
 	public void loadOntologyLinkFile(String name) {
 		links = new HashMap();
 		prefixDefsPatterns = new HashMap();
 		prefixDefsPatterns.put("ggly", Arrays.asList(Pattern.compile("([a-z]+)"), "../../charDecl.xml#$1"));
-		prefixDefsPatterns.put("lgly", Arrays.asList(Pattern.compile("([a-z]+)"), "../ontologies/"+textname+".xml#$1"));
-		prefixDefsPatterns.put("txt", Arrays.asList(Pattern.compile("([a-z]+)"), "../texts/"+textname+".xml#$1"));
-			
+		prefixDefsPatterns.put("lgly", Arrays.asList(Pattern.compile("([a-z]+)"), "../ontologies/" + textname + ".xml#$1"));
+		prefixDefsPatterns.put("txt", Arrays.asList(Pattern.compile("([a-z]+)"), "../texts/" + textname + ".xml#$1"));
+		
 		lgly_ontologies = new HashMap();
 		ggly_ontologies = new HashMap();
 		File ontology_link_file = new File(ontologies_links_directory, name);
 		if (!ontology_link_file.exists()) {
-			System.out.println("WARNING: no ontology link file: "+ontology_link_file);
+			System.out.println("WARNING: no ontology link file: " + ontology_link_file);
 			return;
 		}
-
+		
 		StaxParser pLinks = new StaxParser(ontology_link_file) {
-					public void processStartElement() {
-						if (localname.equals("linkGrp")) {
-							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-								if (parser.getAttributeLocalName(i).equals("type")) {
-									group = parser.getAttributeValue(i);
-									break;
-								}
-							}
-						} else if (localname.equals("prefixDef")) {
-							String ident = null, matchPattern = null, replacementPattern = null;
-							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-								if (parser.getAttributeLocalName(i).equals("ident")) {
-									ident = parser.getAttributeValue(i);
-								} else if (parser.getAttributeLocalName(i).equals("matchPattern")) {
-									matchPattern = parser.getAttributeValue(i);
-								} else if (parser.getAttributeLocalName(i).equals("replacementPattern")) {
-									replacementPattern = parser.getAttributeValue(i);
-								}
-							}
-							if (ident != null && matchPattern != null && replacementPattern != null && !ident.equals("txt")) {
-								prefixDefsPatterns.put(ident, Arrays.asList(Pattern.compile(matchPattern), replacementPattern));
-								OntologiesProjection.this.getOntology(ident);
-							}
-						} else if (localname.equals("link")) {
-							String target = "";
-
-							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-								if (parser.getAttributeLocalName(i).equals("target")) {
-									target = parser.getAttributeValue(i);
-									break;
-								}
-							}
-
-							String[] split = target.split(" ", 2); // first part word id next part are the ontologies id
-							links.put(split[0].substring(4), split[1].split(" "));
+			
+			@Override
+			public void processStartElement() {
+				if (localname.equals("linkGrp")) {
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						if (parser.getAttributeLocalName(i).equals("type")) {
+							group = parser.getAttributeValue(i);
+							break;
 						}
 					}
-				};
+				}
+				else if (localname.equals("prefixDef")) {
+					String ident = null, matchPattern = null, replacementPattern = null;
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						if (parser.getAttributeLocalName(i).equals("ident")) {
+							ident = parser.getAttributeValue(i);
+						}
+						else if (parser.getAttributeLocalName(i).equals("matchPattern")) {
+							matchPattern = parser.getAttributeValue(i);
+						}
+						else if (parser.getAttributeLocalName(i).equals("replacementPattern")) {
+							replacementPattern = parser.getAttributeValue(i);
+						}
+					}
+					if (ident != null && matchPattern != null && replacementPattern != null && !ident.equals("txt")) {
+						prefixDefsPatterns.put(ident, Arrays.asList(Pattern.compile(matchPattern), replacementPattern));
+						OntologiesProjection.this.getOntology(ident);
+					}
+				}
+				else if (localname.equals("link")) {
+					String target = "";
+					
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						if (parser.getAttributeLocalName(i).equals("target")) {
+							target = parser.getAttributeValue(i);
+							break;
+						}
+					}
+					
+					String[] split = target.split(" ", 2); // first part word id next part are the ontologies id
+					links.put(split[0].substring(4), split[1].split(" "));
+				}
+			}
+		};
 		pLinks.process();
-		//		System.out.println("links size: "+links.size()
-		//		System.out.println("ggly_ontologies size: "+ggly_ontologies.size()
-		//		System.out.println("lgly_ontologies size: "+lgly_ontologies.size()
+		// System.out.println("links size: "+links.size()
+		// System.out.println("ggly_ontologies size: "+ggly_ontologies.size()
+		// System.out.println("lgly_ontologies size: "+lgly_ontologies.size()
 	}
-
+	
 	public HashMap<String, HashMap<String, String>> getOntology(String prefix) {
 		if (prefix.startsWith("ggly")) {
 			if (!ggly_ontologies.containsKey(prefix)) buildGGlyOntology(prefix);
 			return ggly_ontologies.get(prefix);
-		} else if (prefix.startsWith("lgly")) {
+		}
+		else if (prefix.startsWith("lgly")) {
 			if (!lgly_ontologies.containsKey(prefix)) buildLGlyOntology(prefix);
 			return lgly_ontologies.get(prefix);
 		}
 		return null;
 	}
-
+	
+	@Override
 	public void processStartElement() throws XMLStreamException, IOException {
 		super.processStartElement();
 		if (localname.equals("milestone")) {
 			String id = "";
-			String unit= "";
-			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			String unit = "";
+			for (int i = 0; i < parser.getAttributeCount(); i++) {
 				if (parser.getAttributeLocalName(i).equals("id")) {
 					id = parser.getAttributeValue(i);
-				} else if (parser.getAttributeLocalName(i).equals("unit")) {
+				}
+				else if (parser.getAttributeLocalName(i).equals("unit")) {
 					unit = parser.getAttributeValue(i);
 				}
 			}
-
+			
 			if (unit.equals("surface")) {
 				milestone = id;
 			}
-		} else if (localname.equals(wordTag)) {
+		}
+		else if (localname.equals(wordTag)) {
 			String id = "";
 			String characters = "";
-			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			for (int i = 0; i < parser.getAttributeCount(); i++) {
 				if (parser.getAttributeLocalName(i).equals("id")) {
 					id = parser.getAttributeValue(i);
-				} else if (parser.getAttributeLocalName(i).equals("characters")) {
+				}
+				else if (parser.getAttributeLocalName(i).equals("characters")) {
 					characters = parser.getAttributeValue(i);
 				}
 			}
-
-			String ontology_link_file_name = textname+"-ontolinks.xml";
+			
+			String ontology_link_file_name = textname + "-ontolinks.xml";
 			if (!current_ontology_link_file_name.equals(ontology_link_file_name)) { // rebuild hashmaps
 				current_ontology_link_file_name = ontology_link_file_name;
 				loadOntologyLinkFile(ontology_link_file_name);
 				getOntology("ggly");
 			}
-
+			
 			String sign = null, allographExpert = null, allographAutomatic = null; // default value is attribute characters
-
-			//AUTO ALLOGRAPH
+			
+			// AUTO ALLOGRAPH
 			if (links.containsKey(id))
 				for (String link : links.get(id)) { // automatic allograph loop
-					if (link.startsWith("lgly")) {
-						int idx = link.indexOf(":");
-						link = link.substring(idx+1);
-						if (link.startsWith("auto_")) { // automatic lgly
-							if (allographAutomatic == null) allographAutomatic = link.substring(5);
-							else if (allographAutomatic.length()+5 < link.length()) allographAutomatic = link.substring(5);
-						} else { // manual lgly
-
-						}
-					}
+				if (link.startsWith("lgly")) {
+				int idx = link.indexOf(":");
+				link = link.substring(idx + 1);
+				if (link.startsWith("auto_")) { // automatic lgly
+				if (allographAutomatic == null) allographAutomatic = link.substring(5);
+				else if (allographAutomatic.length() + 5 < link.length()) allographAutomatic = link.substring(5);
 				}
+				else { // manual lgly
+				
+				}
+				}
+				}
 			if (allographAutomatic == null) allographAutomatic = characters;
-
-			//EXPERT ALLOGRAPH
+			
+			// EXPERT ALLOGRAPH
 			if (links.containsKey(id))
 				for (String link : links.get(id)) { // expert allograph loop, try to find a ggly entity
-					//getOntology("ggly")
-					if (link.startsWith("ggly")) {
-						int idx = link.indexOf(":");
-						String prefix = link.substring(0, idx);
-						link = link.substring(idx+1);
-
-						HashMap<String, HashMap<String, String>> onto = getOntology(prefix);
-						if (onto != null) {
-							HashMap<String, String> charOnto = onto.get(link);
-							if (charOnto != null) {
-								String localname = charOnto.get("localname");
-								String value =  charOnto.get("value");
-								if ("entity".equals(localname)) {
-									allographExpert = value;
-								}
-							}
-						}
-					}
+				// getOntology("ggly")
+				if (link.startsWith("ggly")) {
+				int idx = link.indexOf(":");
+				String prefix = link.substring(0, idx);
+				link = link.substring(idx + 1);
+				
+				HashMap<String, HashMap<String, String>> onto = getOntology(prefix);
+				if (onto != null) {
+				HashMap<String, String> charOnto = onto.get(link);
+				if (charOnto != null) {
+				String localname = charOnto.get("localname");
+				String value = charOnto.get("value");
+				if ("entity".equals(localname)) {
+				allographExpert = value;
 				}
+				}
+				}
+				}
+				}
 			if (allographExpert == null)
 				if (links.containsKey(id))
 					for (String link : links.get(id)) { // expert allograph loop, try to find the longest non-autolgly entity
-						if (link.startsWith("lgly")) {
-							int idx = link.indexOf(":");
-							link = link.substring(idx+1);
-							if (!link.startsWith("auto_")) { // non automatic lgly
-								//System.out.println("link= "+link
-								if (allographExpert == null) allographExpert = link;
-								else if (allographExpert.length()+5 < link.length()) allographExpert = link;
-							}
-						}
+					if (link.startsWith("lgly")) {
+					int idx = link.indexOf(":");
+					link = link.substring(idx + 1);
+					if (!link.startsWith("auto_")) { // non automatic lgly
+					// System.out.println("link= "+link
+					if (allographExpert == null) allographExpert = link;
+					else if (allographExpert.length() + 5 < link.length()) allographExpert = link;
 					}
+					}
+					}
 			if (allographExpert == null) allographExpert = allographAutomatic;
-
-			//SIGN
+			
+			// SIGN
 			if (sign == null)
 				if (links.containsKey(id))
 					for (String link : links.get(id)) { // expert allograph loop, try to find the shortest ggly entity
-						//getOntology("ggly")
-						if (link.startsWith("ggly")) {
-							int idx = link.indexOf(":");
-							String prefix = link.substring(0, idx);
-							link = link.substring(idx+1);
-
-							HashMap<String, HashMap<String, String>> onto = getOntology(prefix);
-							if (onto != null) {
-								HashMap<String, String> charOnto = onto.get(link);
-								if (charOnto != null) {
-									sign = charOnto.get("standard");
-								}
-							}
-						}
+					// getOntology("ggly")
+					if (link.startsWith("ggly")) {
+					int idx = link.indexOf(":");
+					String prefix = link.substring(0, idx);
+					link = link.substring(idx + 1);
+					
+					HashMap<String, HashMap<String, String>> onto = getOntology(prefix);
+					if (onto != null) {
+					HashMap<String, String> charOnto = onto.get(link);
+					if (charOnto != null) {
+					sign = charOnto.get("standard");
 					}
+					}
+					}
+					}
 			if (sign == null)
 				if (links.containsKey(id))
 					for (String link : links.get(id)) { // sign loop, try to find the shortest non-autolgly entity
-						if (link.startsWith("lgly")) {
-							int idx = link.indexOf(":");
-							link = link.substring(idx+1);
-							if (!link.startsWith("auto_")) { // non automatic lgly
-								if (sign == null) sign = link;
-								else if (sign.length()+5 > link.length()) sign = link;
-							}
-						}
+					if (link.startsWith("lgly")) {
+					int idx = link.indexOf(":");
+					link = link.substring(idx + 1);
+					if (!link.startsWith("auto_")) { // non automatic lgly
+					if (sign == null) sign = link;
+					else if (sign.length() + 5 > link.length()) sign = link;
 					}
+					}
+					}
 			if (sign == null) {
 				for (HashMap<String, String> chars : ggly_ontologies_unicodechars.values()) {
-					//HashMap<String, String> chars = (HashMap<String, String>)ggly.get(1);
+					// HashMap<String, String> chars = (HashMap<String, String>)ggly.get(1);
 					if (chars.containsKey(characters)) sign = chars.get(characters);
 				}
 			}
 			if (sign == null) sign = characters.toLowerCase();
-
+			
 			try {
 				writer.writeAttribute("sign", sign);
 				writer.writeAttribute("allograph-expert", allographExpert);
 				writer.writeAttribute("allograph-auto", allographAutomatic);
-			} catch (XMLStreamException e) {
+			}
+			catch (XMLStreamException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
 		}
 	}
-
+	
 	public static void main(String[] args) {
 		File corpusDirectory = new File("/home/mdecorde/TEMP/testori/qgraal_cmTest");
 		File xmlFile = new File(corpusDirectory, "txm/qgraal_cmTest-c/qgraal_cmTest-c_surf_qgraal_cmTest_lyonbm_pa77-160.xml");
@@ -414,10 +458,12 @@
 		try {
 			OntologiesProjection cp = new OntologiesProjection(xmlFile, corpusDirectory);
 			System.out.println(cp.process(outputFile));
-		} catch (XMLStreamException e) {
+		}
+		catch (XMLStreamException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		} catch (IOException e) {
+		}
+		catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
Index: tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/CoordsProjection.java
===================================================================
--- tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/CoordsProjection.java	(revision 2983)
+++ tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/CoordsProjection.java	(revision 2984)
@@ -8,197 +8,225 @@
 
 import org.txm.importer.StaxIdentityParser;
 import org.txm.scripts.importer.StaxParser;
+import org.txm.utils.FileUtils;
 
 class CoordsProjection extends StaxIdentityParser {
-
+	
 	File xmlFile;
+	
 	File img_links_directory;
+	
 	File zones_directory;
-
+	
 	String wordTag;
+	
 	String textname;
+	
 	String milestone;
-
+	
 	String current_img_file = "";
+	
 	String current_zone_file = "";
-
+	
 	String xmlType;
+	
 	String group;
-
-	HashMap<String, String[]> zones = new HashMap<String, String[]>();
-	HashMap<String, String> links = new HashMap<String, String>();
-
+	
+	HashMap<String, String[]> zones = new HashMap<>();
+	
+	HashMap<String, String> links = new HashMap<>();
+	
 	public CoordsProjection(File xmlFile, File img_links_directory, File zones_directory, String wordTag) throws IOException, XMLStreamException {
 		super(xmlFile);
-
+		
 		this.xmlFile = xmlFile;
 		this.img_links_directory = img_links_directory;
 		this.zones_directory = zones_directory;
 		this.wordTag = wordTag;
-
-		textname = xmlFile.getName();
-		int idx = textname.lastIndexOf(".xml");
-		if (idx > 0) textname = textname.substring(0, idx);
-
-		idx = textname.indexOf("-w");
+		
+		if (!FileUtils.isXMLFile(xmlFile)) {
+			throw new IllegalArgumentException("File is not an XML file: " + xmlFile);
+		}
+		
+		textname = FileUtils.stripExtension(xmlFile);
+		
+		int idx = textname.indexOf("-w");
 		if (idx > 0) {
 			textname = textname.substring(0, idx);
 			xmlType = "word";
 		}
-
+		
 		idx = textname.indexOf("-c");
 		if (idx > 0) {
 			textname = textname.substring(0, idx);
 			xmlType = "character";
 		}
 	}
-
+	
+	@Override
 	public void processStartElement() throws XMLStreamException, IOException {
 		super.processStartElement();
 		if (localname.equals("milestone")) {
 			String id = "";
-			String unit= "";
-			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			String unit = "";
+			for (int i = 0; i < parser.getAttributeCount(); i++) {
 				if (parser.getAttributeLocalName(i).equals("id")) {
 					id = parser.getAttributeValue(i);
-				} else if (parser.getAttributeLocalName(i).equals("unit")) {
+				}
+				else if (parser.getAttributeLocalName(i).equals("unit")) {
 					unit = parser.getAttributeValue(i);
 				}
 			}
-
+			
 			if (unit.equals("surface")) {
 				milestone = id;
 			}
-		} else if (localname.equals(wordTag)) {
+		}
+		else if (localname.equals(wordTag)) {
 			String id = "";
-			for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+			for (int i = 0; i < parser.getAttributeCount(); i++) {
 				if (parser.getAttributeLocalName(i).equals("id")) {
 					id = parser.getAttributeValue(i);
 					break;
 				}
 			}
-
+			
 			// load next data if needed
-			String img_file_name = textname+"_"+milestone+"-links.xml";
+			String img_file_name = textname + "_" + milestone + "-links.xml";
 			if (!current_img_file.equals(img_file_name)) { // rebuild hashmaps
-				String zone_file_name = textname+"_"+milestone+"-zones.xml";
+				String zone_file_name = textname + "_" + milestone + "-zones.xml";
 				loadNextData(img_file_name, zone_file_name);
 			}
-
-			//			println "Find coords for word_id="+id+" in "+img_file_name+" and "+zone_file_name
-			//			println "zone: "+links[id]
-			//			println "coords: "+zones[links[id]]
+			
+			// println "Find coords for word_id="+id+" in "+img_file_name+" and "+zone_file_name
+			// println "zone: "+links[id]
+			// println "coords: "+zones[links[id]]
 			if (zones.size() > 0 && links.size() > 0) {
 				String[] coords = zones.get(links.get(id));
 				if (coords != null) {
 					if (coords[0] == null || coords[1] == null || coords[2] == null || coords[3] == null) {
-						System.out.println("WARNING one of coordinates is missing: "+coords);
-					} else {
+						System.out.println("WARNING one of coordinates is missing: " + coords);
+					}
+					else {
 						try {
 							writer.writeAttribute("x1", coords[0]);
 							writer.writeAttribute("y1", coords[1]);
 							writer.writeAttribute("x2", coords[2]);
 							writer.writeAttribute("y2", coords[3]);
-						} catch (XMLStreamException e) {
+						}
+						catch (XMLStreamException e) {
 							// TODO Auto-generated catch block
 							e.printStackTrace();
 						}
 					}
-				} else {
-					System.out.println("WARNING No group for word id="+id+" and link id="+links.get(id)+" in text "+textname);
 				}
+				else {
+					System.out.println("WARNING No group for word id=" + id + " and link id=" + links.get(id) + " in text " + textname);
+				}
 			}
 		}
 	}
-
+	
 	protected void loadNextData(String img_file_name, String zone_file_name) {
 		File img_link_file = new File(img_links_directory, img_file_name);
 		File zone_file = new File(zones_directory, zone_file_name);
-
+		
 		zones.clear();
 		links.clear();
 		if (zone_file.exists()) {
 			StaxParser pZones = new StaxParser(zone_file) {
-						public void processStartElement() {
-							if (localname.equals("zone")) {
-								String type = "";
-								String idZone = "";
-								String ulx = "", uly = "", lrx = "", lry = "";
-
-								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-									if (parser.getAttributeLocalName(i).equals("id")) {
-										idZone = parser.getAttributeValue(i);
-									} else if (parser.getAttributeLocalName(i).equals("type")) {
-										type = parser.getAttributeValue(i);
-									} else if (parser.getAttributeLocalName(i).equals("ulx")) {
-										ulx = parser.getAttributeValue(i);
-									} else if (parser.getAttributeLocalName(i).equals("uly")) {
-										uly = parser.getAttributeValue(i);
-									} else if (parser.getAttributeLocalName(i).equals("lrx")) {
-										lrx = parser.getAttributeValue(i);
-									} else if (parser.getAttributeLocalName(i).equals("lry")) {
-										lry = parser.getAttributeValue(i);
-									}
-								}
-
-								if (type.equals(xmlType)) {
-									zones.put(idZone, new String[]{ulx, uly, lrx, lry});
-								}
-
+				
+				@Override
+				public void processStartElement() {
+					if (localname.equals("zone")) {
+						String type = "";
+						String idZone = "";
+						String ulx = "", uly = "", lrx = "", lry = "";
+						
+						for (int i = 0; i < parser.getAttributeCount(); i++) {
+							if (parser.getAttributeLocalName(i).equals("id")) {
+								idZone = parser.getAttributeValue(i);
 							}
+							else if (parser.getAttributeLocalName(i).equals("type")) {
+								type = parser.getAttributeValue(i);
+							}
+							else if (parser.getAttributeLocalName(i).equals("ulx")) {
+								ulx = parser.getAttributeValue(i);
+							}
+							else if (parser.getAttributeLocalName(i).equals("uly")) {
+								uly = parser.getAttributeValue(i);
+							}
+							else if (parser.getAttributeLocalName(i).equals("lrx")) {
+								lrx = parser.getAttributeValue(i);
+							}
+							else if (parser.getAttributeLocalName(i).equals("lry")) {
+								lry = parser.getAttributeValue(i);
+							}
 						}
-					};
+						
+						if (type.equals(xmlType)) {
+							zones.put(idZone, new String[] { ulx, uly, lrx, lry });
+						}
+						
+					}
+				}
+			};
 			pZones.process();
 		}
 		if (img_link_file.exists()) {
 			StaxParser pLinks = new StaxParser(img_link_file) {
-						public void processStartElement() {
-							if (localname.equals("linkGrp")) {
-								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-									if (parser.getAttributeLocalName(i).equals("type")) {
-										group = parser.getAttributeValue(i);
-										break;
-									}
-								}
-							} else if (localname.equals("link") && group.startsWith(xmlType)) {
-								String target = "";
-
-								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
-									if (parser.getAttributeLocalName(i).equals("target")) {
-										target = parser.getAttributeValue(i);
-										break;
-									}
-								}
-
-								String[] split = target.split(" ");
-								links.put(split[0].substring(4), split[1].substring(4));
+				
+				@Override
+				public void processStartElement() {
+					if (localname.equals("linkGrp")) {
+						for (int i = 0; i < parser.getAttributeCount(); i++) {
+							if (parser.getAttributeLocalName(i).equals("type")) {
+								group = parser.getAttributeValue(i);
+								break;
 							}
 						}
-					};
+					}
+					else if (localname.equals("link") && group.startsWith(xmlType)) {
+						String target = "";
+						
+						for (int i = 0; i < parser.getAttributeCount(); i++) {
+							if (parser.getAttributeLocalName(i).equals("target")) {
+								target = parser.getAttributeValue(i);
+								break;
+							}
+						}
+						
+						String[] split = target.split(" ");
+						links.put(split[0].substring(4), split[1].substring(4));
+					}
+				}
+			};
 			pLinks.process();
 		}
-		//println "zones size: "+zones.size()
-		//println "links size: "+links.size()
-
+		// println "zones size: "+zones.size()
+		// println "links size: "+links.size()
+		
 		current_img_file = img_file_name;
 	}
-
+	
 	public static void main(String[] args) {
 		File corpusDirectory = new File("/home/mdecorde/TEMP/testori/FontenatTestAlignement");
 		File xmlFile = new File(corpusDirectory, "txm/FontenayTest-w/FontenayTest-w.xml");
 		File img_links_directory = new File(corpusDirectory, "img_links");
 		File zones_directory = new File(corpusDirectory, "zones");
-
+		
 		File outputFile = new File(corpusDirectory, "txm/FontenayTest-w/FontenayTest-w-coords2.xml");
-
+		
 		CoordsProjection cp;
 		try {
 			cp = new CoordsProjection(xmlFile, img_links_directory, zones_directory, "w");
 			System.out.println(cp.process(outputFile));
-		} catch (IOException e) {
+		}
+		catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		} catch (XMLStreamException e) {
+		}
+		catch (XMLStreamException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
Index: tmp/org.txm.utils/src/org/txm/utils/FileUtils.java
===================================================================
--- tmp/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 0)
+++ tmp/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 2984)
@@ -0,0 +1,47 @@
+package org.txm.utils;
+
+import java.io.File;
+
+import org.apache.commons.io.FilenameUtils;
+
+public class FileUtils {
+
+	public static boolean isExtension(File f, String ext) {
+		return FilenameUtils.isExtension(f.getName().toLowerCase(), ext.toLowerCase());
+	}
+
+	public static boolean isExactlyExtension(File f, String ext) {
+		return FilenameUtils.isExtension(f.getName(), ext);
+	}
+
+	public static boolean isXMLFile(File f) {
+		return isExtension(f, "xml");
+	}
+
+	public static boolean isTXTFile(File f) {
+		return isExtension(f, "txt");
+	}
+
+	public static boolean isXSLFile(File f) {
+		return isExtension(f, "xsl");
+	}
+
+	public static boolean isJARFile(File f) {
+		return isExtension(f, "jar");
+	}
+
+	public static String getExtension(File f) {
+		return FilenameUtils.getExtension(f.getName());
+	}
+
+	public static String stripExtension(File f) {
+		return FilenameUtils.getBaseName(f.getName());
+	}
+
+	public static void main(String[] args) {
+		File f = new File("test.gz.Txt");
+		System.out.println("base=" + stripExtension(f));
+		System.out.println("ext=" + getExtension(f));
+		System.out.println("is txt=" + isExtension(f, "txt"));
+	}
+}

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

Index: tmp/org.txm.core/src/java/org/txm/scripts/importer/WriteIdAndNAttributesUltraGeneric.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/scripts/importer/WriteIdAndNAttributesUltraGeneric.groovy	(revision 2983)
+++ tmp/org.txm.core/src/java/org/txm/scripts/importer/WriteIdAndNAttributesUltraGeneric.groovy	(revision 2984)
@@ -3,10 +3,10 @@
 import org.txm.importer.StaxIdentityParser
 
 class WriteIdAndNAttributesUltraGeneric extends StaxIdentityParser {
-
+	
 	String baseID = ""
 	def rules = [];
-
+	
 	def idCounters = [:]
 	def nCounters = [:]
 	def parentIds = [:]
@@ -26,7 +26,9 @@
 		this.elementResets = elementResets
 		
 		this.baseID = xmlFile.getName();
-		if (baseID.indexOf(".") > 0) baseID = baseID.substring(0, baseID.indexOf("."))
+		if (baseID.indexOf(".") > 0) {
+			baseID = baseID.substring(0, baseID.indexOf("."))
+		}
 		
 		for (String element : elements) {
 			idCounters[element] = 1;
@@ -34,7 +36,7 @@
 			parentIds[element] = null;
 		}
 	}
-
+	
 	/**
 	 * Special rule to add @corresp=#ref to its reference element to element which @attribute=@value
 	 */
@@ -46,7 +48,7 @@
 		if (!idCounters.containsKey(localname) ) {
 			super.writeAttributes();
 			return;
-		} 
+		}
 		println "write attributes $localname"
 		boolean idFound = false
 		boolean nFound = false
@@ -63,7 +65,7 @@
 			if ("id" == name) {
 				if (value == null) {
 					value = getNextID()
-				} 
+				}
 				
 				parentIds[localname] = value
 			} else if ("n" == name) {
@@ -116,7 +118,7 @@
 			value += "_"+parentIds[parent]
 		else
 			value += "_"+baseID
-			
+		
 		value += "-"+idCounters[localname]
 		
 		return value
@@ -132,12 +134,17 @@
 		File xmlFile = new File("/home/mdecorde/TEMP/idnmissing.xml")
 		File outFile = new File("/home/mdecorde/TEMP/idnmissing-fix.xml")
 		
-		WriteIdAndNAttributesUltraGeneric wiana = new WriteIdAndNAttributesUltraGeneric(xmlFile, 
-			["milestone", "pb", "cb", "lb"],
-			["milestone":"unit=surface", "pb":null, "cb":null, "lb":null],
-			["milestone":"surf", "pb":"page", "cb":"col", "lb":"line"], 
-			["milestone":null, "pb":null, "cb":"pb", "lb":"cb"],
-			["milestone":[], "pb":["cb", "lb"], "cb":[ "lb"], "lb":[]])
+		WriteIdAndNAttributesUltraGeneric wiana = new WriteIdAndNAttributesUltraGeneric(xmlFile,
+				[
+					"milestone",
+					"pb",
+					"cb",
+					"lb"
+				],
+				["milestone":"unit=surface", "pb":null, "cb":null, "lb":null],
+				["milestone":"surf", "pb":"page", "cb":"col", "lb":"line"],
+				["milestone":null, "pb":null, "cb":"pb", "lb":"cb"],
+				["milestone":[], "pb":["cb", "lb"], "cb":["lb"], "lb":[]])
 		println wiana.process(outFile)
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 2983)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 2984)
@@ -489,7 +489,7 @@
 	/**
 	 * Loads and creates the persisted results from the preferences service.
 	 */
-	public void loadResults(Class clazz) {
+	public void loadResults(Class<? extends TXMResult> clazz) {
 		
 		Log.finest("*** Project.loadResults(): reloading project persitent results...");
 		
Index: tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Apply.java
===================================================================
--- tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Apply.java	(revision 2983)
+++ tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Apply.java	(revision 2984)
@@ -22,6 +22,7 @@
 import org.txm.importer.xmltxm.Annotate;
 import org.txm.searchengine.cqp.corpus.CQPCorpus;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.FileUtils;
 
 /**
  * Our sample handler extends AbstractHandler, an IHandler base class.
@@ -46,6 +47,7 @@
 	/**
 	 * 
 	 */
+	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		CQPCorpus corpus = null;
 		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
@@ -88,14 +90,14 @@
 			System.out.println("Can't apply TreeTagger to a corpus with no XML-TXM files in " + txmDirectory);
 		}
 		
-		String lang = model.getName();
-		if (!lang.endsWith(".par")) {
+		if (!FileUtils.isExtension(model, "par")) {
 			System.out.println("Model file name must ends with the '.par' extension");
 			return;
 		}
-		lang = lang.substring(0, lang.lastIndexOf(".par"));
 		
-		final HashMap<String, String> hash = new HashMap<String, String>();
+		String lang = FileUtils.stripExtension(model);
+		
+		final HashMap<String, String> hash = new HashMap<>();
 		for (File txmFile : files) {
 			hash.put(txmFile.getName(), lang);
 		}
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy	(revision 2984)
@@ -7,6 +7,7 @@
 import org.txm.rcp.swt.widget.parameters.*
 
 import org.txm.scripts.importer.*
+import org.txm.utils.FileUtils
 import org.txm.metadatas.Metadatas
 
 // BEGINNING OF PARAMETERS
@@ -64,12 +65,13 @@
 files.sort()
 
 for (File xmlFile : files) {
-	String name = xmlFile.getName();
-	if (!name.endsWith(".xml")) continue;
 	
+	if (!FileUtils.isXMLFile(xmlFile)) continue;
+	
 	println "Processing file $xmlFile..."
-	name = name.substring(0, name.lastIndexOf(".xml"))
 	
+	String name = FileUtils.stripExtension(xmlFile);
+	
 	writer.print "$name"
 	
 	XPathResult xpathProcessor = new XPathResult(xmlFile)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/ForceWordIDsMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/ForceWordIDsMacro.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/xml/ForceWordIDsMacro.groovy	(revision 2984)
@@ -6,6 +6,7 @@
 // STANDARD DECLARATIONS
 package org.txm.macro.xml
 
+import org.txm.utils.FileUtils;
 import org.kohsuke.args4j.*
 import groovy.transform.Field
 import org.txm.rcpapplication.swt.widget.parameters.*
@@ -33,10 +34,7 @@
 outputFile.getParentFile().mkdirs()
 
 // build text id
-textid = inputFile.getName()
-if (textid.lastIndexOf(".xml") > 0) {
-	textid = textid.substring(0, textid.lastIndexOf(".xml"))
-}
+textid = FileUtils.stripExtension(inputFile)
 
 def parser = new StaxIdentityParser(inputFile) {
 	
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/utils/ApplyPropertiesMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/utils/ApplyPropertiesMacro.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/utils/ApplyPropertiesMacro.groovy	(revision 2984)
@@ -7,6 +7,7 @@
 import org.kohsuke.args4j.*
 import groovy.transform.Field
 import org.txm.rcpapplication.swt.widget.parameters.*
+import org.txm.utils.FileUtils
 import org.txm.utils.Timer
 
 @Field @Option(name="propertiesFile", usage="properties parameter file", widget="File", required=true, def="")
@@ -30,8 +31,7 @@
 	return 1
 }
 
-macro = macroFile.getName()
-macro = macro.substring(0, macro.lastIndexOf(".groovy"))
+macro = FileUtils.stripExtension(macroFile);
 
 pkg = macroFile.getParentFile().getAbsolutePath()
 pkg = pkg.substring(pkg.indexOf("scripts/groovy/user/")+"scripts/groovy/user/".length())
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 2984)
@@ -86,7 +86,7 @@
 	if (currentXMLFile.isHidden()) continue;
 	
 	String textid = currentXMLFile.getName();
-	int idx = textid.indexOf(".")
+	int idx = textid.lastIndexOf(".")
 	if (idx > 0) textid = textid.substring(0, idx);
 	
 	if (injections.containsKey(textid)) {	
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/doc/DocumentToTei.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/doc/DocumentToTei.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/doc/DocumentToTei.groovy	(revision 2984)
@@ -28,9 +28,12 @@
 package org.txm.scripts.doc
 
 import java.io.File;
+
 import org.txm.importer.ApplyXsl2;
 import org.txm.importer.ConvertDocument;
 import org.txm.utils.zip.Zip
+import org.txm.utils.FileUtils
+
 /**
  * The Class DocumentToTei.
  */
@@ -50,8 +53,8 @@
 		for (File file : files) {
 			print "."
 			String name = file.getName();
-			if (file.getName().endsWith(".odt")) {
-				name = name.substring(0, name.lastIndexOf(".odt"));
+			if (FileUtils.isExtension(file, "odt")) {
+				name = FileUtils.stripExtension(file);
 				File teifile = new File(outdir, name+".xml");
 				try {
 					if (!new DocumentToTei().run(file, xslOdtTei, teifile)) {
@@ -60,8 +63,8 @@
 						//						break;
 					}
 				} catch(Exception e) { println "ODT to TEI failed: $file: $e"; }
-			} else if (file.getName().endsWith(".docx")) {
-				name = name.substring(0, name.lastIndexOf(".docx"));
+			} else if (FileUtils.isExtension(file, "docx")) {
+				name = FileUtils.stripExtension(file);
 				File teifile = new File(outdir, name+".xml");
 				File odtFile = File.createTempFile("workflowdocx", "sfsdf.odt", outdir);
 				
@@ -79,8 +82,8 @@
 					if (converter != null) converter.stop();
 				}
 				
-			} else if (file.getName().endsWith(".doc")) {
-				name = name.substring(0, name.lastIndexOf(".doc"));
+			} else if (FileUtils.isExtension(file, "doc")) {
+				name = FileUtils.stripExtension(file);
 				File teifile = new File(outdir, name+".xml");
 				File odtFile = File.createTempFile("workflowdoc", "sfsdf.odt", outdir);
 				
@@ -89,7 +92,7 @@
 					converter.setDebug(DEBUG)
 					converter.autoFile(file, odtFile, "odt")
 					if (!new DocumentToTei().run(odtFile, xslOdtTei, teifile)) {
-						println "Doc to ODT to TEI failed: "+file
+						println "DOC to ODT to TEI failed: "+file
 						odtFile.delete();
 					}
 				} catch(Exception e) { println "DOC to ODT to TEI failed: $file: $e"; }
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/i18n/ExternalizeStringFile.groovy	(revision 2984)
@@ -77,7 +77,7 @@
 	private int processSourceFile(File sourceFile, boolean processMode) {
 		
 		prefix = sourceFile.getName();
-		prefix = prefix.substring(0, prefix.indexOf("."))+"_" ;
+		prefix = prefix.substring(0, prefix.lastIndexOf("."))+"_" ;
 		iprefix = 0;
 		
 		reader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), "UTF-8"));
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/swb/FixEditionPageIds.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/swb/FixEditionPageIds.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/swb/FixEditionPageIds.groovy	(revision 2984)
@@ -1,64 +1,61 @@
 package org.txm.scripts.scripts
 
-import org.txm.utils.xml.DomUtils;
+import org.txm.utils.xml.DomUtils
 
 String corpus = "qgraal"
-File PARAMS = new File("/home/mdecorde/TXM/corpora/$corpus/import.xml")
-File PARAMS2 = new File("/home/mdecorde/TXM/corpora/$corpus/params2.xml")
-File HTMLs = new File("/home/mdecorde/TXM/corpora/$corpus/HTML/QGRAALFRO")
+String home = System.getProperty("user.home")
+File PARAMS = new File("$home/TXM/corpora/$corpus/import.xml")
+File PARAMS2 = new File("$home/TXM/corpora/$corpus/params2.xml")
+File HTMLs = new File("$home/TXM/corpora/$corpus/HTML/QGRAALFRO")
 
 def doc = DomUtils.load(PARAMS)
-def root = doc.getDocumentElement();
+def root = doc.getDocumentElement()
 
-def corporaList = root.getElementsByTagName("corpora");
+def corporaList = root.getElementsByTagName("corpora")
 def corporaElem = corporaList.item(0)
 
-def corpusList = corporaElem.getElementsByTagName("corpus");
+def corpusList = corporaElem.getElementsByTagName("corpus")
 def corpusElem = corpusList.item(0)
 
 def textsList = corpusElem.getElementsByTagName("texts")
 def textsElem = textsList.item(0);
 
 def textList = textsElem.getElementsByTagName("text")
-for(int i = 0 ; i < textList.getLength() ; i++)
-{
+for (int i = 0 ; i < textList.getLength() ; i++) {
 	def textElem = textList.item(i)
-	String textname = textElem.getAttribute("name");
+	String textname = textElem.getAttribute("name")
 	println "process text: "+textname
 	def editionsList = textElem.getElementsByTagName("editions")
 	def editionsElem = editionsList.item(0)
 
 	def editionList = editionsElem.getElementsByTagName("edition")
 
-	for(int j = 0 ; j < editionList.getLength() ; j++)
-	{
+	for (int j = 0 ; j < editionList.getLength() ; j++) {
 		def editionElem = editionList.item(j)
-		String editionName = editionElem.getAttribute("name");
+		String editionName = editionElem.getAttribute("name")
 
-		def pages = new File(HTMLs, editionName).listFiles();
-		pages.sort();
+		def pages = new File(HTMLs, editionName).listFiles()
+		pages.sort()
 
 		def pageList = editionElem.getElementsByTagName("page")
 		println pageList.getLength()
 		println pages.size()
-		for(int k = 0 ; k < pageList.getLength() ; k++)
-		{
-			def pageElem = pageList.item(k);
-			String id = pages[k].getName();
-			int idx1 = id.lastIndexOf("_");
-			int idx2 = id.lastIndexOf(".html");
+		for (int k = 0 ; k < pageList.getLength() ; k++) {
+			def pageElem = pageList.item(k)
+			String id = pages[k].getName()
+			int idx1 = id.lastIndexOf("_")
+			int idx2 = id.lastIndexOf(".html")
 			id = id.substring(idx1 + 1, idx2)
-			pageElem.setAttribute("id", id);
+			pageElem.setAttribute("id", id)
 		}
 
-		if(pageList.getLength() != pages.size())
-		{
+		if (pageList.getLength() != pages.size()) {
 			println "Error size pageList.getLength() != pages.size()"+pageList.getLength()+", "+pages.size()
 		}
 	}
 }
 
-DomUtils.save(doc, PARAMS2);
+DomUtils.save(doc, PARAMS2)
 
 if (!(PARAMS.delete() && PARAMS2.renameTo(PARAMS))) println "Warning can't rename file "+PARAMS2+" to "+PARAMS
 
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/tmxLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/tmxLoader.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/tmxLoader.groovy	(revision 2984)
@@ -136,9 +136,7 @@
 
 		for (File txmFile : txmFiles) {
 			print "."
-			String txtname = txmFile.getName();
-			int i = txtname.lastIndexOf(".xml");
-			if(i > 0) txtname = txtname.substring(0, i);
+			String txtname = FileUtils.stripExtension(txmFile);
 
 			//println ""+srcfile.getName()+" -> "+splitTUsPerText[txtname]
 			def splitTUs = splitTUsPerText[txtname];
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/compiler.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/compiler.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/compiler.groovy	(revision 2984)
@@ -36,6 +36,7 @@
 import org.txm.scripts.importer.*;
 import org.txm.scripts.*;
 import org.txm.importer.scripts.xmltxm.*;
+import org.txm.utils.FileUtils;
 import org.txm.utils.logger.Log;
 import org.txm.utils.treetagger.TreeTagger;
 import org.txm.objects.*;
@@ -511,8 +512,7 @@
 				filename = filename.substring(0, filename.length()-4);
 				counttext++;
 
-				String txtname = f.getName();
-				txtname = txtname.substring(0, txtname.lastIndexOf(".xml"));
+				String txtname = FileUtils.stripExtension(f);
 				seg_id = segs_id.get(group);
 				builder = new compiler(f.toURI().toURL(), txtname, basename, "default", tuprops);
 				builder.transfomFileCqp(rootDir+"/cqp",cqpName+".cqp");
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/importer.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/importer.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/importer.groovy	(revision 2984)
@@ -122,9 +122,7 @@
 		ConsoleProgressBar cpb = new ConsoleProgressBar(trsfiles.size())
 		for (File infile : trsfiles) {
 			cpb.tick()
-			String textid = infile.getName()
-			int idx = textid.lastIndexOf(".trs")
-			if (idx > 0) textid = textid.substring(0, idx)
+			String textid = FileUtils.stripExtension(infile);
 			File outfile = new File(txmDir, textid+".xml")
 			TRSToTEI p = new TRSToTEI(infile);
 			if (!p.process(outfile)) {
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 2984)
@@ -220,11 +220,8 @@
 			} else {
 				println "Removing some speakers in "+txmDir.listFiles().length+" file(s)"
 				for (File infile : txmDir.listFiles()) {
-					String filename = infile.getName();
-					int idx = filename.lastIndexOf(".xml");
-					if (idx > 0)
-						filename = filename.substring(0, idx);
-
+					String filename = FileUtils.stripExtension(infile);
+					
 					ArrayList<Pair<String, String>> metas = metadatas.get(filename)
 					//println "filename=$filename metas= $metas"
 					for (Pair p : metas) {
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy	(revision 2984)
@@ -13,6 +13,7 @@
 import org.txm.importer.cwb.CwbMakeAll
 import org.txm.importer.cwb.CwbProcess;
 import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.utils.FileUtils;
 import org.txm.utils.Pair;
 
 class TRSToTEI extends StaxIdentityParser {
@@ -57,9 +58,7 @@
 	String textid;
 	public TRSToTEI(File infile) {
 		super(infile.toURI().toURL());
-		textid = infile.getName()
-		int idx = textid.lastIndexOf(".trs")
-		if (idx > 0) textid = textid.substring(0, idx)
+		textid = FileUtils.stripExtension(infile)
 	}
 
 	boolean beforeBody = true;
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/importer.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/importer.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/importer.groovy	(revision 2984)
@@ -79,7 +79,7 @@
 		List<File> srcfiles = DeleteDir.scanDirectory(srcDir, true, false)
 		for (int i = 0; i < srcfiles.size(); i++) {
 			File srcfile = srcfiles.get(i);
-			int point = srcfile.getName().indexOf(".");
+			int point = srcfile.getName().lastIndexOf(".");
 			String filename, fileext;
 			if (point >= 1 && point < srcfile.getName().length()) {
 				filename = srcfile.getName().substring(0, point)
@@ -120,7 +120,7 @@
 			cpb.tick()
 			File xmlfile;
 			try {
-				int point = srcfile.getName().indexOf(".");
+				int point = srcfile.getName().lastIndexOf(".");
 				String filename;
 				String fileext;
 				if (point >= 1 && point < srcfile.getName().length() ) {
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 2983)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 2984)
@@ -8,6 +8,7 @@
 
 import org.txm.scripts.importer.*
 import org.txm.utils.ConsoleProgressBar
+import org.txm.utils.FileUtils
 import org.txm.utils.BundleUtils;
 import org.txm.utils.io.FileCopy;
 import org.txm.utils.i18n.*
@@ -305,7 +306,7 @@
 				if (!xslFile.getName().matches("[1-9]{1,3}-.+")) continue;
 
 				String xslName = xslFile.getName().substring(2); // remove the "1-", "2-", etc.
-				int idx2 = xslName.indexOf(".")
+				int idx2 = xslName.lastIndexOf(".")
 				if (idx2 > 0) xslName = xslName.substring(0, idx2)
 				else {
 					println "$xslFile is not a '.xsl' file"
@@ -319,7 +320,7 @@
 				String pagerStep = xslName.substring(idx3 + 1);
 				String editionName = xslName.substring(0, idx3);
 
-				int idx = editionName.indexOf(".")
+				int idx = editionName.lastIndexOf(".")
 				if (idx > 0) editionName = editionName.substring(0, idx);
 				
 				names << editionName
@@ -361,7 +362,7 @@
 				if (!xslFile.getName().matches("[1-9]{1,3}-.+")) continue;
 
 				String xslName = xslFile.getName().substring(2); // remove the "1-", "2-", etc.
-				int idx2 = xslName.indexOf(".")
+				int idx2 = xslName.lastIndexOf(".")
 				if (idx2 > 0) xslName = xslName.substring(0, idx2)
 				else {
 					println "$xslFile is not a '.xsl' file"
@@ -375,7 +376,7 @@
 				String pagerStep = xslName.substring(idx3 + 1);
 				String editionName = xslName.substring(0, idx3);
 
-				int idx = editionName.indexOf(".")
+				int idx = editionName.lastIndexOf(".")
 				if (idx > 0) editionName = editionName.substring(0, idx);
 				println "-- Building '$editionName' XSL edition with step '$pagerStep'..."
 
@@ -439,7 +440,7 @@
 				for (File txmFile : inputDirectory.listFiles()) {
 					if (txmFile.isDirectory()) continue;
 					String textName = txmFile.getName()
-					int idx4 = textName.indexOf(".")
+					int idx4 = textName.lastIndexOf(".")
 					if (idx4 > 0) textName = textName.substring(0, idx4);
 
 					getFirstWordIDs(textName, editionName, newEditionDirectory, xslFile, txmFile);
@@ -490,8 +491,8 @@
 			String pagename = f.getName();
 			if (pagename.startsWith(textName+"_")) { // this is a page
 				String firstWordID = getMetaContent(f);
-				pagename = pagename.substring((textName+"_").length(), pagename.lastIndexOf(".html")) // !!!!
-				edition.addPage(pagename, firstWordID)
+				pagename = FileUtils.stripExtension(f);
+				edition.addPage(pagename, firstWordID);
 			}
 		}
 	}
Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java	(revision 2983)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java	(revision 2984)
@@ -29,6 +29,7 @@
 import org.apache.poi.util.SystemOutLogger;
 import org.txm.rcp.translate.devtools.NormalizeKeys;
 import org.txm.utils.BiHashMap;
+import org.txm.utils.FileUtils;
 import org.txm.utils.io.IOUtils;
 
 /**
@@ -204,11 +205,10 @@
 			
 			File[] propFiles = javaMessageFile.getParentFile().listFiles(IOUtils.HIDDENFILE_FILTER);
 			for (File propFile : propFiles) {
-				String name = propFile.getName();
-				if (!name.endsWith(".properties")) continue;
-				// messages.properties
-				// messages_xx.properties
-				String lang = name.substring(8, name.lastIndexOf(".properties"));
+				if (!FileUtils.isExactlyExtension(propFile, "properties")) continue;
+				
+				// messages.properties, messages_xx.properties
+				String lang = FileUtils.stripExtension(propFile);
 				langs.put(propFile, new HashMap<String, String>());
 				file2lang.put(propFile, lang);
 				
@@ -689,17 +689,18 @@
 					newPropFile = propFile;
 				}
 				if (propFile.getName().contains("_ru.properties")) {
-					utf8fixes= true;
-					cmds.append("native2ascii "+newPropFile+" > "+newPropFile+".tmp\n");
-					cmds.append("rm "+newPropFile+"\n");
-					cmds.append("mv "+newPropFile+".tmp "+newPropFile+"\n");
+					utf8fixes = true;
+					cmds.append("native2ascii " + newPropFile + " > " + newPropFile + ".tmp\n");
+					cmds.append("rm " + newPropFile + "\n");
+					cmds.append("mv " + newPropFile + ".tmp " + newPropFile + "\n");
 					props.store(IOUtils.getWriter(newPropFile, "UTF-8"), "TXM OSGI messages generated by the PluginMessagesManager class");
-				} else {
+				}
+				else {
 					props.store(IOUtils.getWriter(newPropFile, "ISO-8859-1"), "TXM OSGI messages generated by the PluginMessagesManager class");
 				}
 			}
 			if (utf8fixes) {
-				//System.out.println("WARNING: need to call: ");
+				// System.out.println("WARNING: need to call: ");
 				System.out.println(cmds.toString());
 			}
 		}
Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/ExternalizeStringFile.groovy
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/ExternalizeStringFile.groovy	(revision 2983)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/ExternalizeStringFile.groovy	(revision 2984)
@@ -12,19 +12,19 @@
  * @author mdecorde
  */
 class ExternalizeStringFile {
-
+	
 	File propFile;
 	File messageFile
-
+	
 	PluginMessagesManager dict
-
+	
 	String prefix
 	int iprefix = 0;
 	
 	boolean mustSaveChanges = false;
-
+	
 	public ExternalizeStringFile(File propFile, File messageFile) {
-		dict = new PluginMessagesManager(propFile, messageFile);		
+		dict = new PluginMessagesManager(propFile, messageFile);
 	}
 	
 	private ArrayList<String> getLineStrings(String l) {
@@ -63,10 +63,10 @@
 	String previousLine;
 	boolean ignore = false;
 	int nline = 1;
-
+	
 	def nlserrors = []
 	def linesToWrite = []
-
+	
 	int nTotalChanges = 0;
 	
 	def strings;
@@ -77,7 +77,7 @@
 	private int processSourceFile(File sourceFile, boolean processMode) {
 		
 		prefix = sourceFile.getName();
-		prefix = prefix.substring(0, prefix.indexOf("."))+"_" ;
+		prefix = prefix.substring(0, prefix.lastIndexOf("."))+"_" ;
 		iprefix = 0;
 		
 		reader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), "UTF-8"));
@@ -85,10 +85,10 @@
 		previousLine;
 		ignore = false;
 		nline = 1;
-
+		
 		nlserrors = []
 		linesToWrite = []
-
+		
 		nTotalChanges = 0;
 		
 		while (line != null) {
@@ -97,10 +97,9 @@
 				if (l.startsWith("*/") || l.endsWith("*/")) {
 					ignore = false
 				} else if (l.startsWith("*")) {
-
 				} else {
-//					println "ERROR LINE $nline : not a comment ? "+l
-//					return -1;
+					//					println "ERROR LINE $nline : not a comment ? "+l
+					//					return -1;
 				}
 			} else {
 				if (l.startsWith("//")) {
@@ -115,24 +114,24 @@
 					nonnls = getNONNLS(l);
 					toExternalize = []
 					toNLSize = []
-
+					
 					// fix NON-NLS
 					if (nonnls.size() > 0 && nonnls.size() != strings.size()) {
 						println "NLS error line $nline: "+l
 						nlserrors << nline
 					}
-
+					
 					if (nlserrors.size() == 0) {
 						for (int i = 0 ; i < strings.size() ; i++) {
 							if (nonnls.contains(i)) continue; // ignore
-
+							
 							if (strings[i] == "\"\"" || strings[i] == "\" \"" || strings[i] == "\"\\n\"") {
 								toNLSize << i;
 							} else {
 								toExternalize << i
 							}
 						}
-
+						
 						if (processMode) {
 							nTotalChanges += processLine();
 						} else {
@@ -141,13 +140,13 @@
 					}
 				}
 			}
-
+			
 			linesToWrite << line
 			previousLine = line;
 			line = reader.readLine();
 			nline++;
 		}
-
+		
 		if (nlserrors.size() > 0) {
 			println "NLS ERROR "+sourceFile.getName()+" lines $nlserrors"
 			return -1;
@@ -196,7 +195,7 @@
 					} else {
 						println " add new key: $key"
 						dict.put(key, value);
-
+						
 						String p1 = line.substring(0, ichar);
 						String p2 = line.substring(ichar+strings[i].length(), line.length())
 						String str = "Messages."+key
@@ -216,14 +215,14 @@
 		}
 		return nChanges;
 	}
-
+	
 	private def getNONNLS(String l) {
 		def idx = []
 		def m = l =~ /\/\/.NON-NLS-[0-9]\$/
 		m.each { idx << Integer.parseInt(it[11])-1 }
 		return idx.sort()
 	}
-
+	
 	private def getNextKey() {
 		String tmp = prefix+(iprefix++);
 		while (dict.containsKey(tmp)) {
@@ -248,12 +247,12 @@
 		}
 		return false;
 	}
-
+	
 	public static void main(String[] args) {
 		File sourceFile = new File("/home/mdecorde/workspace37/org.txm.core/src/java/org/txm/functions/cooccurrences/Cooccurrence.java");
 		File propFile = new File("/home/mdecorde/workspace37/org.txm.core/src/java/org/txm/messages.properties")
 		File messageFile = new File("/home/mdecorde/workspace37/org.txm.core/src/java/org/txm/Messages.java")
-
+		
 		ExternalizeStringFile externalizer = new ExternalizeStringFile(propFile, messageFile)
 		println externalizer.getNbOfChanges(sourceFile);
 		println externalizer.process(sourceFile);
