Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy	(revision 2875)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompiler.groovy	(revision 2876)
@@ -6,6 +6,7 @@
 import org.txm.importer.SAttributesListener
 import org.txm.importer.cwb.*
 import org.txm.utils.ConsoleProgressBar
+import org.txm.utils.DeleteDir
 import org.txm.utils.logger.Log
 import org.txm.core.preferences.TXMPreferences
 import org.txm.core.preferences.TBXPreferences
@@ -47,31 +48,31 @@
 	 * the Text to process (dirty or newer than the cqp files) list
 	 */
 	def textsToProcess;
+	def initialTypesValues;
 	@Override
-	public void process(List<String> orderedTextIDs) {
-		super.process(orderedTextIDs); // set member
+	public void _process() {
 
 		if (orderedTextIDs == null) orderedTextIDs = module.getProject().getTextsID() ;
 
 		Project project = module.getProject();
-		
+
 		texts = orderedTextIDs.collect() { id -> module.getProject().getText(id) }
 		textsToProcess = getTextsToProcess(texts)
-		
+
 		// get all structures
 		sattrsListener = new SAttributesListener() // will store the structure and properties declaration
 		sattrsListener.W = wtag
+
+		File registryFile = new File(regPath)
 		
-//		File regFile = new File(regPath) // The properties recovery must be done using each Texts property declarations
-//		if (project.getDoUpdate() && regFile.exists() ) { // this optimisation must be done before clearing the corpus files
-//			println "Recovering structures&properties declaration from previous import registry file $regFile..."
-//			ReadRegistryFile rrf = new ReadRegistryFile(regFile);
-//			
-//			sattrsListener.initialize(rrf.getPAttributes(), rrf.getSAttributesMap(), rrf.getSAttributesProfs())
-//			
-//			System.out.println("	pAttributes: "+sattrsListener.getAnatypes());
-//			System.out.println("	sAttributes: "+sattrsListener.getStructs());
-//		}
+		initialTypesValues = new HashSet<String>()
+		if (registryFile.exists()) {
+			ReadRegistryFile rrf = new ReadRegistryFile(registryFile);
+			rrf.read()
+			initialTypesValues.addAll(rrf.getPAttributes())
+			initialTypesValues.remove("id")
+			initialTypesValues.remove("word")
+		}
 		
 		CorpusBuild corpus = project.getCorpusBuild(project.getName(), MainCorpus.class);
 		if (corpus != null) {
@@ -104,12 +105,13 @@
 	 */
 	public boolean doScanStep() {
 
-	
 		println "-- Scanning structures&properties to create for "+texts.size()+" texts..."
-		
-//		def initialTypesValues = new HashSet<String>()
-//		initialTypesValues.addAll(sattrsListener.getAnatypes())
-		
+
+
+
+		//		def initialTypesValues = new HashSet<String>()
+		//		initialTypesValues.addAll(sattrsListener.getAnatypes())
+
 		// get all word properties
 		ConsoleProgressBar cpb = new ConsoleProgressBar(texts.size())
 		for (Text t : texts) {
@@ -126,12 +128,16 @@
 				return false;
 			}
 		}
-		
-//		if (initialTypesValues != sattrsListener.getAnatypes()) { // the word properties changed all CQP files must be recreated
-//			textsToProcess.clear()
-//			textsToProcess.addAll(texts)
-//		}
-		
+
+		if (initialTypesValues.size() == sattrsListener.getAnatypes().size()
+			&& initialTypesValues.containsAll(sattrsListener.getAnatypes())) { // the word properties changed all CQP files must be recreated
+			// no new property
+		} else {
+			println "New word properties detected. All CQP files need to be updated"
+			textsToProcess.clear()
+			textsToProcess.addAll(texts)
+		}
+
 		println ""
 		return true;
 	}
@@ -153,21 +159,21 @@
 				Log.finer("skipping .cqp step of $text");
 				return false
 			}
-			
+
 			return true
 		}
-		
+
 		return textsToProcess
 	}
-	
+
 	def cqpFiles = [] // ordered cqp files to concat before calling cwb-encode
 	int cqpFilesUpdated = 0;
 	public boolean doCQPStep() {
-		
+
 		cqpDirectory.mkdir(); // if not created
 
 		println "-- Building CQP files ${textsToProcess.size()}/${texts.size()}..."
-		
+
 		ConsoleProgressBar cpb = new ConsoleProgressBar(textsToProcess.size())
 		cqpFilesUpdated = 0;
 		for (Text text : textsToProcess) {
@@ -177,7 +183,7 @@
 			String textname = text.getName()
 
 			File cqpFile = new File(cqpDirectory, textname + ".cqp")
-			
+
 			cqpFilesUpdated++
 
 			XTZCompilerStep step = new XTZCompilerStep(xmlFile, cqpFile, textname, corpusname, "default", sattrsListener.getAnatypes(), wtag)
@@ -194,6 +200,15 @@
 
 	public boolean doCWBEncodeStep() {
 		println "-- Running cwb-encode..."
+		
+		// clean directories
+		DeleteDir.deleteDirectory(outputDirectory);
+		outputDirectory.mkdirs();
+		dataDirectory.mkdirs();
+
+		DeleteDir.deleteDirectory(registryDirectory);
+		registryDirectory.mkdirs();
+		
 		CwbEncode cwbEn = new CwbEncode()
 		cwbEn.setDebug(debug)
 
@@ -203,7 +218,7 @@
 			if (ana == "id") continue; // no need to be added, we did it already
 			pargs.add(ana)
 		}
-			
+
 		String[] pAttrs = pargs
 
 		def structs = sattrsListener.getStructs()
@@ -218,7 +233,7 @@
 		def tmpTextAttrs = []
 		for (String name : structs.keySet()) {
 			if (name == "txmcorpus") continue;
-			
+
 			if (name == "text") {
 				for (String value : structs.get(name)) // append the attributes
 					tmpTextAttrs << value // added after
@@ -229,7 +244,7 @@
 			for (String attributeName : structs.get(name)) { // append the attributes
 				concat += "+"+attributeName.toLowerCase();
 			}
-			
+
 			if (structs.get(name).size() == 0) {
 				concat += "+n";
 			} else {
@@ -239,7 +254,7 @@
 			}
 
 			if ((name == "p" || name == "body" || name == "back" || name == "front")
-				&& !concat.contains("+n+") && !concat.endsWith("+n")) {
+			&& !concat.contains("+n+") && !concat.endsWith("+n")) {
 				concat += "+n"
 			}
 			sargs.add(concat)
@@ -270,9 +285,9 @@
 			}
 
 			new File(regPath).delete()// ensure the registry file is deleted
-			
+
 			if (!cwbEn.run(outputDirectory.getAbsolutePath() + "/$corpusname",
-				allcqpFile.getAbsolutePath(), regPath, pAttributes, sAttributes, false)) {
+			allcqpFile.getAbsolutePath(), regPath, pAttributes, sAttributes, false)) {
 				println "** cwb-encode did not ends well. Please activate a finer log level to see more details."
 				return false;
 			}
Index: tmp/org.txm.core/src/java/org/txm/importer/xtz/Compiler.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/xtz/Compiler.java	(revision 2875)
+++ tmp/org.txm.core/src/java/org/txm/importer/xtz/Compiler.java	(revision 2876)
@@ -1,7 +1,6 @@
 package org.txm.importer.xtz;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.txm.utils.DeleteDir;
@@ -12,11 +11,11 @@
  * @author mdecorde
  *
  */
-public class Compiler extends ImportStep {
+public abstract class Compiler extends ImportStep {
 
 	protected File cqpDirectory, registryDirectory, dataDirectory;
 	protected List<String> orderedTextIDs;
-	
+
 	/**
 	 * Creates the output directories
 	 * 
@@ -31,13 +30,6 @@
 		dataDirectory = new File(outputDirectory, module.getCorpusName());
 		registryDirectory = new File(module.getBinaryDirectory(), "registry");
 
-		DeleteDir.deleteDirectory(outputDirectory);
-		outputDirectory.mkdirs();
-		dataDirectory.mkdirs();
-		
-		DeleteDir.deleteDirectory(registryDirectory);
-		registryDirectory.mkdirs();
-		
 		if (!module.isUpdatingCorpus()) {
 			DeleteDir.deleteDirectory(cqpDirectory);
 		} 
@@ -48,13 +40,29 @@
 	public void cancel() {
 		// TODO Auto-generated method stub
 	}
+	
+	/**
+	 * implement this method to build CQP files, CQP data and registry file
+	 */
+	protected abstract void _process() ;
 
+	/**
+	 * called by ImportModule
+	 * 
+	 * @param orderedTextIDs
+	 */
 	@Override
 	public void process() {
-		process(null); // no default files order set
+		process(null);
 	}
 	
+	/**
+	 * called by ImportModule
+	 * 
+	 * @param orderedTextIDs
+	 */
 	public void process(List<String> orderedTextIDs) {
 		this.orderedTextIDs = orderedTextIDs;
+		_process();
 	}
 }
