Index: tmp/org.txm.core/src/java/org/txm/Toolbox.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 2242)
@@ -43,6 +43,7 @@
 import java.util.logging.Level;
 
 import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.internal.resources.Project;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -295,11 +296,8 @@
 
 		// loads and recreate the existing projects, loadParameters() needs engines to be ready
 		if (workspace != null) {
-			if (monitor != null) {
-				monitor.setTaskName(TXMCoreMessages.initializingCorpora);
-				monitor.subTask("");
-			}
-			workspace.loadProjectsFromProjectScopes();
+			workspace.loadProjectsFromProjectScopes(monitor);
+			monitor.subTask("");
 		} else {
 			System.out.println("Error: Toolbox not correctly initialized. Aborting workspace initialization.");
 		}
@@ -510,11 +508,12 @@
 			//				TXMPreferences.deleteAllResultsNodes();
 			//			}
 			// FIXME: other tmp solution
-			TXMResult.deleteAllNonPersistentResults();
+			//TODO iterates over opened projects to save them (not close); add this code to project.close
+			
 
-
 			// save projects parameters
 			if (Toolbox.workspace != null) {
+				TXMResult.deleteAllNonPersistentResults(Toolbox.workspace);
 				Toolbox.workspace.saveParameters(true);
 			}
 			Toolbox.workspace = null;
Index: tmp/org.txm.core/src/java/org/txm/scripts/importer/ReadImportParameters.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/scripts/importer/ReadImportParameters.groovy	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/scripts/importer/ReadImportParameters.groovy	(revision 2242)
@@ -247,7 +247,7 @@
 		}
 		
 		println "PROPERTIES"
-		println "metadatas $metadatas"
+		println "metadata $metadatas"
 		println " pattributes $pattributes"
 		println " sattributes $sattributes"
 		
Index: tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/messages.properties	(revision 2242)
@@ -252,4 +252,4 @@
 errorWhilePreInstallingPluginsP0=Error while pre-installing plugins: {0}
 loadingExtensionPostInstallation=Loading plug-in post-installation extensions...
 errorWhilePostInstallingPluginsP0=Error while post-installing plugins: {0}
-initializingCorpora=Initializing corpora...
+initializingCorpora=Initializing corpora ({0}/{1})...
Index: tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/core/messages/messages_fr.properties	(revision 2242)
@@ -249,4 +249,4 @@
 errorWhilePreInstallingPluginsP0=Erreur lors du pre-chargement des extensions : {0}
 loadingExtensionPostInstallation=Post-chargement des extensions...
 errorWhilePostInstallingPluginsP0=Erreur lors du post-chargement des extensions : {0}
-initializingCorpora=Initialisation des corpus...
\ No newline at end of file
+initializingCorpora=Initialisation des corpus ({0}/{1})...
\ No newline at end of file
Index: tmp/org.txm.core/src/java/org/txm/core/CorpusNature.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/CorpusNature.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/core/CorpusNature.java	(revision 2242)
@@ -3,9 +3,16 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectNature;
 import org.eclipse.core.runtime.CoreException;
-
+/**
+ * TXM corpus project nature
+ * 
+ * TODO use this class instead of Project.open/close stuff
+ * 
+ * @author mdecorde
+ *
+ */
 public class CorpusNature implements IProjectNature {
-
+	//
 	public static final String NATURE_ID = "org.txm.core.CorpusNature";
 	
 	/**
Index: tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 2242)
@@ -1157,6 +1157,13 @@
 	/**
 	 * print TxmPreferences in the console.
 	 */
+	public static Preferences getNode(String nodePath) {
+		return preferencesRootNode.node(nodePath);
+	}
+	
+	/**
+	 * print TxmPreferences in the console.
+	 */
 	public static void dump() {
 		try {
 			System.out.println("root:"); //$NON-NLS-1$
@@ -1548,6 +1555,9 @@
 		else if (Boolean.class.isInstance(value))	{
 			preferencesRootNode.node(nodePath).putBoolean(key, (Boolean) value);
 		}
+		else if (File.class.isInstance(value))	{
+			preferencesRootNode.node(nodePath).put(key, ((File) value).getPath()); // keep path as it is (relative or absolute)
+		}
 		else if (Serializable.class.isInstance(value))	{
 			try {
 				preferencesRootNode.node(nodePath).put(key, toString((Serializable)value));
Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 2242)
@@ -79,7 +79,7 @@
 	 * Results counter to create unique ids.
 	 */
 	private static int next = 0;
-	
+
 	/**
 	 * Editor can use this to test if the result has been computed once.
 	 */
@@ -95,7 +95,7 @@
 	 * like after updating parameters
 	 */
 	protected boolean dirty = true;
-	
+
 	/**
 	 * if a method changed the internal data without **recomputing** the result, the result must be marked "altered"
 	 */
@@ -137,7 +137,7 @@
 	 * Also permits to optimize computing by testing if a specific parameter value has changed since last computing and skip or not some computing steps. 
 	 */
 	protected ArrayList<HashMap<String, Object>> parametersHistory = new ArrayList<HashMap<String, Object>>();
-	
+
 	/**
 	 * Internal persistable state.
 	 */
@@ -179,13 +179,13 @@
 	 */
 	@Parameter(key=TXMPreferences.CREATION_DATE, type=Parameter.INTERNAL)
 	private Date creationDate;
-	
+
 	/**
 	 * If locked, the result is not updated when computed.
 	 */
 	@Parameter(key=TXMPreferences.LOCK, type=Parameter.INTERNAL)
-	protected boolean locked = false;
-	
+	protected Boolean locked = false;
+
 	/**
 	 * Current computing state.
 	 * True if the result is in the process of computing (is in compute(,) method)
@@ -226,7 +226,7 @@
 		}
 
 		// no parametersNodePath -> new result
-		
+
 		if (parametersNodePath == null)	{ // new object
 			if (this.getProject() != null) {
 				parametersNodePath = this.getProject().getParametersNodeRootPath();
@@ -234,7 +234,7 @@
 			else {
 				parametersNodePath = ""; //$NON-NLS-1$;
 			}
-			
+
 			this.parametersNodePath = parametersNodePath + createUUID() + "_" + this.getClass().getSimpleName(); //$NON-NLS-1$;
 		}
 		else	{
@@ -265,9 +265,9 @@
 				parent == null && 
 				this.parametersNodePath != null && 
 				!parentNodePath.isEmpty()) {
-			
+
 			Log.finest("Searching parent with UUID " + parentNodePath + "..."); //$NON-NLS-1$ //$NON-NLS-2$
-			
+
 			//TODO this is quite CPU expensive because 'retrievedParent' is researched in all projects
 			TXMResult retrievedParent = TXMResult.getResult(parentNodePath);
 			if (retrievedParent != null) {
@@ -280,7 +280,7 @@
 					TBXPreferences.delete(this);
 				}
 				catch(Exception e) {
-					
+
 				}
 				return;
 			}
@@ -290,7 +290,7 @@
 		try {
 			this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations
 			this.loadParameters(); // subclasses manual settings
-			
+
 			try {
 				if (creationDate == null) {
 					creationDate = Calendar.getInstance().getTime();
@@ -325,20 +325,34 @@
 	public boolean isAltered() {
 		return altered;
 	}
-	
+
 	/**
 	 * Mark the result as altered -> modifications are lost after a re-compute
 	 */
 	public void setAltered() {
 		this.altered = true;
 	}
-	
+
 	/**
+	 * Do something when project is closed
+	 */
+	public void onProjectClose() {
+
+	}
+
+	/**
+	 * Do something when project is opened
+	 */
+	public void onProjectOpen() {
+
+	}
+
+	/**
 	 * Locks/unlocks the result.
 	 */
 	public void setLocked(boolean state) {
 		this.locked = state;
-		
+
 		if (this.locked && this.parent != null) {
 			this.parent.setLocked(true);
 		}
@@ -348,14 +362,14 @@
 			}
 		}
 	}
-	
+
 	/**
 	 * @return true if the result is locked
 	 */
 	public boolean isLocked() {
 		return this.locked;
 	}
-	
+
 	/**
 	 * Creates an UUID dedicated to persistence of this result.
 	 * @return
@@ -365,7 +379,7 @@
 		//this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID();
 		return UUID_PREFIX + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + nextInt();
 	}
-	
+
 	/**
 	 * 
 	 * @return the next integer in the current session of TXM
@@ -557,7 +571,7 @@
 			}
 		}
 
-		
+
 		try {
 			if(this.getLastParametersFromHistory().isEmpty())	{
 				this.parametersHistory.remove(this.parametersHistory.size() - 1);
@@ -586,11 +600,11 @@
 	 * @return
 	 */
 	public boolean hasParameterChanged(String key, HashMap<String, Object> lastParameters) {
-		
+
 		if(lastParameters == null)	{
 			return true;
 		}
-		
+
 		if (key.isEmpty()) {
 			return false;
 		}
@@ -624,9 +638,9 @@
 		}
 
 		boolean hasParameterChanged = false;
-		
+
 		List<Field> fields = this.getAllFields();
-		
+
 		for (Field f : fields) {
 			Parameter parameter = f.getAnnotation(Parameter.class);
 			if (parameter == null || parameter.type() != parameterType) {
@@ -643,17 +657,17 @@
 			f.setAccessible(true); // to be able to test the field values
 
 			hasParameterChanged = this.hasParameterChanged(name, lastParameters);
-			
+
 			if (hasParameterChanged) {
 				Log.finest("TXMResult.hasParameterChanged(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed.");
 				break;
 			}
 		}
-		
+
 		return hasParameterChanged;
 	}
 
-	
+
 	/**
 	 * Checks if at least one computing parameter value has changed since last computing.
 	 * @return
@@ -662,8 +676,8 @@
 	public boolean hasParameterChanged() throws Exception {
 		return this.hasParameterChanged(this.getLastParametersFromHistory(), Parameter.COMPUTING);
 	}
-	
-	
+
+
 	/**
 	 * Dumps the command and default preferences of the result preferences node qualifier.
 	 * @return
@@ -746,21 +760,21 @@
 
 
 
-//	/**
-//	 * Updates the dirty state by comparing an old parameter with a new one.
-//	 * 
-//	 * @param lastValue may be null
-//	 * @param newValue may be null
-//	 */
-//	protected void updateDirty(Object lastValue, Object newValue) {
-//		if(lastValue == null && newValue == null)	{
-//			return;
-//		}
-//		if (lastValue == null || !lastValue.equals(newValue)) {
-//			Log.info("TXMResult.updateDirty(): " + this.getClass().getSimpleName() + ": setting dirty to true: last = "+ lastValue + " / new = " + newValue);
-//			this.setDirty();
-//		}
-//	}
+	//	/**
+	//	 * Updates the dirty state by comparing an old parameter with a new one.
+	//	 * 
+	//	 * @param lastValue may be null
+	//	 * @param newValue may be null
+	//	 */
+	//	protected void updateDirty(Object lastValue, Object newValue) {
+	//		if(lastValue == null && newValue == null)	{
+	//			return;
+	//		}
+	//		if (lastValue == null || !lastValue.equals(newValue)) {
+	//			Log.info("TXMResult.updateDirty(): " + this.getClass().getSimpleName() + ": setting dirty to true: last = "+ lastValue + " / new = " + newValue);
+	//			this.setDirty();
+	//		}
+	//	}
 
 	/**
 	 * Sets the dirty state to true if a parameter has changed since last computing.
@@ -768,65 +782,65 @@
 	 * @throws Exception
 	 */
 	public void updateDirtyFromHistory() throws Exception {
-//		
-////		// result has never been computed
-////		if(this.getLastParametersFromHistory() == null)	{
-////			this.dirty = true;
-////			return true;
-////		}
-////
-////		List<Field> fields = this.getAllFields();
-////		
-////		for (Field f : fields) {
-////			Parameter parameter = f.getAnnotation(Parameter.class);
-////			if (parameter == null
-////					|| parameter.type() == Parameter.INTERNAL
-////					//|| parameter.type() != Parameter.COMPUTING
-////					) {
-////				continue;
-////			}
-////			String name;
-////			if (!parameter.key().isEmpty())	{
-////				name = parameter.key();
-////			}
-////			else {
-////				name = f.getName();
-////			}
-////
-////			f.setAccessible(true); // to be able to test the field values
-////
-////			Object previousValue = this.getLastParametersFromHistory().get(name);
-////			Object newValue = f.get(this);
-////
-////			//			// FIXME: debug
-////			//			Log.finest("TXMResult.isDirtyFromHistory(): checking parameter: " + name);
-////
-////			this.updateDirty(previousValue, newValue);
-////			if (this.dirty) {
-////				Log.finest("TXMResult.isDirtyFromHistory(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed.");
-////				return this.dirty; // no need to go further
-////			}
-////		}
-////		return this.dirty;
-//		
-//		this.dirty = this.hasParameterChanged();
-////		if (this.chartDirty) {
-////			// FIXME: debug
-////			Log.finest("ChartResult.isChartDirtyFromHistory(): parameter " + name + " has changed.");
-////			return this.chartDirty; // no need to go further
-////		}
-////		return this.dirty;
-//		if(this.dirty)	{
-//			return true;
-//		}
-//		else	{
-			//return this.hasParameterChanged();
-//		}
-		
+		//		
+		////		// result has never been computed
+		////		if(this.getLastParametersFromHistory() == null)	{
+		////			this.dirty = true;
+		////			return true;
+		////		}
+		////
+		////		List<Field> fields = this.getAllFields();
+		////		
+		////		for (Field f : fields) {
+		////			Parameter parameter = f.getAnnotation(Parameter.class);
+		////			if (parameter == null
+		////					|| parameter.type() == Parameter.INTERNAL
+		////					//|| parameter.type() != Parameter.COMPUTING
+		////					) {
+		////				continue;
+		////			}
+		////			String name;
+		////			if (!parameter.key().isEmpty())	{
+		////				name = parameter.key();
+		////			}
+		////			else {
+		////				name = f.getName();
+		////			}
+		////
+		////			f.setAccessible(true); // to be able to test the field values
+		////
+		////			Object previousValue = this.getLastParametersFromHistory().get(name);
+		////			Object newValue = f.get(this);
+		////
+		////			//			// FIXME: debug
+		////			//			Log.finest("TXMResult.isDirtyFromHistory(): checking parameter: " + name);
+		////
+		////			this.updateDirty(previousValue, newValue);
+		////			if (this.dirty) {
+		////				Log.finest("TXMResult.isDirtyFromHistory(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed.");
+		////				return this.dirty; // no need to go further
+		////			}
+		////		}
+		////		return this.dirty;
+		//		
+		//		this.dirty = this.hasParameterChanged();
+		////		if (this.chartDirty) {
+		////			// FIXME: debug
+		////			Log.finest("ChartResult.isChartDirtyFromHistory(): parameter " + name + " has changed.");
+		////			return this.chartDirty; // no need to go further
+		////		}
+		////		return this.dirty;
+		//		if(this.dirty)	{
+		//			return true;
+		//		}
+		//		else	{
+		//return this.hasParameterChanged();
+		//		}
+
 		if(this.hasParameterChanged())	{
 			this.dirty = true;
 		}
-		
+
 	}
 
 
@@ -867,13 +881,24 @@
 	 * @param dirty
 	 */
 	public void setDirty(boolean dirty) {
+		setDirty(dirty, true);
+	}
+
+	/**
+	 *  Sets the result dirty state so editors or others will know the TXMResult needs to be recomputed or not.
+	 *  This method is also recursively called on all the children branch sets the new dirty state.
+	 * @param dirty
+	 */
+	public void setDirty(boolean dirty, boolean propagate) {
 		this.dirty = dirty;
-		for (int i = 0; i < this.children.size(); i++) {
-			this.children.get(i).setDirty(dirty);
+		if (propagate) {
+			for (int i = 0; i < this.children.size(); i++) {
+				this.children.get(i).setDirty(dirty);
+			}
 		}
 	}
-	
 
+
 	/**
 	 * Gets the value of the specified key in parameters, local result node or
 	 * default preferences nodes.
@@ -939,7 +964,7 @@
 	public String getStringParameterValue(String key) {
 		return TXMPreferences.getString(key, this, this.commandPreferencesNodePath);
 	}
-	
+
 	/**
 	 * Gets the value of the specified key in parameters, local result node or
 	 * default preferences nodes.
@@ -950,6 +975,22 @@
 	public Date getDateParameterValue(String key) {
 		return TXMPreferences.getDate(key, this, this.commandPreferencesNodePath);
 	}
+	
+	/**
+	 * Gets the value of the specified key in parameters, local result node or
+	 * default preferences nodes.
+	 * 
+	 * @param key
+	 * @return
+	 */
+	public File getFileParameterValue(String key) {
+		String v = TXMPreferences.getString(key, this, this.commandPreferencesNodePath);
+		if (v != null && v.length() > 0) {
+			return new File(v);
+		} else {
+			return null;
+		}
+	}
 
 
 	/**
@@ -972,8 +1013,6 @@
 		return TXMPreferences.isEmpty(this.commandPreferencesNodePath, key);
 	}
 
-
-
 	/**
 	 * Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method.
 	 * 
@@ -1013,14 +1052,14 @@
 		this.saveParameter("class", this.getClass().getName()); //$NON-NLS-1$
 
 		this.saveParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH, this.parametersNodePath);
-		
+
 		// FIXME: old version that not work well if a bundle has no preference initializer
 		//this.saveParameter(TXMPreferences.BUNDLE_ID, this.commandPreferencesNodePath);
 		// FIXME: new version
 		this.saveParameter(TXMPreferences.BUNDLE_ID, FrameworkUtil.getBundle(getClass()).getSymbolicName());
-		
-		
-		
+
+
+
 		if (this.parent != null)	{
 			this.saveParameter(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.parent.getParametersNodePath());
 		}
@@ -1045,7 +1084,7 @@
 					f.getType().isAssignableFrom(double.class) || f.getType().isAssignableFrom(Double.class) ||
 					f.getType().isAssignableFrom(float.class) || f.getType().isAssignableFrom(Float.class) ||
 					f.getType().isAssignableFrom(boolean.class) || f.getType().isAssignableFrom(Boolean.class) ||
-					f.getType().isAssignableFrom(String.class)
+					f.getType().isAssignableFrom(String.class) || f.getType().isAssignableFrom(File.class)
 
 					// FIXME: do not pass a Serializable for now
 					//|| !f.getType().isAssignableFrom(Serializable.class)
@@ -1147,7 +1186,7 @@
 			if (parameter == null || parameter.type() != parameterType) {
 				continue;
 			}
-			
+
 			String key = parameter.key();
 
 			if (key.isEmpty()) {
@@ -1177,6 +1216,9 @@
 				else if (f.getType().isAssignableFrom(Date.class)) {
 					value = this.getDateParameterValue(key);
 				}
+				else if (f.getType().isAssignableFrom(File.class)) {
+					value = this.getFileParameterValue(key);
+				}
 				// FIXME: test to automate other type creation as Property => problem here is that org.txm.core doesn't know the plug-in org.txm.searchengine.cqp.core
 				// could be done using reflection. Get the field runtime class, then get and call the constructor
 				//				else if (f.getType().isAssignableFrom(Property.class)) {
@@ -1265,11 +1307,11 @@
 		if (targetField != null)	{
 			targetField.setAccessible(true);
 			targetField.set(this, value);
-			
+
 			// Log
 			String message = "TXMResult.setParameter(): " + this.getClass().getSimpleName() + ": setting parameter " + key + " = " + value; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 			Log.finest(message);
-			
+
 		}
 		else if (this.parent != null && propagateToParent) {
 			this.parent.setParameter(key, value, propagateToParent);
@@ -1309,11 +1351,9 @@
 			this.clean();
 
 			if (this.parent != null) {
-				
-				TXMResult parent = this.parent; 
-				
+
 				this.parent.removeChild(this);
-				
+
 			}
 			this.parent = null;
 			return true;
@@ -1327,19 +1367,19 @@
 	/**
 	 * Deletes all non persistent results and saves the results to persist.
 	 */
-	public static void deleteAllNonPersistentResults() {
-		List<TXMResult> todo = Toolbox.workspace.getChildren();
+	public static void deleteAllNonPersistentResults(TXMResult root) {
+		List<TXMResult> todo = root.getChildren();
 		while (todo.size() > 0) {
 			TXMResult r = null;
-				r = todo.remove(0);
-				todo.addAll(0, r.getChildren());
-				if (r.mustBePersisted())	{ 
-					TXMPreferences.flush(r);
-				}
-				else {
-					Log.finest("TXMResult.deleteAllNonPersistentResults(): Deleting result " + r.getSimpleName() + " of type " + r.getClass().getSimpleName() + ".");
-					TXMPreferences.delete(r);
-				}
+			r = todo.remove(0);
+			todo.addAll(0, r.getChildren());
+			if (r.mustBePersisted())	{ 
+				TXMPreferences.flush(r);
+			}
+			else {
+				Log.finest("TXMResult.deleteAllNonPersistentResults(): Deleting result " + r.getSimpleName() + " of type " + r.getClass().getSimpleName() + ".");
+				TXMPreferences.delete(r);
+			}
 		}
 	}
 
@@ -1444,7 +1484,7 @@
 		return false;
 	}
 
-	
+
 	/**
 	 * Checks if the result has at least one child visible.
 	 * @return true if the result has at least one child visible
@@ -1452,8 +1492,8 @@
 	public boolean hasVisibleChild() {
 		return !this.getChildren(true).isEmpty();
 	}
-	
-	
+
+
 	/**
 	 * Gets all the children results (not a clone).
 	 * 
@@ -1514,7 +1554,7 @@
 	public void deleteChildren() {
 		deleteChildren(null);
 	}
-	
+
 	/**
 	 * Deletes the children of the specified class.
 	 * @param type
@@ -1566,7 +1606,7 @@
 	public List<TXMResult> getDeepChildren(Class<? extends TXMResult> clazz) {
 		return TXMResult.getDeepChildren(this, clazz);
 	}
-	
+
 	/**
 	 * Gets the children of all the branch in a flat list.
 	 * 
@@ -1575,7 +1615,7 @@
 	public static List<TXMResult> getDeepChildren(TXMResult r) {
 		return TXMResult.getDeepChildren(r, null);
 	}
-	
+
 	/**
 	 * Gets the children of all the branch in a flat list.
 	 * 
@@ -1603,7 +1643,7 @@
 					return results.get(i); // a direct children is the node we are looking for
 				}
 			}
-			
+
 			for (int i = 0; i < results.size(); i++) {
 				TXMResult r = getResult(results.get(i), nodePath);
 				if (r != null) {
@@ -1705,7 +1745,7 @@
 	public boolean isChild(TXMResult child) {
 		return this.getDeepChildren().contains(child);
 	}
-	
+
 	/**
 	 * Gets the sibling nodes of this node result.
 	 */
@@ -1738,7 +1778,7 @@
 	public boolean isVisible() {
 		return this.visible;
 	}
-	
+
 	public boolean isParentVisible() {
 		return parent != null && (parent.isVisible() || parent.isInternalPersistable());
 	}
@@ -1795,7 +1835,7 @@
 	 */
 	public abstract String getDetails();
 
-	
+
 	/**
 	 * Gets a message indicating the start of computing.
 	 * Dedicated to indicate the start of computing and, for example, the parameters used for the computing.
@@ -1806,9 +1846,9 @@
 	public String getComputingStartMessage() {
 		return "Computing "+this.getClass().getSimpleName()+"...";
 	}
-//	public abstract String getComputingStartMessage();
+	//	public abstract String getComputingStartMessage();
 
-	
+
 	/**
 	 * Gets a message indicating the computing is done.
 	 * Dedicated to indicate the end of computing and, for example, some informations about the result (eg. : 12 matches found, No matches found, etc.).
@@ -1819,14 +1859,14 @@
 	public String getComputingDoneMessage() {
 		return "";
 	}
-//	public abstract String getComputingDoneMessage();
+	//	public abstract String getComputingDoneMessage();
 
-	
-	
-	
-	
 
-	
+
+
+
+
+
 	/**
 	 * Gets the user name if exists otherwise, the lazy name if exists, otherwise the simple name.
 	 * 
@@ -1853,14 +1893,14 @@
 		return "..."; //$NON-NLS-1$
 	}
 
-//	/**
-//	 * Returns a string representation of an unique ID for the result.
-//	 * 
-//	 * @return
-//	 */
-//	public String getUUID() {
-//		return this.uniqueID;
-//	}
+	//	/**
+	//	 * Returns a string representation of an unique ID for the result.
+	//	 * 
+	//	 * @return
+	//	 */
+	//	public String getUUID() {
+	//		return this.uniqueID;
+	//	}
 
 	/**
 	 * Gets a string representing the result that can be used as a file name (eg. for exporting in file).
@@ -1924,7 +1964,7 @@
 	public TXMResult clone() {
 		return clone(null, true);
 	}
-	
+
 	public TXMResult clone(boolean all) {
 		return clone(null, all);
 	}
@@ -1939,12 +1979,12 @@
 		try {
 			String newNodePath = this.getProject().getParametersNodeRootPath()+ createUUID() + "_" + this.getClass().getSimpleName();
 			TXMPreferences.cloneNode(this.getParametersNodePath(), newNodePath);
-			
+
 			if (newParent != null) { // change the cloned node parent preference
 				TXMPreferences.put(newNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, newParent.getParametersNodePath());
 			}
 			clone =  this.getClass().getDeclaredConstructor(String.class).newInstance(newNodePath);
-			
+
 			if (all) {
 				for (TXMResult child : this.children) {
 					child.clone(clone, all);
@@ -1961,14 +2001,14 @@
 		try {
 			Properties props = new Properties();
 			props.load(IOUtils.getReader(parameters));
-			
+
 			// some tests before...
 			String className = props.getProperty("class");
 			if (className == null || className.length() == 0) {
 				System.out.println("** Error: No class internal parameter set.");
 				return false;
 			}
-			
+
 			if (this.getClass().getName().equals(className)) {
 				for (Object p : props.keySet()) {
 					String ps = p.toString();
@@ -1987,7 +2027,7 @@
 		}
 		return true;
 	}
-	
+
 	/**
 	 * import a result from a parameter file
 	 * @param allparameters the parameters file
@@ -1997,26 +2037,26 @@
 		try {
 			Properties props = new Properties();
 			props.load(IOUtils.getReader(parameters));
-			
+
 			// some tests before...
 			String className = props.getProperty("class");
 			if (className == null || className.length() == 0) {
 				System.out.println("** Error: No class internal parameter set.");
 				return null;
 			}
-			
+
 			String bundleId = props.getProperty("bundle_id");
 			if (bundleId == null || bundleId.length() == 0) {
 				System.out.println("** Error: No bundle_id internal parameter set.");
 				return null;
 			}
-			
+
 			Bundle bundle = Platform.getBundle(bundleId);
 			if (bundle == null) {
 				Log.finest("** Error: can not restore object with bundle name " + bundleId); //$NON-NLS-1$
 				return null;
 			}
-			
+
 			// copy parameters
 			String newNodePath = this.getProject().getParametersNodeRootPath()+ createUUID() + "_" + className;
 			TXMPreferences.put(newNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.getParametersNodePath());
@@ -2026,7 +2066,7 @@
 				if (TXMPreferences.RESULT_PARAMETERS_NODE_PATH.equals(ps)) continue;
 				TXMPreferences.put(newNodePath, ps, props.getProperty(ps, ""));
 			}
-			
+
 			// create instance
 			Class<?> cl = bundle.loadClass(className);
 			Constructor<?> cons = null;
@@ -2041,7 +2081,7 @@
 					clazz = clazz.getSuperclass();
 				}
 			}
-			
+
 			if (cons == null) {
 				System.out.println(NLS.bind("Cannot import {0} in {1}", parameters, this));
 			} else {
@@ -2050,14 +2090,14 @@
 				System.out.println(NLS.bind("{0} imported", result));
 				return result;
 			}
-			
+
 		} catch (Exception e) {
 			System.out.println(NLS.bind("Fail to import result from {0}: {1}", parameters, e));
 			Log.printStackTrace(e);
 		}
 		return null;
 	}
-	
+
 	/**
 	 * Set the TXMResult parameters
 	 * 
@@ -2143,7 +2183,7 @@
 		return this.compute(monitor, true);
 	}
 
-	
+
 	/**
 	 * Computes the result if:
 	 * - it can be computed (checking if all mandatory parameters are set)
@@ -2154,14 +2194,14 @@
 	 * @return
 	 */
 	protected boolean compute(IProgressMonitor monitor, boolean deepComputing) {
-		
+
 		if (this.computing) {
 			return true;
 		}
-		
+
 		this.computing = true;
-		
-		
+
+
 		// no changes to do
 		// FIXME: SJ: we need to do do some actions even if the object is locked, eg. updating parameters, saving parameters, etc.
 		// FIXME MD: nope the parameters must not move and will be saved in the current state
@@ -2169,13 +2209,13 @@
 			this.computing = false;
 			return true;
 		}
-		
-		
+
+
 		try {
 
 			Log.finest("*** TXMResult.compute(): " + this.getClass().getSimpleName() + ": starting computing process...");
 
-			
+
 			// FIXME: SJ: see if this skipComputing tests is still useful? is it possible to directly return instead?
 			// en fait voir ChartResult.compute() if(super.compute(monitor, true, false)), je pense que le prob vient du fait que si on retourne false dans TXMResult.compute() alors renderChart() ne sera pas appelé
 			// il faudrait retourner un état: skipped, computed, error, etc. 
@@ -2197,7 +2237,7 @@
 
 			// update the dirty state from history if a parameter has changed since last computing
 			this.updateDirtyFromHistory();
-			
+
 			// check if the result is dirty
 			if (!this.isDirty()) {
 				Log.finest("--- TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
@@ -2206,7 +2246,7 @@
 
 			if(!skipComputing)	{
 
-				
+
 				// Debug
 				Log.finest("+++ TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
 
@@ -2219,14 +2259,15 @@
 
 				//Log.info(this.getComputingStartMessage());
 
-				
+
+				if (monitor != null) monitor.subTask(this.getSimpleName()+"...");
 				// Computing
 				if (!this._compute()) {
 					Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed.");
 					this.computing = false;
 					return false;
 				}
-				
+
 			}
 
 			// clear the lazy name, no more needed since the object has been computed and getSimpleName() can now work
@@ -2239,12 +2280,12 @@
 			if(!skipComputing)	{
 
 				// store last used parameters
-//				this.updateLastParameters();
+				//				this.updateLastParameters();
 				if (this.hasBeenComputedOnce// don't update the computing date if the object has been lazy loaded
 						|| this.lastComputingDate == null) { // set the update date if never computed once
 					this.lastComputingDate = Calendar.getInstance().getTime(); // update this internal parameter before saving parameters
 				}
-				
+
 				if (!this.autoSaveParametersFromAnnotations()) {
 					Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to save parameters from annotations for " + this.getName() + ".");
 				}
@@ -2260,40 +2301,43 @@
 
 				this.dirty = false; // the computing was successful, the result is no more dirty
 				this.hasBeenComputedOnce = true;
-				
+
 				if (this.altered) {
 					Log.finest(NLS.bind("TXMResult.compute(): Warning {0} modifications have been lost.", this.getSimpleName()));
 				}
 				this.altered = false;
 				Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done.");
-				
+
 				//Log.info(this.getComputingDoneMessage());
 
-				
+
 			}
-			
-			
+
+
 			// Children computing
 			if(!skipComputing
 					|| this.altered // FIXME: SJ: fix for computing LexicalTable children even if the LT is not dirty but only altered, need to define if it's a temporary fix or not
 					)	{
-			
+
+				if (monitor != null && children.size() > 1) monitor.beginTask("Computing children of "+this, children.size());
 				// set the children as dirty since the result has changed
 				for (int i = 0; i < this.children.size(); i++) {
 					this.children.get(i).setDirty();
 				}
-	
+
 				// Children cascade computing (if parent == null then it is the Workspace (Tree root))
 				if (deepComputing && this.parent != null) {
-	
+
 					Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " child(ren).");
-	
+
 					for (int i = 0; i < this.children.size(); i++) {
 						this.children.get(i).compute(monitor, deepComputing);
+						
+						if (monitor != null && children.size() > 1) monitor.worked(1);
 					}
 				}
 			}
-			
+
 		}
 		catch (Exception e) {
 			e.printStackTrace();
@@ -2558,7 +2602,7 @@
 				child.setUserPersistable(userPersistable);
 			}
 		}
-		
+
 		// directly save and flush the preference
 		try {
 			if (this.isUserPersistable()) {
@@ -2606,7 +2650,7 @@
 	public ArrayList<HashMap<String, Object>> getParametersHistory() {
 		return parametersHistory;
 	}
-	
+
 	/**
 	 * Gets the last computing date.
 	 * @return the last computing date
@@ -2622,8 +2666,8 @@
 	public Date getCreationDate() {
 		return this.creationDate;
 	}
-	
 
+
 	public boolean toParametersFile(File outfile) throws IOException {
 		return TXMPreferences.flush(this, 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 2241)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 2242)
@@ -182,12 +182,13 @@
 		this.dirty = false;
 		this.hasBeenComputedOnce = true;
 		this.setVisible(false);
-
+		
 		initRCPStuffs();
-
-		this.autoSaveParametersFromAnnotations();
-		this.saveParameters();
-		TXMPreferences.flush(this);
+		if (isOpen()) {
+			this.autoSaveParametersFromAnnotations();
+			this.saveParameters();
+			TXMPreferences.flush(this);
+		}
 	}
 
 	/**
@@ -200,6 +201,65 @@
 		this(workspace, name, true);
 	}
 
+	public boolean isOpen() {
+		return rcpProject != null && rcpProject.isOpen();
+	}
+	
+	public boolean open(IProgressMonitor monitor) {
+		if (rcpProject != null && !rcpProject.isOpen()) {
+			try {
+				if (monitor != null) monitor.subTask("Openning project");
+				
+				
+				rcpProject.open(monitor);
+				
+				initRCPStuffs();
+				
+				if (monitor != null) monitor.subTask("loading results");
+				this.loadResults(null);
+
+				for (TXMResult cb : getCorpora()) {
+					if (!cb.compute(false)) {
+						Log.warning("Deleting broken corpus: "+cb+" of "+cb.getProject());
+						cb.delete();
+					}
+				}
+				
+				if (monitor != null) monitor.subTask("");
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+		}
+		return isOpen();
+	}
+	
+	public boolean close(IProgressMonitor monitor) {
+		if (rcpProject != null && rcpProject.isOpen()) {
+			try {
+				for (TXMResult r : getChildren()) {
+					r.onProjectClose();
+				}
+				this.saveParameters(true);
+				
+				if (preferenceScope != null) {
+					preferenceScope.getNode(this.getCommandPreferencesNodePath()).flush();
+				}
+				
+				TXMPreferences.saveAll();
+				
+				this.getChildren().clear();
+				
+				rcpProject.close(monitor);
+				
+				this.preferenceScope = null;
+				
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return !isOpen();
+	}
+	
 	/**
 	 * 
 	 * @return the corpus architecture version (currently 0.8.0)
@@ -323,7 +383,7 @@
 				// This step could be done only if the compiler step if done and only if it modifying/deleting the corpus builds
 				for (CorpusBuild corpus : getCorpusBuilds()) {
 					if (corpus != null) {
-						corpus.compute(false);
+					//	corpus.compute(false);
 					}
 				}
 			} else { // import failed
@@ -358,17 +418,18 @@
 			createRCPProject();
 		}
 
-		if (!rcpProject.isOpen()) {
-			try {
-				rcpProject.open(monitor);
-			} catch (Exception e) {
-				System.out.println("Warning: restoring corpus project files...");
-				rcpProject.delete(true, monitor);
-				createRCPProject();
-			}
+//		if (!rcpProject.isOpen()) {
+//			try {
+//				rcpProject.open(monitor);
+//			} catch (Exception e) {
+//				System.out.println("Warning: restoring corpus project files: "+e);
+////				rcpProject.delete(true, monitor);
+////				createRCPProject();
+//			}
+//		}
+		if (isOpen()) {
+			this.preferenceScope = new ProjectScope(rcpProject);
 		}
-
-		this.preferenceScope = new ProjectScope(rcpProject);
 	}
 
 	private void createRCPProject() throws CoreException {
@@ -381,7 +442,7 @@
 		
 		rcpProject.create(description, monitor);
 		rcpProject.open(monitor);
-		
+		//TODO might fail if corpus source directory changed
 		IFolder srcFolder = rcpProject.getFolder("src");
 		if (pSrcDirectory != null && !pSrcDirectory.getName().isEmpty()) {
 			IPath path = new Path(pSrcDirectory.getAbsolutePath());
@@ -723,100 +784,10 @@
 		this.pDefaultEditionName = defaultEditionName;
 	}
 
-	//	/* (non-Javadoc)
-	//	 * @see org.txm.objects.TxmObject#getChildren()
-	//	 */
-	//	@Override
-	//	public List<TxmObject> getChildren() {
-	//		List<TxmObject> rez = new ArrayList<TxmObject>();
-	//		rez.addAll(corpora.values());
-	//		return rez;
-	//	}
-
-	//	/* (non-Javadoc)
-	//	 * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
-	//	 */
-	//	public TxmObject removeChildren(TxmObject o) {
-	//		if (o == null)
-	//			return null;
-	////		if (o instanceof MainCorpus) {
-	////			params.corporaElement.removeChild(o.selfElement);
-	////			params.corpora.remove(o.getName());
-	////			//corpus.deleteFromCWB() already called
-	////			Toolbox.workspace.save();
-	////			return o;
-	////		}
-	//
-	//		return null;
-	//	}
-
-	//	/**
-	//	 * Removes the script.
-	//	 *
-	//	 * @param name the name
-	//	 * @return the script
-	//	 */
-	//	public MainCorpus removeCorpus(String name) {
-	//		MainCorpus corpus = corpora.get(name);
-	//		if (corpus != null) {
-	//			params.corporaElement.removeChild(corpus.selfElement);
-	//			params.corpora.remove(name);
-	//		}
-	//		return corpus;
-	//	}
-
-	//	/* (non-Javadoc)
-	//	 * @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
-	//	 */
-	//	public boolean hasChildren(TxmObject o) {
-	//		if (o == null)
-	//			return false;
-	//		if (o instanceof MainCorpus)
-	//			return params.corpora.values().contains(o);
-	//		return false;
-	//	}
-
 	public Workspace getWorkspace() {
 		return (Workspace) getParent();
 	}
 
-	//	/**
-	//	 * Register maincorpus.
-	//	 *
-	//	 * @param corpusName the corpus name
-	//	 */
-	//	public Element registerMaincorpus(String corpusName) {
-	//		Document doc = getSelfElement().getOwnerDocument();
-	//		Element maincorpus = doc.createElement("corpus"); //$NON-NLS-1$
-	//		maincorpus.setAttribute("name", corpusName); //$NON-NLS-1$
-	//		if (getSelfElement().getElementsByTagName("corpora").getLength() == 0) { //$NON-NLS-1$
-	//			Log.severe(TXMCoreMessages.Base_22);
-	//			return null;
-	//		}
-	//		Element corporaElem = (Element) getSelfElement().getElementsByTagName("corpora").item(0); //$NON-NLS-1$
-	//		corporaElem.appendChild(maincorpus); // append maincorpus
-	//		return maincorpus;
-	//	}
-
-	//	/**
-	//	 * Gets the corpus.
-	//	 *
-	//	 * @param name the name
-	//	 * @return the corpus
-	//	 */
-	//	public MainCorpus getCorpus(String name) {
-	//		return corpora.get(name);
-	//	}
-	//
-	//	/**
-	//	 * Gets the corpora.
-	//	 *
-	//	 * @return the corpora
-	//	 */
-	//	public HashMap<String, MainCorpus> getCorpora() {
-	//		return corpora;
-	//	}
-
 	public boolean export(File exportzip) {
 		return export(exportzip, null);
 	}
@@ -1277,7 +1248,7 @@
 	 * @param rcpProject
 	 * @return true if a Project has been found
 	 */
-	public static boolean loadProjectFromProjectScope(IProject rcpProject) {
+	public static Project loadProjectFromProjectScope(IProject rcpProject) {
 
 		ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths("/project/" + rcpProject.getName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -1332,13 +1303,13 @@
 					result.setUserPersistable(true);	
 				}
 
-				return true; // only one Project.class loaded per RCP project
+				return (Project)result; // only one Project.class loaded per RCP project
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
 		}
-		return false;
+		return null;
 	}
 
 	/**
Index: tmp/org.txm.core/src/java/org/txm/objects/Text.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 2242)
@@ -50,7 +50,7 @@
 	File pSource;
 	/** The XML-TXM file. */
 	@Parameter(key=TBXPreferences.XMLTXM)
-	File pTXMFile;
+	File pXMLTXMFile;
 
 	/**
 	 * Instantiates a new text.
@@ -198,6 +198,10 @@
 	public File getSource() {
 		return pSource;
 	}
+	
+	public File getXMLTXMFile() {
+		return pXMLTXMFile;
+	}
 
 	/**
 	 * Gets the PDF edition page path.
@@ -224,16 +228,6 @@
 
 	@Override
 	public boolean loadParameters() throws Exception {
-
-		String path = getStringParameterValue(TBXPreferences.SOURCE);
-		if (path != null & path.length() > 0) {
-			this.pSource = new File(path);
-		}
-
-		path = getStringParameterValue(TBXPreferences.XMLTXM);
-		if (path != null & path.length() > 0) {
-			this.pTXMFile = new File(path);
-		}
 		return true;
 	}
 
@@ -245,7 +239,7 @@
 		}
 		path = parameters.getString(TBXPreferences.XMLTXM);
 		if (path != null & path.length() > 0) {
-			this.pTXMFile = new File(path);
+			this.pXMLTXMFile = new File(path);
 		}
 		return true;
 	}
@@ -255,12 +249,14 @@
 	}
 
 	public void setSourceFile(File src) {
-		this.pSource = src;
-		this.dirty = true;
+		if (pSource == null || !pSource.equals(src)) {
+			this.pSource = src;
+			this.dirty = true;
+		}
 	}
 
 	public void setTXMFile(File txmFile) {
-		this.pTXMFile = txmFile;
+		this.pXMLTXMFile = txmFile;
 	}
 
 	@Override
@@ -280,8 +276,8 @@
 
 	@Override
 	public void clean() {
-		if (pTXMFile != null && pTXMFile.exists()) {
-			pTXMFile.delete();
+		if (pXMLTXMFile != null && pXMLTXMFile.exists()) {
+			pXMLTXMFile.delete();
 		}
 	}
 
@@ -292,7 +288,7 @@
 
 	@Override
 	protected boolean _compute() throws Exception {
-		//System.out.println("CALL IMPORTMODULE TO BUILD TEXT="+userName);
+		//TODO System.out.println("CALL IMPORTMODULE TO BUILD TEXT="+userName);
 		return true;
 	}
 
@@ -308,6 +304,6 @@
 
 	@Override
 	public String toString() {
-		return userName + " (file: " + pTXMFile + ")";
+		return userName + " (file: " + pXMLTXMFile + ")";
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 2242)
@@ -200,32 +200,32 @@
 		return (List<SavedQuery>) getChildren(SavedQuery.class);
 	}
 
-	/**
-	 * Adds Texts from a directory of sources.
-	 *
-	 * @param directory the directory
-	 * @return true, if successful
-	 */
-	public boolean addDirectory(File directory) {
-		FileFilter filter = new FileFilter() {
-			@Override
-			public boolean	accept(File pathname) {
-				return !pathname.isHidden();
-			}
-		};
-		if (directory.isDirectory() && directory.exists()) {
-			File[] files = directory.listFiles(filter);
-			Arrays.sort(files);
-			for (File f : files) {
-				Text t = new Text(this.getProject());
-				t.setSourceFile(f);
-			}
-		} else {
-			System.out.println(directory + " is not a directory.");
-			return false;
-		}
-		return true;
-	}
+//	/**
+//	 * Adds Texts from a directory of sources.
+//	 *
+//	 * @param directory the directory
+//	 * @return true, if successful
+//	 */
+//	public boolean addDirectory(File directory) {
+//		FileFilter filter = new FileFilter() {
+//			@Override
+//			public boolean	accept(File pathname) {
+//				return !pathname.isHidden();
+//			}
+//		};
+//		if (directory.isDirectory() && directory.exists()) {
+//			File[] files = directory.listFiles(filter);
+//			Arrays.sort(files);
+//			for (File f : files) {
+//				Text t = new Text(this.getProject());
+//				t.setSourceFile(f);
+//			}
+//		} else {
+//			System.out.println(directory + " is not a directory.");
+//			return false;
+//		}
+//		return true;
+//	}
 	
 	/**
 	 * 
Index: tmp/org.txm.core/src/java/org/txm/objects/Edition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 2242)
@@ -55,7 +55,7 @@
 	String pIndex;
 
 	/** The pages. */
-	ArrayList<Page> pages;
+	ArrayList<Page> pages = new ArrayList<Page>();
 
 	@Parameter(key=TBXPreferences.NAMES)
 	ArrayList<String> pPageNames;
@@ -86,7 +86,7 @@
 		this.setVisible(false);
 		this.internalPersistable = true;
 	}
-	
+
 	/**
 	 * Gets the text.
 	 *
@@ -116,7 +116,7 @@
 		// System.out.println("  build edition "+name);
 		NodeList pagesList = e.getElementsByTagName("page"); //$NON-NLS-1$
 		int numpages = pagesList.getLength();
-		pages = new ArrayList<>();
+		pages.clear();
 		for (int i = 0; i < numpages; i++) {
 			Element p = (Element) pagesList.item(i);
 			Page page = new Page(this, "", "");
@@ -196,8 +196,8 @@
 		this.pPageNames.add(id);
 		this.pPageFirstWordIds.add(wordid);
 	}
-	
 
+
 	public void resetPages() {
 		this.pPageNames.clear();
 		this.pPageFirstWordIds.clear();
@@ -396,9 +396,8 @@
 
 	@Override
 	public void clean() {
-		File dir = getHtmlDir();
-		if (dir.exists()) {
-			DeleteDir.deleteDirectory(getHtmlDir());
+		for (Page p : this.getPages()) {
+			p.getFile().delete();
 		}
 	}
 
@@ -410,19 +409,14 @@
 	@Override
 	protected boolean _compute() throws Exception {
 		//System.out.println("USE THE PROJECT IMPORTMODULE TO BUILD THE EDITION="+userName);
-		if (pages == null) {
-			pages = new ArrayList<Page>();
-		}
-		else {
-			pages.clear();
-		}
-		
+		pages.clear();
+
 		if (pages.size() != pPageNames.size()) {
 			for (int i = 0 ; i < pPageNames.size() && i < pPageFirstWordIds.size() ; i++) {
 				pages.add(new Page(this, pPageNames.get(i), pPageFirstWordIds.get(i)));
 			}
 		}
-		
+
 		return true;
 	}
 
Index: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 2242)
@@ -37,6 +37,7 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.osgi.util.NLS;
 import org.txm.Toolbox;
@@ -252,8 +253,8 @@
 				rcpProject.open(new LogMonitor());
 			}
 
-			if (Project.loadProjectFromProjectScope(rcpProject)) {
-				Project b = this.getProject(binCorpusDir.getName());
+			Project b = Project.loadProjectFromProjectScope(rcpProject);
+			if (b != null) {
 				return b;
 			} else {
 				Log.warning(NLS.bind("No TXM project found in {0}", binCorpusDir));
@@ -386,7 +387,7 @@
 	 * Loads and recreates the existing projects.
 	 * @throws CoreException 
 	 */
-	public void loadProjectsFromProjectScopes() throws CoreException	{
+	public void loadProjectsFromProjectScopes(IProgressMonitor monitor) throws CoreException	{
 
 		Log.fine("Toolbox.initialize(): reloading projects...");
 
@@ -400,33 +401,34 @@
 		IProject projects[] = rcpWorkspace.getRoot().getProjects();
 
 		Log.fine("Toolbox.initialize(): " + projects.length + " project(s) found in workspace.");
-		LogMonitor monitor = new LogMonitor("Workspace projects initialization.");
-
+		monitor.setTaskName(NLS.bind(TXMCoreMessages.initializingCorpora, 0, projects.length));
+		int c = 0;
 		for (IProject project : projects) {
-
+			c++;
+			monitor.setTaskName(NLS.bind(TXMCoreMessages.initializingCorpora, c, projects.length));
+			monitor.subTask(project.getName());
 			if (project.getLocation() == null || !project.getLocation().toFile().exists()) {
 				project.delete(true, null);
 				continue;
 			}
-			try {
-				project.open(monitor);
-				//String[] natures = project.getDescription().getNatureIds();
-				//if (Arrays.binarySearch(natures, Project.TXMCORPUSNATURE) < 0) continue;
-
-				Project.loadProjectFromProjectScope(project);
-			} catch (CoreException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+			
+			//project.open(monitor);
+			//String[] natures = project.getDescription().getNatureIds();
+			//if (Arrays.binarySearch(natures, Project.TXMCORPUSNATURE) < 0) continue;
+			if (project.isOpen()) {
+				Project.loadProjectFromProjectScope(project); // !!!
 			}
 		}
 
 		// force the initialization of CorpusBuilds
-		for (TXMResult project : this.getChildren(Project.class)) {
-			for (TXMResult corpus : project.getChildren(CorpusBuild.class)) {
-				CorpusBuild cb = (CorpusBuild)corpus;
-				if (!cb.compute(false)) {
-					System.out.println("Deleting duplicated corpus: "+cb+" of "+cb.getProject());
-					cb.delete();
+		for (TXMResult r : this.getChildren(Project.class)) {
+			Project project = (Project)r;
+			if (project.isOpen()) {
+				for (CorpusBuild cb : project.getCorpora()) {
+					if (!cb.compute(false)) {
+						System.out.println("Deleting broken corpus: "+cb+" of "+cb.getProject());
+						cb.delete();
+					}
 				}
 			}
 		}
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 2241)
+++ tmp/org.txm.core/src/java/org/txm/importer/xtz/Compiler.java	(revision 2242)
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.txm.utils.DeleteDir;
 
@@ -14,7 +15,7 @@
 public class Compiler extends ImportStep {
 
 	protected File cqpDirectory, registryDirectory, dataDirectory;
-	protected ArrayList<File> files;
+	protected List<String> orderedTextIDs;
 	
 	/**
 	 * Creates the output directories
@@ -55,7 +56,7 @@
 		process(null); // no default files order set
 	}
 	
-	public void process(ArrayList<File> files) {
-		this.files = files;
+	public void process(List<String> orderedTextIDs) {
+		this.orderedTextIDs = orderedTextIDs;
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/importer/xtz/Pager.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/xtz/Pager.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/importer/xtz/Pager.java	(revision 2242)
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.txm.utils.DeleteDir;
 
@@ -15,7 +16,7 @@
 
 	protected File htmlDirectory;
 	protected String corpusname;
-	protected ArrayList<File> files;
+	protected List<String> orderedTextIDs;
 
 	public Pager(ImportModule module, String editionName) {
 		super(module);
@@ -43,7 +44,7 @@
 		process(null); // no default files order set
 	}
 	
-	public void process(ArrayList<File> files) {
-		this.files = files;
+	public void process(List<String> orderedTextIDs) {
+		this.orderedTextIDs = orderedTextIDs;
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 2241)
+++ tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 2242)
@@ -1,29 +1,21 @@
 package org.txm.importer.xtz;
 
 import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
+import java.util.List;
 import java.util.logging.Level;
 
-import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.txm.Toolbox;
-import org.txm.core.results.TXMResult;
-import org.txm.objects.CorpusBuild;
 import org.txm.objects.Project;
+import org.txm.objects.Text;
 import org.txm.utils.DeleteDir;
 import org.txm.utils.LogMonitor;
 import org.txm.utils.logger.Log;
-import org.txm.utils.xml.DomUtils;
 
 public class ImportModule {
 
 	public Project project;
-	
+
 	public String corpusVersionProduced;
 
 	public File sourceDirectory;
@@ -45,12 +37,12 @@
 	public String corpusName;
 
 	IProgressMonitor monitor;
-	
+
 	public void setMonitor(IProgressMonitor monitor) {
 		this.monitor = monitor;
 	}
 
-	
+
 	public boolean isMultiThread() {
 		return multithread;
 	}
@@ -62,27 +54,27 @@
 	public ImportModule(Project p) {
 		init(p);
 	}
-	
+
 	public boolean isUpdatingCorpus() {
 		return updateCorpus;
 	}
 
 	public void init(Project p) {
 		this.project = p;
-		
+
 		corpusName = project.getName();
 		//this.debug = "true".equals(project.getKeyValueParameters().get(ImportKeys.DEBUG));
-		
+
 		if (Log.getLevel().intValue() < Level.INFO.intValue()) {
 			debug = true;
 		}
 		this.multithread = project.getDoMultiThread();
 		this.updateCorpus = project.getDoUpdate();
 
-		
+
 		this.sourceDirectory = project.getSrcdir();
 		this.binaryDirectory = project.getProjectDirectory();
-			
+
 		if (!updateCorpus) { // clean directories only if it's a new import	
 			File txmDir = new File(binaryDirectory, "txm");
 			//DeleteDir.deleteDirectory(binaryDirectory);
@@ -93,8 +85,13 @@
 				p.getRCPProject().getFolder("registry").delete(true, new LogMonitor("XTZ delete project content"));
 				p.getRCPProject().getFolder("tokenized").delete(true, new LogMonitor("XTZ delete project content"));
 				p.getRCPProject().getFolder("txm").delete(true, new LogMonitor("XTZ delete project content"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "HTML"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "cqp"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "data"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "registry"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "tokenized"));
+				DeleteDir.deleteDirectory(new File(binaryDirectory, "txm"));
 			} catch (CoreException e) {
-				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
 			txmDir.mkdirs();
@@ -109,7 +106,9 @@
 			//System.out.println("ImportModule.start: not updating");
 			if (importer != null) {
 				//System.out.println("ImportModule.start: importer: "+importer);
-				if (monitor != null) System.out.println("-- IMPORTER - Reading source files");
+				if (monitor != null) monitor.subTask("-- IMPORTER - Reading source files");
+					
+				System.out.println("-- IMPORTER - Reading source files");
 				importer.process();
 				//importer.checkFiles();
 				isSuccessful = isSuccessful & importer.isSuccessFul();
@@ -121,9 +120,28 @@
 				System.out.println("XML-TXM files already produced in "+new File(binaryDirectory, "txm/"+corpusName));
 			}
 
+			//declare the new texts produced in the "txm" directory
+			for (File build : new File(binaryDirectory, "txm").listFiles()) {
+				if (!build.isDirectory()) continue;
+				
+				for (File xmltxmFile : build.listFiles()) {
+					if (xmltxmFile.isDirectory()) continue;
+					if (xmltxmFile.isHidden()) continue;
+
+					String name = xmltxmFile.getName();
+					name = name.substring(0, name.indexOf(".xml"));
+
+					Text t = new Text(project);
+					t.setName(name);
+					t.setTXMFile(xmltxmFile);
+					t.setDirty();
+				}
+			}
+
 			boolean annotate = project.getAnnotate();
 			if (annotate && annotater != null) {
-				if (monitor != null) System.out.println("-- ANNOTATE - Running NLP tools");
+				if (monitor != null) monitor.subTask("-- ANNOTATE - Running NLP tools");
+				System.out.println("-- ANNOTATE - Running NLP tools");
 				annotater.process();
 				isSuccessful = isSuccessful & annotater.isSuccessFul();
 				if (!isSuccessful) {
@@ -135,16 +153,27 @@
 			}
 		} else {
 			System.out.println("Updating corpus...");
+			// fixing Text XML-TXM configurations
+			for (Text text : project.getTexts()) {
+				File f = text.getXMLTXMFile();
+				if (f == null || !f.exists()) {
+					
+					f = new File(project.getProjectDirectory(), "txm/"+project.getName()+"/"+text.getName()+".xml");
+					text.setTXMFile(f);
+				}
+			}
 		}
-		
+
 		//System.out.println("GET FILES ORDER");
-		final ArrayList<File> files = getTXMFilesOrder();
-		
-		Thread Tcompiler = new Thread() {
+		final List<String> orderedTextIDs = getTXMFilesOrder();
+
+		Thread Tcompiler = new Thread("XTZ Compiler - "+project.getSrcdir().getName()) {
 			public void run() {
 				if (compiler != null) {
-					if (monitor != null) System.out.println("-- COMPILING - Building Search Engine indexes");
-					compiler.process(files);
+					if (monitor != null) monitor.subTask("-- COMPILING - Building Search Engine indexes"); 
+					
+					System.out.println("-- COMPILING - Building Search Engine indexes");
+					compiler.process(orderedTextIDs);
 					isSuccessful = isSuccessful & compiler.isSuccessFul();
 					if (!isSuccessful) {
 						System.out.println("Error while importing corpus during 'compiler' step, reason="+compiler.getReason());
@@ -155,13 +184,15 @@
 				}
 			}
 		};
-
-		Thread Tpager = new Thread() {
+		
+		Thread Tpager = new Thread("XTZ Pager - "+project.getSrcdir().getName()) {
 			public void run() {
 
 				if (pager != null) {
-					if (monitor != null) System.out.println("-- EDITION - Building edition");
-					pager.process(files);
+					if (monitor != null) monitor.subTask("-- EDITION - Building edition");
+					
+					System.out.println("-- EDITION - Building edition");
+					pager.process(orderedTextIDs);
 					isSuccessful = isSuccessful & pager.isSuccessFul();
 					if (!isSuccessful) {
 						System.out.println("Error while importing corpus during 'pager' step, reason="+pager.getReason());
@@ -174,33 +205,41 @@
 		};
 
 		Tcompiler.start();
-		if (!multithread) {
+		if (!multithread) { //  && !updateCorpus
 			Tcompiler.join(); // wait for the end if not multithreaded
 			if (!isSuccessful) { // don't call pager is compiler step failed
 				return;
 			}
 		}
-		
+
 		Tpager.start();
 		if (multithread) Tcompiler.join(); // wait for both thread to end
-		Tpager.join();		
-	}
-	
-	protected ArrayList<File> getTXMFilesOrder() {
-		//System.out.println("DEFAULT FILES ORDER");
-		File txmDirectory = new File(binaryDirectory, "txm/"+corpusName);
-		ArrayList<File> files = new ArrayList<File>(Arrays.asList(txmDirectory.listFiles(new FileFilter() {
-			@Override
-			public boolean accept(File file) {
-				return file.isFile() && file.getName().endsWith(".xml");
+		Tpager.join();
+
+		if (isSuccessful) { // all done TODO remove this code when Text._compute() will be implemented
+			for (Text t : project.getTexts()) {
+				t.setDirty(false);
 			}
-		})));
-		
-		Collections.sort(files);
-		
-		return files;
+			
+			project.setDoUpdate(false);
+		}
 	}
 
+	protected List<String> getTXMFilesOrder() {
+		//		//System.out.println("DEFAULT FILES ORDER");
+		//		File txmDirectory = new File(binaryDirectory, "txm/"+corpusName);
+		//		ArrayList<File> files = new ArrayList<File>(Arrays.asList(txmDirectory.listFiles(new FileFilter() {
+		//			@Override
+		//			public boolean accept(File file) {
+		//				return file.isFile() && file.getName().endsWith(".xml");
+		//			}
+		//		})));
+		//		
+		//		Collections.sort(files);
+		return project.getTextsID();
+		//		return files;
+	}
+
 	public void end() {
 		File paramFile = new File(binaryDirectory, "import.xml");
 		try {
@@ -213,7 +252,7 @@
 			isSuccessful = false;
 		}
 	}
-	
+
 	public String getCorpusName() {
 		return corpusName;
 	}
@@ -237,7 +276,7 @@
 	public File getBinaryDirectory() {
 		return binaryDirectory;
 	}
-	
+
 	public void process() throws InterruptedException {
 		start();
 		if (isSuccessful)
@@ -245,20 +284,20 @@
 	}
 
 	public static void main(String[] args) {
-//		File projectFile = new File("/home/mdecorde/xml/brown/import.xml");
-//
-//		ImportModule module = new ImportModule(projectFile);
-//		System.out.println("Parameters: "+module.getParameters());
-//		try {
-//			module.start();
-//
-//			if (module.isSuccessful) {
-//				System.out.println("Import sucessful. reloading corpora...");
-//			} else {
-//				System.out.println("Import failed, reason = "+module.getReason());
-//			}
-//		} catch (Exception e) {
-//			e.printStackTrace();
-//		}
+		//		File projectFile = new File("/home/mdecorde/xml/brown/import.xml");
+		//
+		//		ImportModule module = new ImportModule(projectFile);
+		//		System.out.println("Parameters: "+module.getParameters());
+		//		try {
+		//			module.start();
+		//
+		//			if (module.isSuccessful) {
+		//				System.out.println("Import sucessful. reloading corpora...");
+		//			} else {
+		//				System.out.println("Import failed, reason = "+module.getReason());
+		//			}
+		//		} catch (Exception e) {
+		//			e.printStackTrace();
+		//		}
 	}
 }
Index: tmp/org.txm.core/plugin.xml
===================================================================
--- tmp/org.txm.core/plugin.xml	(revision 2241)
+++ tmp/org.txm.core/plugin.xml	(revision 2242)
@@ -14,16 +14,6 @@
       </initializer>
    </extension>
    <extension
-         id="org.txm.core.CorpusNature"
-         name="Corpus"
-         point="org.eclipse.core.resources.natures">
-      <runtime>
-         <run
-               class="org.txm.core.CorpusNature">
-         </run>
-      </runtime>
-   </extension>
-   <extension
          point="org.txm.core.engines.EnginesManager">
       <EngineManager
             class="org.txm.core.engines.ImportEngines"
