Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/GeneralWizardPage.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/GeneralWizardPage.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/GeneralWizardPage.java	(revision 1110)
@@ -5,6 +5,8 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
@@ -14,6 +16,8 @@
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.preferences.RCPPreferences;
 
 public class GeneralWizardPage extends WizardPage {
 //    private Text corpusName;
@@ -41,9 +45,16 @@
         label2.setText("Source directory");
         
         sourceDirectory = new Text(container, SWT.BORDER | SWT.SINGLE);
-        sourceDirectory.setText("");
+        final String lastSourcesLocation = RCPPreferences.getInstance().getString("lastSourcesLocation");
+        sourceDirectory.setText(lastSourcesLocation);
         sourceDirectory.setToolTipText("The corpus source directory");
         sourceDirectory.setLayoutData(gd);
+        sourceDirectory.addModifyListener(new ModifyListener() {
+			@Override
+			public void modifyText(ModifyEvent e) {
+				setPageComplete(isCompleted());
+			}
+		});
         
         Button button = new Button(container, SWT.PUSH);
         button.setText("...");
@@ -53,6 +64,7 @@
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				DirectoryDialog dialog = new DirectoryDialog(e.display.getActiveShell());
+				dialog.setFilterPath(getSourcePath());
 				dialog.setText("Source directory");
 				if (getSourcePath().length() > 0) {
 					dialog.setFilterPath(getSourcePath());
@@ -60,6 +72,8 @@
 				String path = dialog.open();
 				if (path != null) {
 					sourceDirectory.setText(path);
+					RCPPreferences.getInstance().put("lastSourcesLocation", path);
+					RCPPreferences.getInstance().flush();
 					setPageComplete(isCompleted());
 				}
 			}
@@ -100,6 +114,8 @@
         // required to avoid an error in the system
         setControl(container);
         setPageComplete(false);
+        
+        setPageComplete(isCompleted());
     }
 
     protected boolean isCompleted() {
@@ -112,6 +128,6 @@
 //    }
     
     public String getSourcePath() {
-        return sourceDirectory.getText();
+        return sourceDirectory.getText().trim();
     }
 }
\ No newline at end of file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java	(revision 1110)
@@ -70,7 +70,7 @@
 					project.setSourceDirectory(path.getAbsolutePath());
 					project.setDescription(page1.getDescription());
 				} else {
-					System.out.println("Using parameters from already imported corpus.");
+					System.out.println("Using parameters from already imported corpus: "+project.getCorpusBuild(project.getName()));
 				}
 				
 				//project.compute(); // create/update files
@@ -85,17 +85,18 @@
 				File importxml = new File(page1.getSourcePath(), "import.xml");
 				if (importxml.exists()) {
 					System.out.println("Warning: old TXM source directory containing an import.xml file found. Settings import parameters using this file.");
-					BaseOldParameters params = new BaseOldParameters(importxml);
-					project._load(params);
+					//BaseOldParameters params = new BaseOldParameters(importxml);
+					//project._load(params);
 				}
 				
 				project.save();
+				return true;
 			} catch (Exception e) {
 				e.printStackTrace();
 				return false;
 			}
 		}
-		return true;
+		return false;
 	}
 
 	@Override
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 1110)
@@ -157,30 +157,28 @@
 			protected IStatus run(IProgressMonitor monitor) {
 				this.runInit(monitor);
 				try {
-
+					
 					if (project.compute(monitor, true)) {
-
 						
-						syncExec(new Runnable() {
-							@Override
-							public void run() {
-								RestartTXM.reloadViews();
-								CorporaView.select(project.getChildren(MainCorpus.class));
-//								System.out.println(TXMUIMessages.AddBase_10);
-//								StatusLine.setMessage(TXMUIMessages.AddBase_10);
-							}
-						});
 						this.releaseSemaphore();
 
 						monitor.done();
-						System.gc();
 						return Status.OK_STATUS;
 					}
 				} catch (Exception e) {
 					// TODO Auto-generated catch block
 					e.printStackTrace();
+				} finally {
+					System.gc();
+					syncExec(new Runnable() {
+						@Override
+						public void run() {
+							RestartTXM.reloadViews();
+							CorporaView.select(project.getChildren(MainCorpus.class));
+						}
+					});
 				}
-				System.gc();
+				
 				return Status.CANCEL_STATUS;
 			}
 		};
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java	(revision 1110)
@@ -19,6 +19,7 @@
 import org.txm.objects.Project;
 import org.txm.rcp.editors.imports.ImportModuleCustomization;
 import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.tokenizer.TTest;
 import org.txm.tokenizer.TokenizerClasses;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -58,14 +59,14 @@
 		slayout.numColumns = 3;
 		sectionClient.setLayout(slayout);
 		this.section.setClient(sectionClient);
-		
+
 		Label tmpLabel3 = toolkit.createLabel(sectionClient, "Word tag");
 		TableWrapData gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
 		gdata.colspan = 2;
 		tmpLabel3.setLayoutData(gdata);
 		tmpLabel3.setToolTipText("XML tag name that encodes words");
 		tmpLabel3.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		
+
 		wordElementText = toolkit.createText(sectionClient, "w", SWT.BORDER); //$NON-NLS-1$
 		gdata = getTextGridData();
 		wordElementText.setLayoutData(gdata);
@@ -81,17 +82,17 @@
 			public void widgetSelected(SelectionEvent e) {
 				updateFieldsEnableState();
 			}
-			
+
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) { }
 		});
-		
+
 		Label l0 = toolkit.createLabel(sectionClient, TXMUIMessages.CorpusPage_16a, SWT.WRAP);
 		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
 		gdata.colspan = 3;
 		gdata.indent = 10;
 		l0.setLayoutData(gdata);
-		
+
 		Label l1 = toolkit.createLabel(sectionClient, TXMUIMessages.CorpusPage_5, SWT.WRAP);
 		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
 		gdata.colspan = 2;
@@ -101,7 +102,7 @@
 		textWhiteSpaces = toolkit.createText(sectionClient, TokenizerClasses.whitespaces, SWT.BORDER);
 		gdata = getLongTextGridData();
 		textWhiteSpaces.setLayoutData(gdata);
-		
+
 		Label l2 = toolkit.createLabel(sectionClient, TXMUIMessages.CorpusPage_16, SWT.WRAP);
 		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
 		gdata.colspan = 2;
@@ -293,49 +294,31 @@
 
 	@Override
 	public void update(Project project) {
-//		if (this.section.isDisposed()) return;
-//		if (params == null) return;
-//
-//		textWhiteSpaces.setText(TokenizerClasses.whitespaces);
-//		textPuncts.setText(TokenizerClasses.regPunct);
-//		textPunctsStrong.setText(TokenizerClasses.punct_strong);
-//		textElisions.setText(TokenizerClasses.regElision);
-//
-//		Element tokenizerElem = params.getTokenizerElement(params.getCorpusElement());
-//		NodeList paramList = tokenizerElem.getElementsByTagName("param"); //$NON-NLS-1$
-//		for (int i = 0 ; i < paramList.getLength() ; i++) {
-//			Element paramElem = (Element) paramList.item(i);
-//			String name = paramElem.getAttribute("name"); //$NON-NLS-1$
-//			String value = paramElem.getTextContent();
-//			if ("whitepaces".equals(name)) { //$NON-NLS-1$
-//				textWhiteSpaces.setText(value);
-//			} else if ("regPunct".equals(name)) { //$NON-NLS-1$
-//				textPuncts.setText(value);
-//			} else if ("punct_strong".equals(name)) { //$NON-NLS-1$
-//				textPunctsStrong.setText(value);
-//			} else if ("regElision".equals(name)) { //$NON-NLS-1$
-//				textElisions.setText(value);
-//			}
-//		}
-//		
-//		Element wtagElement = params.getWordElement();
-//		if (wtagElement != null)
-//			wordElementText.setText(wtagElement.getTextContent());
-//		
-//		boolean skip = params.getSkipTokenization();
-//		//System.out.println("set do tokenizer button value to "+!skip);
-//		doTokenizeStepButton.setSelection(!skip);
-//		updateFieldsEnableState();
-//		
-////		Object value = tokenizerElem.getAttribute(Messages.CorpusPage_51);
-////		try {
-////			setAddSetTestsButton.setSelection(Boolean.parseBoolean(value.toString()));
-////		} catch (Exception e) { };
+		if (this.section.isDisposed()) return;
+		if (project == null) return;
+
+
+		textWhiteSpaces.setText(project.getTokenizerParameter("whitepaces", TokenizerClasses.whitespaces));
+		textPuncts.setText(project.getTokenizerParameter("regPunct", TokenizerClasses.regPunct));
+		textPunctsStrong.setText(project.getTokenizerParameter("punct_strong", TokenizerClasses.punct_strong));
+		textElisions.setText(project.getTokenizerParameter("regElision", TokenizerClasses.regElision));
+
+		String wtagElement = project.getTokenizerParameter("wordelement", "w");
+		wordElementText.setText(wtagElement);
+
+		boolean doTokenizeStep = project.getDoTokenizerStep();
+		doTokenizeStepButton.setSelection(doTokenizeStep);
+		updateFieldsEnableState();
+
+//		HashMap<String, TTest> additionalTests = project.getTokenizerAdditionalTests();
+//		try {
+//			setAddSetTestsButton.setSelection(Boolean.parseBoolean(value.toString()));
+//		} catch (Exception e) { };
 	}
 
 	@Override
 	public boolean save(Project project) {
-		
+
 		if (textWhiteSpaces.getText().length() == 0 && textPuncts.getText().length() == 0) {
 			System.out.println("Error while saving tokenizer parameters: whitespace and punctuation regular expressions are both empty.");
 			return false;
@@ -347,6 +330,7 @@
 		project.addTokenizerParameter("wordelement", wordElementText.getText()); //$NON-NLS-1$
 		project.addTokenizerParameter("doTokenizeStep", ""+!doTokenizeStepButton.getSelection()); //$NON-NLS-1$
 		project.addTokenizerParameter("onlyThoseTests", "false"); //$NON-NLS-1$
+		//project.setTokenizerAdditionalTests(additionalTokenizerTests); //$NON-NLS-1$
 
 		return true;
 	}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java	(revision 1110)
@@ -1,7 +1,6 @@
 package org.txm.rcp.editors.imports.sections;
 
 import java.io.File;
-import java.util.Arrays;
 import java.util.LinkedHashMap;
 
 import org.eclipse.jface.viewers.ISelection;
@@ -26,17 +25,14 @@
 import org.eclipse.ui.forms.widgets.TableWrapData;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.Project;
 import org.txm.rcp.editors.TableKeyListener;
 import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.swt.dialog.MultipleValueDialog;
-import org.txm.rcp.swt.provider.ElementColumnLabelProvider;
+import org.txm.rcp.swt.provider.HashMapContentProvider;
 import org.txm.rcp.swt.provider.HashMapLabelProvider;
-import org.txm.rcp.swt.provider.NodeListContentProvider;
-import org.w3c.dom.Element;
 
 public class FrontXSLSection extends ImportEditorSection {
 	
@@ -176,7 +172,7 @@
 		gd.colspan = 4;
 		gd.heightHint = 100;
 		xsltParamsViewer.getTable().setLayoutData(gd);
-		xsltParamsViewer.setContentProvider(new NodeListContentProvider());
+		xsltParamsViewer.setContentProvider(new HashMapContentProvider());
 		xsltParamsViewer.getTable().setHeaderVisible(true);
 		xsltParamsViewer.getTable().setLinesVisible(true);
 
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 1109)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 1110)
@@ -997,12 +997,13 @@
 		wdialog.open();
 
 		project = wiz.getProject();
-		//TODO currently the script directory is the same as the import name
-		project.setImportModuleName(editor.getGroovyScript().getParentFile().getName());
 		if (project == null) {
+			System.out.println("Error: no project created");
 			return;
 		}
-
+		//TODO currently the script directory is the same as the import name
+		project.setImportModuleName(editor.getGroovyScript().getParentFile().getName());
+		
 		try {
 			loadParams();
 
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/provider/HashMapContentProvider.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/provider/HashMapContentProvider.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/provider/HashMapContentProvider.java	(revision 1110)
@@ -0,0 +1,34 @@
+package org.txm.rcp.swt.provider;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class HashMapContentProvider implements IContentProvider, IStructuredContentProvider {
+
+	@Override
+	public Object[] getElements(Object inputElement) {
+		Set list = ((HashMap)inputElement).entrySet();
+		Object[] objs = new Object[list.size()];
+		int i = 0;
+		for (Object o : list) {
+			objs[i] = o;
+		}
+		return objs;
+	}
+
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/provider/HashMapContentProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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 1109)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 1110)
@@ -1521,6 +1521,11 @@
 		}
 	}
 
+
+	public void flush() {
+		TXMPreferences.flush(preferencesNode);
+	}
+
 	//FIXME: this code is dedicated to dynamically retrieve the static field PREFERENCES_NODE of the runtime subclass and use it super class to avoid to pass it to all methods.
 	// eg. to use ProgressionPreferences.getBoolean("test") instead of TXMPreferences.getBoolean(ProgressionPreferences.PREFERENCES_NODE, "test")
 	// but it doesn"t work, need to continue the tests...
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1109)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1110)
@@ -142,24 +142,34 @@
 		}
 
 		if (!rcpProject.exists()) {
-			rcpProject.create(monitor);
-			rcpProject.open(monitor);
-			rcpProject.getDescription().setNatureIds(new String[] {"org.txm.core.CorpusNature"});
-			
-			IFolder srcFolder = rcpProject.getFolder("src");
-			IPath path = new Path(pSrcDirectory.getAbsolutePath());
-			if (!srcFolder.exists()) {
-				srcFolder.createLink(path, IResource.ALLOW_MISSING_LOCAL, monitor);
-			}
+			createRCPProject();
 		}
 
 		if (!rcpProject.isOpen()) {
-			rcpProject.open(monitor);
+			try {
+				rcpProject.open(monitor);
+			} catch (Exception e) {
+				System.out.println("Warning: restoring corpus project files...");
+				rcpProject.delete(true, monitor);
+				createRCPProject();
+			}
 		}
 
 		this.preferenceScope = new ProjectScope(rcpProject);
 	}
 
+	private void createRCPProject() throws CoreException {
+		rcpProject.create(monitor);
+		rcpProject.open(monitor);
+		rcpProject.getDescription().setNatureIds(new String[] {"org.txm.core.CorpusNature"});
+		
+		IFolder srcFolder = rcpProject.getFolder("src");
+		IPath path = new Path(pSrcDirectory.getAbsolutePath());
+		if (!srcFolder.exists()) {
+			srcFolder.createLink(path, IResource.ALLOW_MISSING_LOCAL, monitor);
+		}
+	}
+
 	public Project(String uuid) throws CoreException {
 		super(uuid);
 		initRCPStuffs();
@@ -840,6 +850,16 @@
 		IEclipsePreferences params = this.getPreferences().getNode("Tokenizer");
 		params.put(name, value);
 	}
+	
+	public String getTokenizerParameter(String name, String defaultvalue) {
+		IEclipsePreferences params = this.getPreferences().getNode("Tokenizer");
+		return params.get(name, defaultvalue);
+	}
+	
+	public boolean getDoTokenizerStep() {
+		IEclipsePreferences params = this.getPreferences().getNode("Tokenizer");
+		return params.getBoolean("doTokenizeStep", true);
+	}
 
 	public EditionDefinition getEditionDefinition(String name) {
 		return new EditionDefinition(this, name);
Index: tmp/org.txm.core/src/java/org/txm/objects/Text.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 1109)
+++ tmp/org.txm.core/src/java/org/txm/objects/Text.java	(revision 1110)
@@ -274,7 +274,7 @@
 
 	@Override
 	public void clean() {
-		if (pTXMFile.exists()) {
+		if (pTXMFile != null && pTXMFile.exists()) {
 			pTXMFile.delete();
 		}
 	}
Index: tmp/org.txm.core/src/java/org/txm/objects/Edition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 1109)
+++ tmp/org.txm.core/src/java/org/txm/objects/Edition.java	(revision 1110)
@@ -351,11 +351,15 @@
 		String names = this.getStringParameterValue(TBXPreferences.NAMES);
 		if (names != null && names.length() > 0) {
 			pPageNames = new ArrayList<>(Arrays.asList(names.split("\t")));
+		} else {
+			pPageNames = new ArrayList<>();
 		}
 
 		String wordids = this.getStringParameterValue("pages_wordids");
 		if (wordids != null && wordids.length() > 0) {
 			pPageFirstWordIds = new ArrayList<>(Arrays.asList(wordids.split("\t")));
+		} else {
+			pPageFirstWordIds = new ArrayList<>();
 		}
 		
 		if (pages == null) {
@@ -363,7 +367,7 @@
 		} else {
 			pages.clear();
 		}
-		
+
 		for (int i = 0 ; i < pPageNames.size() && i < pPageFirstWordIds.size() ; i++) {
 			pages.add(new Page(this, pPageNames.get(i), pPageFirstWordIds.get(i)));
 		}
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/view/ElementSearchView.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/view/ElementSearchView.java	(revision 1109)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/view/ElementSearchView.java	(revision 1110)
@@ -321,7 +321,7 @@
 		});
 
 		concordanceButton = new Button(buttons, SWT.PUSH);
-		concordanceButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_CONCORDANCES));
+		concordanceButton.setImage(IImageKeys.getImage(ConcordanceEditor.class, IImageKeys.ACTION_CONCORDANCES));
 		concordanceButton.setToolTipText("View the matches in concordances");
 		concordanceButton.addSelectionListener(new SelectionListener() {
 			@Override
Index: tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java
===================================================================
--- tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 1109)
+++ tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 1110)
@@ -213,7 +213,8 @@
 		propertiesSelector.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
 		propertiesSelector.setLayout(new GridLayout(3, false));
 		try {
-			propertiesSelector.setProperties(index.getCorpus().getOrderedProperties());
+			List<WordProperty> props = index.getCorpus().getOrderedProperties();
+			propertiesSelector.setProperties(props);
 		}
 		catch (CqiClientException e) {
 			Log.printStackTrace(e);
Index: tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java
===================================================================
--- tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java	(revision 1109)
+++ tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java	(revision 1110)
@@ -214,6 +214,7 @@
 	 * @return the left context size
 	 */
 	public int getLeftContextSize() {
+//		if (leftCtxViewPropertiesValues.values().size() == 0) return 0;
 		return leftCtxViewPropertiesValues.values().iterator().next().size();
 	}
 
@@ -223,6 +224,7 @@
 	 * @return the keywords size
 	 */
 	public int getKeywordsSize() {
+//		if (keywordsViewValues.values().size() == 0) return 0;
 		return keywordsViewValues.values().iterator().next().size();
 	}
 
@@ -232,6 +234,7 @@
 	 * @return the right context size
 	 */
 	public int getRightContextSize() {
+//		if (rightCtxViewValues.values().size() == 0) return 0;
 		return rightCtxViewValues.values().iterator().next().size();
 	}
 
@@ -472,8 +475,7 @@
 		int start = this.getLeftContextSize() - max;
 		for (int i = start; i < this.getLeftContextSize(); i++) {
 			List<String> word = new ArrayList<String>();
-			for (Property property : concordance.getLeftViewProperties())
-			{
+			for (Property property : concordance.getLeftViewProperties()) {
 //				if(propertiesToProcess.contains(property.getName()))
 //					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
 //				else
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 1109)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 1110)
@@ -539,6 +539,8 @@
 	 */
 	@Override
 	public MainCorpus getMainCorpus() {
+		if (this instanceof MainCorpus) return (MainCorpus) this;
+		
 		return (MainCorpus) getFirstParent(MainCorpus.class);
 	}
 	
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy	(revision 1110)
@@ -43,10 +43,9 @@
 import org.txm.importer.*
 
 String userDir = System.getProperty("user.home");
-boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
+
 def MONITOR;
 Project project;
-boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
 
 try {project=projectBinding;MONITOR=monitor} catch (Exception)
 {	}
@@ -146,7 +145,7 @@
 c.setLang(lang);
 c.setAnnotationSuccess(annotationSuccess)
 if (debug) c.setDebug();
-if (!c.run(binDir, txmDir, corpusname)) {
+if (!c.run(project)) {
 	println "Import process stopped";
 	return;
 }
@@ -165,7 +164,8 @@
 	Collections.sort(filelist);
 	def second = 0
 
-
+	println "Paginating texts: "
+	
 	for (File srcfile : filelist) {
 		print "."
 		String txtname = srcfile.getName();
@@ -191,6 +191,7 @@
 		}
 	}
 }
+
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
 
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/compiler.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/compiler.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/compiler.groovy	(revision 1110)
@@ -34,9 +34,9 @@
 import org.txm.scripts.importer.*;
 import org.txm.scripts.*;
 import org.txm.importer.scripts.xmltxm.*;
-import org.txm.objects.Project
+import org.txm.objects.*
 import org.txm.utils.treetagger.TreeTagger;
-
+import org.txm.searchengine.cqp.corpus.*
 import javax.xml.stream.*;
 
 import java.net.URL;
@@ -176,13 +176,13 @@
 		File txmDir = new File(binDir, "txm/"+corpusname)
 		
 		if (!(CwbEncode.isExecutableAvailable() && CwbMakeAll.isExecutableAvailable())) {
-			println ("Error: CWB executables not well set.")
+			println ("Error: CWB executables rights are not well setted.")
 			return false;
 		}
 		
 		CorpusBuild corpus = project.getCorpusBuild(project.getName());
 		if (corpus != null) {
-			println "CLEAN PREVIOUS CORPUS"
+			//println "CLEAN PREVIOUS CORPUS"
 			corpus.delete(); // remove old files
 		}
 			
@@ -190,7 +190,7 @@
 		corpus = new MainCorpus(project);
 		corpus.setID(project.getName());
 		corpus.setName(project.getName());
-		corpus.setDescription("Build the alceste import module");
+		corpus.setDescription("Built with the TXT+CSV import module");
 		
 		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
 		new File(binDir,"cqp").mkdirs()
@@ -215,7 +215,7 @@
 			print "."
 			cqpbuilder = new XMLTXM2CQP(txmfile.toURI().toURL());
 			String txtname = txmfile.getName().substring(0,txmfile.getName().length()-4);
-			cqpbuilder.setTextInfo(txtname, this.base, this.project);
+			cqpbuilder.setTextInfo(txtname, this.base, project.getName());
 
 			cqpbuilder.setBalisesToKeep(["text","s"]);
 			cqpbuilder.setSendToPAttributes(["lb":["n"]]);
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/alcesteLoader.groovy	(revision 1110)
@@ -113,9 +113,9 @@
 new File(binDir,"HTML/$corpusname").mkdirs();
 if (build_edition) {
 	
-	if (MONITOR != null) MONITOR.worked(20, "EDITION")
-
 	println "-- EDITION - Building edition"
+	if (MONITOR != null) MONITOR.worked(20, "EDITION")
+	
 	File outdir = new File(binDir,"/HTML/$corpusname/default/");
 	outdir.mkdirs();
 	List<File> filelist = txmDir.listFiles();
@@ -128,18 +128,17 @@
 		print "."
 		String txtname = srcfile.getName();
 		int i = txtname.lastIndexOf(".");
-		if(i > 0) txtname = txtname.substring(0, i);
+		if (i > 0) txtname = txtname.substring(0, i);
 
 		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
 		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 
-		//Element text = params.addText(params.corpora.get(corpusname), txtname, srcfile);
 		Text t = new Text(project);
 		t.setName(txtname);
 		t.setSourceFile(srcfile)
 		t.setTXMFile(srcfile)
+		
 		def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
-		//Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
 		Edition edition = new Edition(t);
 		edition.setName("default");
 		edition.setIndex(outdir.getAbsolutePath());
@@ -153,6 +152,5 @@
 
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
-//File paramFile = new File(binDir, "import.xml");
-//DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
+
 readyToLoad = project.save();
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/compiler.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/compiler.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/compiler.groovy	(revision 1110)
@@ -40,7 +40,7 @@
 import org.txm.scripts.*
 import org.txm.importer.scripts.xmltxm.*
 import org.txm.utils.treetagger.TreeTagger
-
+import org.txm.objects.*
 import javax.xml.stream.*
 
 import java.net.URL
@@ -51,6 +51,7 @@
 import java.util.HashSet
 import org.txm.metadatas.*
 import org.txm.utils.io.FileCopy
+import org.txm.searchengine.cqp.corpus.*
 
 /**
  * The "compiler" Class of the XML/w import module.
@@ -95,9 +96,6 @@
 	/** The base. */
 	String base="";
 
-	/** The project. */
-	String project="";
-
 	/** The text attributes. */
 	String[] textAttributes = null;
 
@@ -127,11 +125,10 @@
 	 * @param base the base
 	 * @param project the project
 	 */
-	public compiler(URL url, String text, String base, String project)
+	public compiler(URL url, String text, String base, String projectName)
 	{
 		this.text = text
 		this.base = base;
-		this.project = project;
 		this.textAttributes = textAttributes;
 		try {
 			this.url = url;
@@ -212,7 +209,7 @@
 	 * @param fileName the file name
 	 * @return true, if successful
 	 */
-	public boolean transfomFileCqp(File cqpFile, HashMap<String, String> textmetadata)
+	public boolean transfomFileCqp(Project project, File cqpFile, HashMap<String, String> textmetadata)
 	{
 		if (!createOutput(cqpFile))
 			return false;
@@ -251,7 +248,7 @@
 							case "text":
 								sattrsListener.startElement(localname);
 								foundtext = true;
-								output.write("<text id=\""+text+"\" base=\""+base+"\"" + " project=\""+project+"\"");
+								output.write("<text id=\""+text+"\" base=\""+base+"\"" + " project=\""+project.getName()+"\"");
 							//							for (String name : textmetadata.keySet())
 							//								output.write(" "+name+"=\""+textmetadata.get(name)+"\"")
 								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
@@ -439,7 +436,7 @@
 	 * @param srcfiles the srcfiles
 	 * @return true, if successful
 	 */
-	public boolean run(File binDir, File txmDir, String corpusname, String[] textAttributes, def srcfiles, Metadatas metadatas)
+	public boolean run(Project project, File binDir, File txmDir, String corpusname, String[] textAttributes, def srcfiles, Metadatas metadatas)
 	{
 		sattrsListener = null; // reset SAttribute Listener for each new import
 		String rootDir = binDir.getAbsolutePath();
@@ -447,24 +444,34 @@
 		anavalues = [:] // reset
 		
 		if (!(CwbEncode.isExecutableAvailable() && CwbMakeAll.isExecutableAvailable())) {
-			println ("Error: CWB executables not well set.")
+			println ("Error: CWB executables rights are not well setted.")
 			return false;
 		}
-		if (!binDir.exists()) {
-			println ("binary directory does not exists: "+binDir)
-			return false;
+		
+		CorpusBuild corpus = project.getCorpusBuild(project.getName());
+		if (corpus != null) {
+			//println "CLEAN PREVIOUS CORPUS"
+			corpus.delete(); // remove old files
 		}
+		
+		// make new one
+		corpus = new MainCorpus(project);
+		corpus.setID(project.getName());
+		corpus.setName(project.getName());
+		corpus.setDescription("Built with the XML/w import module");
+		
+		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
+		new File(binDir,"cqp").mkdirs()
+		new File(binDir,"data").mkdirs()
+		new File(binDir,"registry").mkdirs()
 
-		File cqpFile = new File(binDir, "cqp/"+corpusname+".cqp")
-		new File(binDir, "cqp").deleteDir()
-		new File(binDir, "cqp").mkdir()
-		new File(binDir, "data").deleteDir()
-		new File(binDir, "data").mkdir()
-		new File(binDir, "registry").mkdir()
-
 		String textid = ""
 		int counttext = 0
-		List<File> files = txmDir.listFiles()
+		List<File> files = txmDir.listFiles(new FileFilter() {
+			public boolean accept(File f) {
+				return !f.isDirectory() && !f.isHidden() && f.getName().endsWith(".xml");
+			}
+		});
 		//1- Transform into CQP file
 		def builder = null
 
@@ -522,7 +529,7 @@
 				String txtname = f.getName().substring(0,f.getName().length()-4)
 				builder = new compiler(f.toURI().toURL(), txtname, corpusname, "default")
 				builder.setLang(lang);
-				if (!builder.transfomFileCqp(cqpFile, textmetadata)) {
+				if (!builder.transfomFileCqp(project, cqpFile, textmetadata)) {
 					println("Failed to compile "+f)
 				}
 			}
@@ -689,6 +696,8 @@
 			cwbMa.run(corpusname, outDir + "/registry");
 		} catch (Exception ex) {System.out.println(ex); return false;}
 
+		println "CORPUS="+corpus
+		
 		return true;
 	}
 
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 1110)
@@ -51,44 +51,28 @@
 String userDir = System.getProperty("user.home");
 
 def MONITOR;
-boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
-BaseParameters params;
-try {params = paramsBinding;MONITOR=monitor} catch (Exception)
-{	println "DEV MODE";//exception means we debug
-	debug = true
-	params = new BaseParameters(new File(userDir, "xml/bvh/bugnames/import.xml"))
-	params.load()
-	if (!org.txm.Toolbox.isInitialized()) {
+Project project;
 
-		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
-		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
-		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
-		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
-		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
-		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
-		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
-		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
-	}
-}
-if (params == null) { println "no parameters. Aborting"; return; }
+try {project=projectBinding;MONITOR=monitor} catch (Exception)
+{	}
+if (project == null) { println "no project set. Aborting"; return; }
 
-String corpusname = params.getCorpusName();
-Element corpusElem = params.corpora.get(corpusname);
-String basename = params.name;
-String rootDir = params.rootDir;
-String lang = corpusElem.getAttribute("lang");
+String corpusname = project.getName();
+String basename = corpusname
+String rootDir = project.getSrcdir();
+String lang = project.getLang()
 String model = lang
-String encoding = corpusElem.getAttribute("encoding");
-boolean annotate = "true" == corpusElem.getAttribute("annotate");
-String xsl = params.getXsltElement(corpusElem).getAttribute("xsl")
-def xslParams = params.getXsltParams(corpusElem);
-int wordsPerPage = params.getWordsPerPage("default")
-String page_element = params.getPageElement("default")
-boolean build_edition = params.getDoEdition("default")
+String encoding = project.getEncoding()
+boolean annotate = project.getAnnotate()
+String xsl = project.getFrontXSL();
+def xslParams = project.getXsltParameters();
+int wordsPerPage = project.getEditionDefinition("default").getWordsPerPage()
+String page_element = project.getEditionDefinition("default").getPageElement()
+boolean build_edition = project.getEditionDefinition("default").getBuildEdition()
+boolean skipDoTokenizeStep = project.getDoTokenizerStep()
 
 File srcDir = new File(rootDir);
-File binDir = new File(Toolbox.getTxmHomePath(), "corpora/"+basename);
-binDir.deleteDir();
+File binDir = project.getProjectDirectory()
 binDir.mkdirs();
 if (!binDir.exists()) {
 	println "Could not create binDir "+binDir
@@ -200,7 +184,7 @@
 println "-- IMPORTER - Reading source files"
 def imp = new importer();
 imp.doValidation(true) // change this to not validate xml
-boolean skipDoTokenizeStep = params.getSkipTokenization()
+
 imp.doTokenize(!skipDoTokenizeStep) // change this, to not tokenize xml
 imp.setStopIfMalformed(stopIfMalformed);
 if (!imp.run( srcDir, binDir, txmDir, basename, ignoredElements, lang)) {
@@ -252,7 +236,7 @@
 c.setOptions(textSortAttribute, normalizeMetadata);
 c.setAnnotationSuccess(annotationSuccess)
 c.setLang(lang);
-if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+if (!c.run(project, binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
 	println "import process stopped";
 	return;
 }
@@ -283,20 +267,25 @@
 		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
 		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 
-		Element text = params.addText(corpusElem, txtname, txmFile);
+		Text t = new Text(project);
+		t.setName(txtname);
+		t.setSourceFile(txmFile)
+		t.setTXMFile(txmFile)
 
 		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, page_element);
-		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
+		Edition edition = new Edition(t);
+		edition.setName("default");
+		edition.setIndex(outdir.getAbsolutePath());
 
 		for (i = 0 ; i < ed.getPageFiles().size();) {
 			File f = ed.getPageFiles().get(i);
 			String wordid = ed.getIdx().get(i);
-			params.addPage(edition, ""+(++i), wordid);
+			edition.addPage(""+(++i), wordid);
 		}
 	}
 }
 
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
-File paramFile = new File(binDir, "import.xml");
-DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
+
+readyToLoad = project.save();
\ No newline at end of file
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 1110)
@@ -52,39 +52,27 @@
 String userDir = System.getProperty("user.home");
 
 def MONITOR;
-boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
-BaseParameters params;
-try {params = paramsBinding;MONITOR=monitor} catch (Exception)
-{	println "DEV MODE";//exception means we debug
-	debug = true
-	params = new BaseParameters(new File(userDir, "xml/doc/import.xml"))
-	params.load()
-	if (!org.txm.Toolbox.isInitialized()) {
-		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
-		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
-		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
-		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
-		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
-		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
-		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
-		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
-	}
-}
-if (params == null) { println "no parameters. Aborting"; return; }
+Project project;
 
-String corpusname = params.getCorpusName();
-Element corpusElem = params.corpora.get(corpusname);
-String basename = params.name;
-String rootDir = params.rootDir;
-String lang = corpusElem.getAttribute("lang");
+try {project=projectBinding;MONITOR=monitor} catch (Exception)
+{	}
+if (project == null) { println "no project set. Aborting"; return; }
+
+String corpusname = project.getName();
+String basename = corpusname
+String rootDir = project.getSrcdir();
+String lang = project.getLang()
 String model = lang
-boolean annotate = "true" == corpusElem.getAttribute("annotate");
-int wordsPerPage = params.getWordsPerPage("default")
-boolean build_edition = params.getDoEdition("default")
+String encoding = project.getEncoding()
+boolean annotate = project.getAnnotate()
+String xsl = project.getFrontXSL();
+def xslParams = project.getXsltParameters();
+int wordsPerPage = project.getEditionDefinition("default").getWordsPerPage()
+String page_element = project.getEditionDefinition("default").getPageElement()
+boolean build_edition = project.getEditionDefinition("default").getBuildEdition()
 
 File srcDir = new File(rootDir);
-File binDir = new File(Toolbox.getTxmHomePath(), "corpora/"+basename);
-binDir.deleteDir();
+File binDir = project.getProjectDirectory();
 binDir.mkdirs();
 if (!binDir.exists()) {
 	println "Could not create binDir "+binDir
@@ -128,7 +116,7 @@
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(20, "CREATING TEI FILES")
 println "-- CONVERTER - Converting source files"
-File xsldir = new File(Toolbox.getPreference(TBXPreferences.INSTALL_DIR), "redist/xsl")
+File xsldir = new File(Toolbox.getTxmHomePath(), "xsl")
 if (!DocumentToTei.processFiles(srcfiles, txmDir, xsldir)) {
 	println "Abord import"
 	return;
@@ -185,9 +173,7 @@
 
 // filtering
 println "Filtering XML files with xpaths: [//tei:term]"
-def xpaths = params.getExcludeXpaths()
-if (xpaths == null) xpaths = ["//tei:term"]
-else xpaths << "//tei:term"
+def xpaths = ["//tei:term"]
 
 if (xpaths != null) {
 	println "Filtering XML files with xpaths: $xpaths"
@@ -285,7 +271,7 @@
 c.setOptions(textSortAttribute, normalizeMetadata);
 c.setAnnotationSuccess(annotationSuccess)
 c.setLang(lang);
-if (!c.run(binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
+if (!c.run(project, binDir, txmDir, corpusname, null, srcfiles, metadatas)) {
 	println "import process stopped";
 	return;
 }
@@ -318,15 +304,19 @@
 		List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
 		List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 
-		Element text = params.addText(corpusElem, txtname, txmFile);
+		Text t = new Text(project);
+		t.setName(txtname);
+		t.setSourceFile(txmFile)
+		t.setTXMFile(txmFile)
 
 		def ed = new pager(txmFile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, wordsPerPage, basename, "pb");
-		Element edition = params.addEdition(text, "default", outdir.getAbsolutePath(), "html");
-
+		Edition edition = new Edition(t);
+		edition.setName("default");
+		edition.setIndex(outdir.getAbsolutePath());
 		for (i = 0 ; i < ed.getPageFiles().size();) {
 			File f = ed.getPageFiles().get(i);
 			String wordid = ed.getIdx().get(i);
-			params.addPage(edition, ""+(++i), wordid);
+			edition.addPage(""+(++i), wordid);
 		}
 	}
 
@@ -362,5 +352,5 @@
 
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(20, "FINALIZING")
-File paramFile = new File(binDir, "import.xml");
-DomUtils.save(params.root.getOwnerDocument(), paramFile);readyToLoad = true;
\ No newline at end of file
+
+readyToLoad = project.save();
\ No newline at end of file
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy	(revision 1109)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/pager.groovy	(revision 1110)
@@ -2,19 +2,19 @@
 // Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
 // Lyon 2, University of Franche-Comté, University of Nice
 // Sophia Antipolis, University of Paris 3.
-// 
+//
 // The TXM platform is free software: you can redistribute it
 // and/or modify it under the terms of the GNU General Public
 // License as published by the Free Software Foundation,
 // either version 2 of the License, or (at your option) any
 // later version.
-// 
+//
 // The TXM platform is distributed in the hope that it will be
 // useful, but WITHOUT ANY WARRANTY; without even the implied
 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 // PURPOSE. See the GNU General Public License for more
 // details.
-// 
+//
 // You should have received a copy of the GNU General
 // Public License along with the TXM platform. If not, see
 // http://www.gnu.org/licenses.
@@ -108,7 +108,7 @@
 
 	/** The multiwriter. */
 	OutputStreamWriter multiwriter = null;
-	
+
 	/** The pagedWriter. */
 	StaxStackWriter pagedWriter = null;
 
@@ -264,211 +264,220 @@
 	 */
 	void process() {
 		try {
-		String localname = "";
-		String figurerend = ""
-		boolean unordered = false;
-		createNextOutput();
-		
-		gotoText();
-		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-			switch (event) {
-				case XMLStreamConstants.START_ELEMENT:
-					localname = parser.getLocalName();
-					
-					if (localname == editionPage) {
-						createNextOutput();
-						wordcount=0;
-						if (parser.getAttributeValue(null,"n") != null) {
-							pagedWriter.writeStartElement("p", ["style":"color:red", "align":"center"])
-							pagedWriter.writeCharacters("- "+parser.getAttributeValue(null,"n")+" -")
-							pagedWriter.writeEndElement() // p
+			String localname = "";
+			String figurerend = ""
+			boolean unordered = false;
+			createNextOutput();
+
+			gotoText();
+			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+				switch (event) {
+					case XMLStreamConstants.START_ELEMENT:
+						localname = parser.getLocalName();
+
+						if (localname == editionPage) {
+							createNextOutput();
+							wordcount=0;
+							if (parser.getAttributeValue(null,"n") != null) {
+								pagedWriter.writeStartElement("p", ["style":"color:red", "align":"center"])
+								pagedWriter.writeCharacters("- "+parser.getAttributeValue(null,"n")+" -")
+								pagedWriter.writeEndElement() // p
+							}
 						}
-					}
-					
-					switch (localname) {
-						case "textunit":
-							if (parser.getAttributeValue(null,"id") != null) {
-								pagedWriter.writeStartElement("h3")
-								pagedWriter.writeCharacters(parser.getAttributeValue(null,"id"))
-								pagedWriter.writeEndElement() // h3
-							}
-							pagedWriter.writeStartElement("table")
-							for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+
+						switch (localname) {
+							case "textunit":
+								if (parser.getAttributeValue(null,"id") != null) {
+									pagedWriter.writeStartElement("h3")
+									pagedWriter.writeCharacters(parser.getAttributeValue(null,"id"))
+									pagedWriter.writeEndElement() // h3
+								}
+								pagedWriter.writeStartElement("table")
+								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+									pagedWriter.writeStartElement("tr")
+									pagedWriter.writeStartElement("td")
+									pagedWriter.writeCharacters(parser.getAttributeLocalName(i))
+									pagedWriter.writeEndElement() // td
+									pagedWriter.writeStartElement("td")
+									pagedWriter.writeCharacters(parser.getAttributeValue(i))
+									pagedWriter.writeEndElement() // td
+									pagedWriter.writeEndElement() // tr
+								}
+								pagedWriter.writeEndElement() // table
+								pagedWriter.writeEmptyElement("br")
+								break;
+							case "head":
+								String rend = parser.getAttributeValue(null, "rend")
+								if (rend == null) rend = "normal"
+								pagedWriter.writeStartElement("h2", ["class":rend])
+								break;
+							case "figure":
+								figurerend = parser.getAttributeValue(null, "rend")
+								break;
+							case "graphic":
+								String url = parser.getAttributeValue(null, "url")
+								if (url.startsWith("..//")) url = url.substring(4);
+								else if (url.startsWith("../")) url = url.substring(3);
+
+								if (url != null) {
+									pagedWriter.writeStartElement("div")
+									pagedWriter.writeEmptyElement("img", ["class":figurerend, "src":url])
+									pagedWriter.writeEndElement() // div
+								}
+								figurerend = "";
+								break;
+							case "lg":
+							case "p":
+							case "q":
+								String rend = parser.getAttributeValue(null, "rend")
+								if (rend == null) rend = "normal"
+								pagedWriter.writeStartElement("p", ["class":rend])
+								break;
+							//case "pb":
+							case "table":
+								pagedWriter.writeStartElement("table", ["class":parser.getAttributeValue(null, "rend")])
+								break;
+							case "row":
 								pagedWriter.writeStartElement("tr")
+								break;
+							case "cell":
 								pagedWriter.writeStartElement("td")
-								pagedWriter.writeCharacters(parser.getAttributeLocalName(i))
-								pagedWriter.writeEndElement() // td
-								pagedWriter.writeStartElement("td")
-								pagedWriter.writeCharacters(parser.getAttributeValue(i))
-								pagedWriter.writeEndElement() // td
-								pagedWriter.writeEndElement() // tr
-							}
-							pagedWriter.writeEndElement() // table
-							pagedWriter.writeEmptyElement("br")
-							break;
-						case "head":
-							String rend = parser.getAttributeValue(null, "rend")
-							if (rend == null) rend = "normal"
-							pagedWriter.writeStartElement("h2", ["class":rend])
-							break;
-						case "figure":
-							figurerend = parser.getAttributeValue(null, "rend")
-							break;
-						case "graphic":
-							String url = parser.getAttributeValue(null, "url")
-							if (url.startsWith("..//")) url = url.substring(4);
-							else if (url.startsWith("../")) url = url.substring(3);
+								break;
+							case "lb":
+							case "br":
+								pagedWriter.writeEmptyElement("br")
+								break;
+							case "list":
+								String type = parser.getAttributeValue(null,"type");
+								if ("unordered" == type) {
+									unordered = true;
+									pagedWriter.writeStartElement("ul")
+								} else {
+									unordered = false
+									pagedWriter.writeStartElement("ol")
+								}
+								break
+							case "item":
+								pagedWriter.writeStartElement("li")
+								break;
+							case "hi":
+								pagedWriter.writeStartElement("b")
+								break;
+							case "emph":
+								pagedWriter.writeStartElement("i")
+								break;
+							case "w":
+								wordid = parser.getAttributeValue(null,"id");
 
-							if (url != null) { 
-								pagedWriter.writeStartElement("div")
-								pagedWriter.writeEmptyElement("img", ["class":figurerend, "src":url])
-								pagedWriter.writeEndElement() // div
-							}
-							figurerend = "";
-							break;
-						case "lg":
-						case "p":
-						case "q":
-							String rend = parser.getAttributeValue(null, "rend")
-							if (rend == null) rend = "normal"
-							pagedWriter.writeStartElement("p", ["class":rend])
-							break;
-						//case "pb":
-						case "table":
-							pagedWriter.writeStartElement("table", ["class":parser.getAttributeValue(null, "rend")])
-							break;
-						case "row":
-							pagedWriter.writeStartElement("tr")
-							break;
-						case "cell":
-							pagedWriter.writeStartElement("td")
-							break;
-						case "lb":
-						case "br":
-							pagedWriter.writeEmptyElement("br")
-							break;
-						case "w":
-							wordid = parser.getAttributeValue(null,"id");
+								if (firstWord) {
+									firstWord = false;
+									this.idxstart.add(wordid);
+								}
+								wordcount++;
 
-							if (firstWord) {
-								firstWord = false;
-								this.idxstart.add(wordid);
-							}
-							wordcount++;
+								break;
+							case "ana":
+								flaginterp=true;
+								interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
+								break;
 
-							break;
-						case "list":
-							String type = parser.getAttributeValue(null,"type");
-							if ("unordered" == type) {
-								unordered = true;
-								pagedWriter.writeStartElement("ul")
-							} else {
-								unordered = false
-								pagedWriter.writeStartElement("ol")
-							}
-							break
-						case "item":
-							pagedWriter.writeStartElement("li")
-							break;
-						case "hi":
-							pagedWriter.writeStartElement("b")
-							break;
-						case "emph":
-							pagedWriter.writeStartElement("i")
-							break;
-						case "ana":
-							flaginterp=true;
-							interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
-							break;
+							case "form":
+								wordvalue="";
+								interpvalue ="";
+								flagform=true;
+						}
+						break;
+					case XMLStreamConstants.END_ELEMENT:
+						localname = parser.getLocalName();
+						switch(localname)
+						{
+							case "head":
+								pagedWriter.writeEndElement(); // h2
+								pagedWriter.writeCharacters("\t")
+								break;
+							case "lg":
+							case "p":
+							case "q":
+								pagedWriter.writeEndElement(); // p
+								pagedWriter.writeCharacters("\t")
+								if (wordcount >= wordmax) {
+									createNextOutput();
+								}
+								break;
+							case "list":
+								pagedWriter.writeEndElement(); // ul or ol
+								pagedWriter.writeCharacters("\t")
+								break
+							case "item":
+								pagedWriter.writeEndElement(); // li
+								pagedWriter.writeCharacters("\t")
+								break;
+							case "hi":
+								pagedWriter.writeEndElement(); // b
+								break;
+							case "emph":
+								pagedWriter.writeEndElement(); // i
+								break;
+							case "table":
+								pagedWriter.writeEndElement(); // table
+								pagedWriter.writeCharacters("\t")
+								break;
+							case "row":
+								pagedWriter.writeEndElement(); // tr
+								pagedWriter.writeCharacters("\t")
+								break;
+							case "cell":
+								pagedWriter.writeEndElement(); // td
+								break;
+							case "form":
+								flagform = false
+								break;
+							case "ana":
+								flaginterp = false
+								break;
+							case "w":
+								int l = lastword.length();
+								String endOfLastWord = "";
+								if (l > 0)
+									endOfLastWord = lastword.subSequence(l-1, l);
 
-						case "form":
-							wordvalue="";
-							interpvalue ="";
-							flagform=true;
-					}
-					break;
-				case XMLStreamConstants.END_ELEMENT:
-					localname = parser.getLocalName();
-					switch(localname)
-					{
-						case "head":
-							pagedWriter.writeEndElement(); // h2
-							break;
-						case "lg":
-						case "p":
-						case "q":
-							pagedWriter.writeEndElement(); // p
-							if (wordcount >= wordmax) {
-								createNextOutput();
-							}
-							break;
-						case "list":
-							pagedWriter.writeEndElement(); // ul or ol
-							break
-						case "item":
-							pagedWriter.writeEndElement(); // li
-							break;
-						case "hi":
-							pagedWriter.writeEndElement(); // b
-							break;
-						case "emph":
-							pagedWriter.writeEndElement(); // i
-							break;
-						case "table":
-							pagedWriter.writeEndElement(); // table
-							break;
-						case "row":
-							pagedWriter.writeEndElement(); // tr
-							break;
-						case "cell":
-							pagedWriter.writeEndElement(); // td
-							break;
-						case "form":
-							flagform = false
-							break;
-						case "ana":
-							flaginterp = false
-							break;
-						case "w":
-							int l = lastword.length();
-							String endOfLastWord = "";
-							if (l > 0)
-								endOfLastWord = lastword.subSequence(l-1, l);
+								if (interpvalue != null)
+									interpvalue = interpvalue;
 
-							if (interpvalue != null)
-								interpvalue = interpvalue;
-
-							if (NoSpaceBefore.contains(wordvalue) ||
+								if (NoSpaceBefore.contains(wordvalue) ||
 								NoSpaceAfter.contains(lastword) ||
 								wordvalue.startsWith("-") ||
 								NoSpaceAfter.contains(endOfLastWord))
-							{
-								// multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
-							} else {
-								// multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
-								pagedWriter.writeCharacters(" ");
-							}
-							pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
-							pagedWriter.writeCharacters(wordvalue);
-							pagedWriter.writeEndElement() // span
-							lastword=wordvalue;
-							break;
-					}
-					break;
-				case XMLStreamConstants.CHARACTERS:
-					if (flagform)
-						if (parser.getText().length() > 0)
-							wordvalue+=(parser.getText());
-					if (flaginterp)
-						if (parser.getText().length() > 0)
-							interpvalue+=(parser.getText());
-					break;
+								{
+									// multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+								} else {
+									// multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
+									pagedWriter.writeCharacters(" ");
+								}
+								pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
+								pagedWriter.writeCharacters(wordvalue);
+								pagedWriter.writeEndElement() // span
+								lastword=wordvalue;
+								break;
+						}
+						break;
+					case XMLStreamConstants.CHARACTERS:
+						if (flagform)
+							if (parser.getText().length() > 0)
+								wordvalue+=(parser.getText());
+						if (flaginterp)
+							if (parser.getText().length() > 0)
+								interpvalue+=(parser.getText());
+						break;
+				}
 			}
-		}
-		//writer.write("</body>");
-		//writer.write("</html>");
-		//writer.close();
-		closeMultiWriter();
-	} catch(Exception e) { org.txm.utils.logger.Log.printStackTrace(e); pagedWriter.close(); }
+			//writer.write("</body>");
+			//writer.write("</html>");
+			//writer.close();
+			closeMultiWriter();
+		} catch(Exception e) { 
+			println "Error while processing ${infile} at "+parser.getLocation().getLineNumber()+": "+e
+			org.txm.utils.logger.Log.printStackTrace(e); 
+			pagedWriter.close(); }
 	}
 }
Index: tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/OpenEdition.java
===================================================================
--- tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/OpenEdition.java	(revision 1109)
+++ tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/OpenEdition.java	(revision 1110)
@@ -78,7 +78,7 @@
 		if (selection.getFirstElement() instanceof CQPCorpus) {
 			try {
 				CQPCorpus c = (CQPCorpus) selection.getFirstElement();
-//				Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+				//				Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
 
 				//EditionSelectorDialog d = new EditionSelectorDialog(shell, c, null);
 				SynopticEditionEditor editor = null;
@@ -107,8 +107,8 @@
 
 				editor = openEdition(c, editionsToOpen);
 
-//				if (editor != null)
-//					editor.firstPage();
+				//				if (editor != null)
+				//					editor.firstPage();
 			} catch (Exception e) {
 				System.out.println(EditionUIMessages.OpenEdition_4+e);
 				org.txm.rcp.utils.Logger.printStackTrace(e);
@@ -118,11 +118,11 @@
 		}
 		return null;
 	}
-	
+
 	public static String[] getDefaultEditions(Project p) {
 		return p.getDefaultEdition().split(","); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-	
+
 	public static String[] getDefaultEditions(CQPCorpus c) {
 		return getDefaultEditions(c.getProject());
 	}
@@ -173,11 +173,11 @@
 			//String[] editions = {maincorpus.getDefaultEdition()};
 			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
 			IWorkbenchPage page = window.getActivePage();
-			
+
 			SynopticEditorInput editorInput = new SynopticEditorInput(corpus, text.getName(), editions);
 			SynopticEditionEditor editor = (SynopticEditionEditor) page.openEditor(editorInput,
 					SynopticEditionEditor.ID, true);
-			
+
 			return editor;
 
 		} catch (Exception e) {
