Index: TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java
===================================================================
--- TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 3421)
+++ TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 3422)
@@ -182,8 +182,7 @@
 			String[] ids = panel.getWordSelection();
 			// System.out.println("Words: "+Arrays.toString(ids));
 			if (ids == null || ids[0] == null) {
-				// no word detected or selected
-				return null;
+				return backToMedia(cqpCorpus, text.getName(), "0.0", null, editor, HandlerUtil.getActiveWorkbenchWindow(event).getShell());
 			}
 			else if (ids[1] == null) { // only one word is selected -> using sync_mode preferences
 				try {
Index: TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java
===================================================================
--- TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java	(revision 3421)
+++ TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java	(revision 3422)
@@ -50,7 +50,10 @@
 		
 		browser = new Browser(this, SWT.NONE);
 		browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-		browser.setText("<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body><video style=\"height:100%;\"id=\"video\" controls></video></body></html>");
+		//browser.setText("<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body><video id=\"video\" controls></video></body></html>");
+		String html = "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body><video id=\"video\" style=\"object-fit:contain;\" controls controlsList=\"nofullscreen\"></video></body></html>";
+		System.out.println(html);
+		browser.setText(html);
 		//browser.setText("<video id=\"video\" width=\"100%\" height=\"100%\" controls><source id=\"source\" src=\"\"></source></video>");
 		
 		browser.addProgressListener(new ProgressListener() {
@@ -98,9 +101,9 @@
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) { }
 		});
-				
+		
 		browser.setMenu(menu);
-				
+		
 		GLComposite controls = new GLComposite(this, SWT.NONE, "controls");
 		controls.getLayout().numColumns = 20;
 		controls.getLayout().horizontalSpacing = 2;
@@ -148,74 +151,74 @@
 				public void widgetDefaultSelected(SelectionEvent e) { }
 			});
 			
-//			Button playpauseButton = new Button(controls, SWT.TOGGLE);
-//			playpauseButton.setText("Pause");
-//			playpauseButton.setSelection(true);
-//			playpauseButton.addSelectionListener(new SelectionListener() {
-//				
-//				@Override
-//				public void widgetSelected(SelectionEvent event) {
-//					if (playpauseButton.getSelection()) {
-//						resume();
-//						playpauseButton.setText("Pause");
-//					} else {
-//						pause();
-//						playpauseButton.setText("Play");
-//					}
-//				}
-//				
-//				@Override
-//				public void widgetDefaultSelected(SelectionEvent e) { }
-//			});
-//			
-//			Button replayButton = new Button(controls, SWT.PUSH);
-//			replayButton.setText("Re-play");
-//			replayButton.addSelectionListener(new SelectionListener() {
-//				
-//				@Override
-//				public void widgetSelected(SelectionEvent event) {
-//					replay();
-//				}
-//				
-//				@Override
-//				public void widgetDefaultSelected(SelectionEvent e) { }
-//			});
-//			
-//			Button loopButton = new Button(controls, SWT.TOGGLE);
-//			loopButton.setText("Loop");
-//			loopButton.setSelection(initRepeat);
-//			loopButton.addSelectionListener(new SelectionListener() {
-//				
-//				@Override
-//				public void widgetSelected(SelectionEvent event) {
-//					setRepeat(loopButton.getSelection());
-//				}
-//				
-//				@Override
-//				public void widgetDefaultSelected(SelectionEvent e) { }
-//			});
-//			
-//			volumeLabel = new Label(controls, SWT.NONE);
-//			volumeLabel.setText("Volume (100%)");
-//			
-//			Scale volumneSpinner = new Scale(controls, SWT.NONE);
-//			volumneSpinner.setMinimum(0);
-//			volumneSpinner.setMaximum(100);
-//			volumneSpinner.setSelection(100);
-//			volumneSpinner.addSelectionListener(new SelectionListener() {
-//				
-//				@Override
-//				public void widgetSelected(SelectionEvent e) {
-//					setVolume(volumneSpinner.getSelection());
-//				}
-//				
-//				@Override
-//				public void widgetDefaultSelected(SelectionEvent e) { }
-//			});
+			//			Button playpauseButton = new Button(controls, SWT.TOGGLE);
+			//			playpauseButton.setText("Pause");
+			//			playpauseButton.setSelection(true);
+			//			playpauseButton.addSelectionListener(new SelectionListener() {
+			//				
+			//				@Override
+			//				public void widgetSelected(SelectionEvent event) {
+			//					if (playpauseButton.getSelection()) {
+			//						resume();
+			//						playpauseButton.setText("Pause");
+			//					} else {
+			//						pause();
+			//						playpauseButton.setText("Play");
+			//					}
+			//				}
+			//				
+			//				@Override
+			//				public void widgetDefaultSelected(SelectionEvent e) { }
+			//			});
+			//			
+			//			Button replayButton = new Button(controls, SWT.PUSH);
+			//			replayButton.setText("Re-play");
+			//			replayButton.addSelectionListener(new SelectionListener() {
+			//				
+			//				@Override
+			//				public void widgetSelected(SelectionEvent event) {
+			//					replay();
+			//				}
+			//				
+			//				@Override
+			//				public void widgetDefaultSelected(SelectionEvent e) { }
+			//			});
+			//			
+			//			Button loopButton = new Button(controls, SWT.TOGGLE);
+			//			loopButton.setText("Loop");
+			//			loopButton.setSelection(initRepeat);
+			//			loopButton.addSelectionListener(new SelectionListener() {
+			//				
+			//				@Override
+			//				public void widgetSelected(SelectionEvent event) {
+			//					setRepeat(loopButton.getSelection());
+			//				}
+			//				
+			//				@Override
+			//				public void widgetDefaultSelected(SelectionEvent e) { }
+			//			});
+			//			
+			//			volumeLabel = new Label(controls, SWT.NONE);
+			//			volumeLabel.setText("Volume (100%)");
+			//			
+			//			Scale volumneSpinner = new Scale(controls, SWT.NONE);
+			//			volumneSpinner.setMinimum(0);
+			//			volumneSpinner.setMaximum(100);
+			//			volumneSpinner.setSelection(100);
+			//			volumneSpinner.addSelectionListener(new SelectionListener() {
+			//				
+			//				@Override
+			//				public void widgetSelected(SelectionEvent e) {
+			//					setVolume(volumneSpinner.getSelection());
+			//				}
+			//				
+			//				@Override
+			//				public void widgetDefaultSelected(SelectionEvent e) { }
+			//			});
 			
-//			GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
-//			gdata.minimumWidth = gdata.widthHint = 150;
-//			volumneSpinner.setLayoutData(gdata);
+			//			GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
+			//			gdata.minimumWidth = gdata.widthHint = 150;
+			//			volumneSpinner.setLayoutData(gdata);
 			
 			rateLabel = new Label(controls, SWT.NONE);
 			rateLabel.setText("Rate (1.0)");
@@ -322,15 +325,16 @@
 			start =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
 		}
 		
-		if (endTime.matches("[0-9]+.[0-9]+")) {
-			end = (int) ( Float.parseFloat(endTime));
+		if (endTime != null) {
+			if (endTime.matches("[0-9]+.[0-9]+")) {
+				end = (int) ( Float.parseFloat(endTime));
+			}
+			else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+				if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
+				LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
+				end =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+			}
 		}
-		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
-			if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
-			LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
-			end =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
-		}
-		
 		return play(mrl, start, end);
 		
 	}
Index: TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java
===================================================================
--- TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java	(revision 3421)
+++ TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java	(revision 3422)
@@ -115,7 +115,7 @@
 	
 	@Override
 	public boolean isDirty() {
-		return true;// player.isMediaLoaded();
+		return false; // player.isMediaLoaded();
 	}
 	
 	/**
Index: TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java
===================================================================
--- TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 3422)
@@ -39,7 +39,7 @@
 	
 	private SelectionListener defaultListener;
 	
-	private ToolItem saveButton;
+	//private ToolItem saveButton;
 	
 	public static final String GROUP_NAME = "Annotation";
 	
@@ -48,14 +48,14 @@
 		return GROUP_NAME;
 	}
 	
-	/**
-	 * use this to enable/disable the button
-	 * 
-	 * @return
-	 */
-	public ToolItem getSaveButton() {
-		return saveButton;
-	}
+//	/**
+//	 * use this to enable/disable the button
+//	 * 
+//	 * @return
+//	 */
+//	public ToolItem getSaveButton() {
+//		return saveButton;
+//	}
 	
 	/**
 	 * install the annotation start button and dropdown list
@@ -144,31 +144,31 @@
 				openCloseSelectionListener, modes, listeners);
 		controlArea.setLayout(new GridLayout(1, true));
 		
-		saveButton = new ToolItem(editor.getTopToolbar(), SWT.PUSH);
-		saveButton.setText("Save annotations");
-		//saveButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
-		saveButton.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				try {
-					notifyDoSave();
-				}
-				catch (Exception e1) {
-					Log.printStackTrace(e1);
-				}
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		saveButton.setEnabled(false);
+//		saveButton = new ToolItem(editor.getTopToolbar(), SWT.PUSH);
+//		saveButton.setText("Save annotations");
+//		//saveButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
+//		saveButton.addSelectionListener(new SelectionListener() {
+//			
+//			@Override
+//			public void widgetSelected(SelectionEvent e) {
+//				try {
+//					notifyDoSave();
+//				}
+//				catch (Exception e1) {
+//					Log.printStackTrace(e1);
+//				}
+//			}
+//			
+//			@Override
+//			public void widgetDefaultSelected(SelectionEvent e) {}
+//		});
+//		saveButton.setEnabled(false);
 	}
 	
 	public void closeAreasPanel() {
 		editor.getTopToolbar().setVisible(GROUP_NAME, false);
 		editor.getTopToolbar().getOpenCloseButton().setSelection(false);
-		saveButton.setEnabled(false);
+//		saveButton.setEnabled(false);
 	}
 	
 	public void openAnnotationMode(AnnotationArea aa, int position) throws Exception {
@@ -268,11 +268,13 @@
 	
 	@Override
 	public boolean isDirty() throws Exception {
-		boolean dirty = false;
-		for (AnnotationArea aa : annotationAreas) {
-			dirty = dirty || aa.isDirty();
-		}
-		return dirty;
+		return false;
+		
+//		boolean dirty = false;
+//		for (AnnotationArea aa : annotationAreas) {
+//			dirty = dirty || aa.isDirty();
+//		}
+//		return dirty;
 	}
 	
 	@Override
@@ -284,74 +286,74 @@
 	public void notifyDoSave() throws Exception {
 		
 		//		if (needToUpdateIndexes) {
-		JobHandler job = new JobHandler("Updating corpus indexes and editions", true) {
-			
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				
-				this.runInit(monitor);
-				
-				try {
-					monitor.setTaskName("Updating corpus XML-TXM files");
-					
-					Log.info("Saving annotations...");
-					boolean needToUpdateIndexes = false;
-					boolean needToUpdateEditions = false;
-					// System.out.println("Saving annotations...");
-					if (annotationAreas != null && annotationAreas.size() > 0) {
-						for (AnnotationArea aa : annotationAreas) {
-							needToUpdateIndexes = needToUpdateIndexes 
-									|| (aa.isDirty() 
-											&& aa.save()
-											&& aa.needToUpdateIndexes());
-							needToUpdateEditions = needToUpdateEditions || aa.needToUpdateEditions();
-						}
-					}
-					
-					if (needToUpdateIndexes) {
-						final MainCorpus corpus = editor.getResult().getFirstParent(MainCorpus.class);
-						monitor.setTaskName("Updating corpus indexes and editions");
-						if (corpus != null && UpdateCorpus.update(corpus, needToUpdateEditions) != null) {
-							monitor.worked(50);
-							this.syncExec(new Runnable() {
-								
-								@Override
-								public void run() {
-									Log.info("Done.");
-									CorporaView.refreshObject(corpus);
-									if (!saveButton.isDisposed()) {
-										saveButton.setEnabled(false);
-									}
-								}
-							});
-							return Status.OK_STATUS;
-						}
-						else {
-							monitor.worked(50);
-							Log.warning("Fail to update corpus. Aborting");
-							Log.warning("Fix XML-TXM files and call command 'UpdateCorpus'");
-							return Status.CANCEL_STATUS;
-						}
-					} else {
-						this.syncExec(new Runnable() {
-							
-							@Override
-							public void run() {
-								Log.info("Done.");
-								if (!saveButton.isDisposed()) {
-									saveButton.setEnabled(false);
-								}
-							}
-						});
-						return Status.OK_STATUS;
-					}
-				} catch(ThreadDeath ex) {
-					Log.warning(TXMUIMessages.executionCanceled);
-					return Status.CANCEL_STATUS;
-				}
-			}
-		};
-		job.schedule();
+//		JobHandler job = new JobHandler("Updating corpus indexes and editions", true) {
+//			
+//			@Override
+//			protected IStatus run(IProgressMonitor monitor) {
+//				
+//				this.runInit(monitor);
+//				
+//				try {
+//					monitor.setTaskName("Updating corpus XML-TXM files");
+//					
+//					Log.info("Saving annotations...");
+//					boolean needToUpdateIndexes = false;
+//					boolean needToUpdateEditions = false;
+//					// System.out.println("Saving annotations...");
+//					if (annotationAreas != null && annotationAreas.size() > 0) {
+//						for (AnnotationArea aa : annotationAreas) {
+//							needToUpdateIndexes = needToUpdateIndexes 
+//									|| (aa.isDirty() 
+//											&& aa.save()
+//											&& aa.needToUpdateIndexes());
+//							needToUpdateEditions = needToUpdateEditions || aa.needToUpdateEditions();
+//						}
+//					}
+//					
+//					if (needToUpdateIndexes) {
+//						final MainCorpus corpus = editor.getResult().getFirstParent(MainCorpus.class);
+//						monitor.setTaskName("Updating corpus indexes and editions");
+//						if (corpus != null && UpdateCorpus.update(corpus, needToUpdateEditions) != null) {
+//							monitor.worked(50);
+//							this.syncExec(new Runnable() {
+//								
+//								@Override
+//								public void run() {
+//									Log.info("Done.");
+//									CorporaView.refreshObject(corpus);
+//									if (!saveButton.isDisposed()) {
+//										saveButton.setEnabled(false);
+//									}
+//								}
+//							});
+//							return Status.OK_STATUS;
+//						}
+//						else {
+//							monitor.worked(50);
+//							Log.warning("Fail to update corpus. Aborting");
+//							Log.warning("Fix XML-TXM files and call command 'UpdateCorpus'");
+//							return Status.CANCEL_STATUS;
+//						}
+//					} else {
+//						this.syncExec(new Runnable() {
+//							
+//							@Override
+//							public void run() {
+//								Log.info("Done.");
+//								if (!saveButton.isDisposed()) {
+//									saveButton.setEnabled(false);
+//								}
+//							}
+//						});
+//						return Status.OK_STATUS;
+//					}
+//				} catch(ThreadDeath ex) {
+//					Log.warning(TXMUIMessages.executionCanceled);
+//					return Status.CANCEL_STATUS;
+//				}
+//			}
+//		};
+//		job.schedule();
 		//		}
 	}
 	
@@ -359,20 +361,20 @@
 	public void notifyDispose() throws Exception {
 		
 		//FIXME MD: I have to do this because Eclipse is not asking for editor saves before exiting the app - BUG
-		try {
-			boolean annotationsDirty = false;
-			for (AnnotationArea aa : annotationAreas) {
-				annotationsDirty = annotationsDirty || aa.isDirty();
-			}
-			if (annotationsDirty) {
-				boolean doSave = MessageDialog.openQuestion(this.editor.getShell(), "Annotations not saved", "Do you want to save the annotations before closing the editor?");
-				if (doSave) {
-					notifyDoSave();
-				}
-			}
-		} catch(Exception e) {
-			Log.printStackTrace(e);
-		}
+//		try {
+//			boolean annotationsDirty = false;
+//			for (AnnotationArea aa : annotationAreas) {
+//				annotationsDirty = annotationsDirty || aa.isDirty();
+//			}
+//			if (annotationsDirty) {
+//				boolean doSave = MessageDialog.openQuestion(this.editor.getShell(), "Annotations not saved", "Do you want to save the annotations before closing the editor?");
+//				if (doSave) {
+//					notifyDoSave();
+//				}
+//			}
+//		} catch(Exception e) {
+//			Log.printStackTrace(e);
+//		}
 		
 		for (AnnotationArea aa : annotationAreas) {
 			aa._close();
Index: TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/view/AnnotationsView.java
===================================================================
--- TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/view/AnnotationsView.java	(revision 0)
+++ TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/view/AnnotationsView.java	(revision 3422)
@@ -0,0 +1,31 @@
+package org.txm.annotation.rcp.view;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+import org.txm.rcp.swt.GLComposite;
+
+public class AnnotationsView extends ViewPart {
+
+	@Override
+	public void createPartControl(Composite parent) {
+		
+		parent.setLayout(new GridLayout(1, true));
+		
+		GLComposite toolbar = new GLComposite(parent, SWT.NONE, "toolbar");
+		
+		TableViewer table = new TableViewer(parent);
+		TableViewerColumn column = new TableViewerColumn(table, SWT.NONE);
+	}
+
+	@Override
+	public void setFocus() {
+		
+		// TODO Auto-generated method stub
+		
+	}
+	
+}

Property changes on: TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/view/AnnotationsView.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.tigersearch.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.tigersearch.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.tigersearch.rcp/plugin.xml	(revision 3422)
@@ -87,7 +87,7 @@
          </command>
       </menuContribution>
       <menuContribution
-            locationURI="menu:menu.corpus.import">
+            locationURI="menu:menu.file.import.annotations">
          <command
                commandId="org.txm.tigersearch.commands.ImportTIGERAnnotations"
                icon="icons/functions/TSplus.png"
Index: TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java
===================================================================
--- TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEnginesManager.java	(revision 3422)
@@ -1,12 +1,18 @@
 package org.txm.annotation.core;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.osgi.util.NLS;
+import org.txm.Toolbox;
 import org.txm.core.engines.EngineType;
 import org.txm.core.engines.EnginesManager;
 import org.txm.objects.CorpusBuild;
+import org.txm.objects.Project;
 import org.txm.utils.logger.Log;
 
 
@@ -99,4 +105,49 @@
 		
 		return size() > 0;
 	}
+	
+	public boolean isSaveNeeded() {
+		
+		for (AnnotationEngine a : values()) {
+			for (Project project : Toolbox.workspace.getProjects()) {
+				for (CorpusBuild corpus : project.getCorpora()) {
+					if (a.hasAnnotationsToSave(corpus)) {
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+	}
+
+	public List<AnnotationEngine> getEnginesWithSaveNeeded() {
+		
+		List<AnnotationEngine> tmp = new ArrayList<AnnotationEngine>();
+		for (AnnotationEngine a : values()) {
+			for (Project project : Toolbox.workspace.getProjects()) {
+				for (CorpusBuild corpus : project.getCorpora()) {
+					if (a.hasAnnotationsToSave(corpus)) {
+						tmp.add(a);
+					}
+				}
+			}
+		}
+		return tmp;
+	}
+	
+	public HashMap<CorpusBuild, ArrayList<AnnotationEngine>> getEnginesWithSaveNeededPerCorpus() {
+		
+		HashMap<CorpusBuild, ArrayList<AnnotationEngine>> tmp = new HashMap<CorpusBuild, ArrayList<AnnotationEngine>>();
+		for (AnnotationEngine a : values()) {
+			for (Project project : Toolbox.workspace.getProjects()) {
+				for (CorpusBuild corpus : project.getCorpora()) {
+					if (a.hasAnnotationsToSave(corpus)) {
+						if (!tmp.containsKey(corpus)) tmp.put(corpus, new ArrayList<>());
+						tmp.get(corpus).add(a);
+					}
+				}
+			}
+		}
+		return tmp;
+	}
 }
Index: TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java
===================================================================
--- TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngine.java	(revision 3422)
@@ -30,7 +30,7 @@
 	 * @return true if the Annotation Engine has some annotations not saved (that will be lost if not saved)
 	 */
 	public abstract boolean hasAnnotationsToSave(CorpusBuild corpus);
-	
+		
 	/**
 	 * 
 	 * @return a StringTokenizer, override this method if the engine needs a speciq tokenization
Index: TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java	(revision 3422)
@@ -73,6 +73,8 @@
 	private EntityManager em;
 	
 	private MainCorpus corpus;
+
+	private EntityManagerFactory emf;
 	
 	public TemporaryAnnotationManager(MainCorpus corpus) {
 		this.corpus = corpus;
@@ -100,6 +102,9 @@
 		if (em != null) {
 			em.close();
 		}
+		if (emf != null) {
+			emf.close();
+		}
 	}
 	
 	
@@ -301,12 +306,13 @@
 	 * @throws Exception
 	 */
 	public List<Annotation> getAnnotations(AnnotationType refType, int startPosition, int endPosition, String value) {
-		String query = "SELECT annot FROM Annotation AS annot "
-				+ "WHERE annot.PK.refType LIKE '" + refType.getId() + "'";
+		String query = "SELECT annot FROM Annotation AS annot WHERE annot.PK.refType LIKE '" + refType.getId() + "'";
 		if (startPosition >= 0)
 			query += " AND annot.PK.startpos = " + startPosition;
+		
 		if (endPosition >= 0)
 			query += " AND annot.PK.endpos = " + endPosition;
+		
 		if (value != null)
 			query += " AND annot.refVal LIKE ':" + value + "' ";
 		
@@ -501,7 +507,7 @@
 		// infos.getManagedClassNames().add("org.txm.annotation.TypedValue");
 		// pp.generateSchema(infos, properties);
 		
-		EntityManagerFactory emf = pp.createEntityManagerFactory(DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, properties);
+		emf = pp.createEntityManagerFactory(DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, properties);
 		
 		em = emf.createEntityManager();
 		
Index: TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java	(revision 3422)
@@ -12,6 +12,7 @@
 import org.osgi.service.prefs.BackingStoreException;
 import org.osgi.service.prefs.Preferences;
 import org.txm.annotation.core.AnnotationEngine;
+import org.txm.annotation.kr.core.preferences.KRAnnotationPreferences;
 import org.txm.annotation.kr.core.repository.KnowledgeRepository;
 import org.txm.annotation.kr.core.repository.KnowledgeRepositoryManager;
 import org.txm.annotation.kr.core.repository.SQLKnowledgeRepository;
@@ -427,7 +428,7 @@
 	@Override
 	public void notify(TXMResult r, String state) {
 		
-		if (r instanceof MainCorpus && "clean".equals(state)) {
+		if (r instanceof MainCorpus && "before_clean".equals(state)) {
 			
 			MainCorpus c = (MainCorpus) r;
 			
@@ -439,11 +440,13 @@
 				Log.fine("cleaning KR: " + krname);
 				KRAnnotationEngine.unregisterKnowledgeRepositoryName(c, krname);
 			}
+			
 			if (c.getProjectDirectory() == null || !c.getProjectDirectory().exists()) {
 				return;
 			}
 			
 			if (ams.get(c) != null && ams.get(c).tempManager != null && ams.get(c).tempManager.getEntityManager() != null ) {
+				Log.fine("closing temporary annotations database of: "+c);
 				ams.get(c).tempManager.close(); // free files
 			}
 			
@@ -451,6 +454,34 @@
 			if (buildDirectory.exists()) {
 				DeleteDir.deleteDirectory(buildDirectory);
 			}
+		} else if (r instanceof MainCorpus && "clean".equals(state)) {
+			
+			MainCorpus c = (MainCorpus) r;
+			
+			if (c.getProject() == null || c.getProject().getDoUpdate()) {
+				return;
+			}
+			
+			for (String krname : KRAnnotationEngine.getKnowledgeRepositoryNames(c)) {
+				Log.fine("cleaning KR: " + krname);
+				KRAnnotationEngine.unregisterKnowledgeRepositoryName(c, krname);
+			}
+			
+			
+			
+			if (c.getProjectDirectory() == null || !c.getProjectDirectory().exists()) {
+				return;
+			}
+			
+			if (ams.get(c) != null && ams.get(c).tempManager != null && ams.get(c).tempManager.getEntityManager() != null ) {
+				Log.fine("closing temporary annotations databse of: "+c);
+				ams.get(c).tempManager.close(); // free files
+			}
+			
+			File buildDirectory = new File(c.getProjectDirectory(), "temporary_annotations/" + c.getID());
+			if (buildDirectory.exists()) {
+				DeleteDir.deleteDirectory(buildDirectory);
+			}
 		}
 		else if (r instanceof Project && "clean".equals(state)) {
 			
@@ -514,6 +545,9 @@
 	
 	@Override
 	public boolean hasAnnotationsToSave(CorpusBuild corpus) {
+		
+		if (KRAnnotationPreferences.getInstance().getBoolean(KRAnnotationPreferences.PRESERVE_ANNOTATIONS)) return false;
+		
 		if (!ams.containsKey(corpus)) return false; // no annotation manager -> not annotations to save
 		return ams.get(corpus).hasChanges();
 	}
Index: TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepositoryManager.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepositoryManager.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepositoryManager.java	(revision 3422)
@@ -343,9 +343,8 @@
 			kr.deleteType(annotType);
 		}
 		repositories.remove(kr.getName());
+		kr.close();
 	}
 	
 	
-	
-	
 }
Index: TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepository.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepository.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepository.java	(revision 3422)
@@ -50,6 +50,8 @@
 	protected String accessType;
 	
 	protected HashMap<String, String> accessProperties;
+
+	private EntityManagerFactory emf;
 	
 	public final static String NAME = "name";
 	
@@ -93,7 +95,7 @@
 	public EntityManager initializeEntityManager() {
 		this.dbPath = new File(Toolbox.getTxmHomePath(), "repositories/" + name).getAbsolutePath();
 		// System.out.println("KnowledgeRepository.initializeEntityManager [DB @ "+dbPath+"]");
-		EntityManagerFactory emf;
+		
 		HashMap<String, Object> properties = new HashMap<String, Object>();
 		properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass().getClassLoader());
 		// ClassLoader loader = BundleUtils.getLoader("org.txm.annotation.core");
@@ -311,10 +313,10 @@
 				buildTypes();
 			}
 			else {
-				Log.warning("KR Annotation Types already exist:");
-				for (AnnotationType annotType : annotTypes) {
-					Log.warning(NLS.bind(" - Type : {0}", annotType.getName()));
-				}
+//				Log.warning("KR Annotation Types already exist:");
+//				for (AnnotationType annotType : annotTypes) {
+//					Log.warning(NLS.bind(" - Type : {0}", annotType.getName()));
+//				}
 			}
 		} else {
 			buildTypes();
@@ -499,4 +501,10 @@
 		// TODO Auto-generated method stub
 		
 	}
+
+	public void close() {
+		
+		if (jpaem != null) jpaem.close();
+		if (emf != null) emf.close();
+	}
 }
Index: TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java	(revision 3422)
@@ -1,22 +1,39 @@
 package org.txm.annotation.kr.core;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.osgi.util.NLS;
+import org.osgi.service.prefs.BackingStoreException;
 import org.txm.annotation.kr.core.messages.KRAnnotationCoreMessages;
 import org.txm.annotation.kr.core.repository.AnnotationEffect;
 import org.txm.annotation.kr.core.repository.AnnotationType;
+import org.txm.annotation.kr.core.repository.KnowledgeRepository;
 import org.txm.annotation.kr.core.repository.TypedValue;
 import org.txm.annotation.kr.core.storage.temporary.TemporaryAnnotationManager;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
 import org.txm.objects.Match;
 import org.txm.objects.Match2P;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
 import org.txm.utils.ConsoleProgressBar;
+import org.txm.utils.CsvReader;
+import org.txm.utils.io.IOUtils;
 import org.txm.utils.logger.Log;
 
 /**
@@ -286,7 +303,7 @@
 							i--;
 						}
 						else if (!a.getType().equals(annotSelectedType.getId()) && (// different type and inner or outer wrap
-						(a.getStart() <= start && end <= a.getEnd()) ||
+								(a.getStart() <= start && end <= a.getEnd()) ||
 								(start <= a.getStart() && a.getEnd() <= end))) {
 							cqpAnnotations.remove(i);
 							i--;
@@ -396,4 +413,206 @@
 	public boolean isDirty() {
 		return dirty;
 	}
+	
+	public boolean exportAnnotationsToTable(File resultFile) throws Exception {
+		
+		final String encoding = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_ENCODING);
+		String colseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR);
+		String txtseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_TXT_SEPARATOR);
+		
+		List<String> krnames = KRAnnotationEngine.getKnowledgeRepositoryNames(corpus);
+		if (krnames.size() == 0) {
+			Log.severe(NLS.bind("** Error: no knowledge repository found in {0} corpus.", corpus));
+			throw new IllegalArgumentException("No kr in " + corpus);
+		}
+		String firtsKRName = krnames.get(0);
+		KnowledgeRepository defaultKR = KRAnnotationEngine.getKnowledgeRepository(corpus, firtsKRName);
+		if (defaultKR == null) {
+			Log.severe(NLS.bind("** Error: no knowledge repository {0} found in {0} corpus.", defaultKR, corpus));
+			throw new IllegalArgumentException("No kr " + defaultKR + " in " + corpus);
+		}
+		
+		PrintWriter writer = IOUtils.getWriter(resultFile, encoding, false);
+		String cols [] = {"text_id", "id", "end_id", "start", "end", "type", "value", "mode", "date", "annotator"};
+		writer.println(StringUtils.join(cols, colseparator));
+		
+		if (this.getTemporaryManager().getAnnotations().size() == 0) {
+			Log.warning("Warning: no annotations to export. Aborting.");
+			return false;
+		}
+		
+		String[] textsIds = corpus.getCorpusTextIdsList();
+		int[] textsEndPositions = corpus.getTextEndLimits();
+		
+		HashMap<Integer, String> positions2Ids = new HashMap<Integer, String>();
+		HashMap<Integer, String> positions2TextIds = new HashMap<Integer, String>();
+		for (Annotation a : this.getTemporaryManager().getAnnotations()) {
+			positions2Ids.put(a.getStart(), null);
+			positions2Ids.put(a.getEnd(), null);
+		}
+		int[] positions = new int[positions2Ids.keySet().size()];
+		int i = 0;
+		for (int p : positions2Ids.keySet()) {
+			positions[i++] = p;
+		}
+		String values[] = corpus.getProperty("id").cpos2Str(positions);
+		for (i = 0 ; i < positions.length ; i++) {
+			positions2Ids.put(positions[i], values[i]);
+		}
+		
+		List<Annotation> annotations = this.getTemporaryManager().getAnnotations();
+		annotations.sort(new Comparator<Annotation>() {
+			@Override
+			public int compare(Annotation arg0, Annotation arg1) {
+				return arg0.getStart() - arg1.getStart();
+			}
+		});
+		
+		Log.info(NLS.bind("Exporting {0} annotations.", annotations.size()));
+		ConsoleProgressBar cpb = new ConsoleProgressBar(annotations.size());
+		
+		int currentText = 0;
+		for (Annotation a : annotations) {
+			cpb.tick();
+			// text_id	id	start	end	type	value	effect	date	annotator
+			String effect = defaultKR.getType(a.getType()).getEffect().name();
+			String startId = positions2Ids.get(a.getStart());
+			String endId = positions2Ids.get(a.getEnd());
+
+			while (textsEndPositions[currentText] < a.getStart()) {
+				// System.out.println("currentText="+currentText+" a="+a.getStart()+" text start="+textsEndPositions[currentText]+" text id="+textsIds[currentText]);
+				currentText++;// go to next text
+			}
+			String textid = textsIds[currentText];
+			
+			writer.println(
+					txtseparator+textid.replace(txtseparator, txtseparator+txtseparator)				+txtseparator
+					+colseparator+txtseparator+startId.replace(txtseparator, txtseparator+txtseparator)				+txtseparator
+					+colseparator+txtseparator+endId.replace(txtseparator, txtseparator+txtseparator)				+txtseparator
+					+colseparator+txtseparator+a.getStart()															+txtseparator
+					+colseparator+txtseparator+a.getEnd()															+txtseparator
+					+colseparator+txtseparator+a.getType().replace(txtseparator, txtseparator+txtseparator)			+txtseparator
+					+colseparator+txtseparator+a.getValue().replace(txtseparator, txtseparator+txtseparator)		+txtseparator
+					+colseparator+txtseparator+effect.replace(txtseparator, txtseparator+txtseparator)				+txtseparator
+					+colseparator+txtseparator+a.getDate().replace(txtseparator, txtseparator+txtseparator)			+txtseparator
+					+colseparator+txtseparator+a.getAnnotator().replace(txtseparator, txtseparator+txtseparator)	+txtseparator);
+		}
+		writer.close();
+		cpb.done();
+		return true;
+	}
+
+	public boolean importAnnotationsFromTable(File annotationsFile) throws Exception {
+		
+		if (!isOpen()) {
+			this.initialize();
+		}
+		
+		final String encoding = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_ENCODING);
+		String colseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR);
+		String txtseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_TXT_SEPARATOR);
+		
+		List<String> krnames = KRAnnotationEngine.getKnowledgeRepositoryNames(corpus);
+		if (krnames.size() == 0) {
+			Log.severe(NLS.bind("** Error: no knowledge repository found in {0} corpus.", corpus));
+			throw new IllegalArgumentException("No kr in " + corpus);
+		}
+		String firtsKRName = krnames.get(0);
+		KnowledgeRepository defaultKR = KRAnnotationEngine.getKnowledgeRepository(corpus, firtsKRName);
+		if (defaultKR == null) {
+			Log.severe(NLS.bind("** Error: no knowledge repository {0} found in {0} corpus.", defaultKR, corpus));
+			throw new IllegalArgumentException("No kr " + defaultKR + " in " + corpus);
+		}
+		
+		CsvReader reader = new CsvReader(annotationsFile.getAbsolutePath(), colseparator.charAt(0), Charset.forName(encoding));
+		if (txtseparator.length() > 0) reader.setTextQualifier(txtseparator.charAt(0));
+		reader.readHeaders();
+		String headers [] = reader.getHeaders();
+		String cols [] = {"text_id", "id", "end_id", "start", "end", "type", "value", "mode", "date", "annotator"};
+		if (headers.length != cols.length) {
+			Log.warning("Error: annotation file header format is not well-formatted: "+StringUtils.join(headers, ", ")+". Should be: "+StringUtils.join(cols, ", "));
+			return false;
+		}
+		for (int i = 0 ; i < cols.length ; i++) {
+			if (!(headers[i].equals(cols[i]))) {
+				Log.warning("Error: annotation file header format is not well-formatted: "+StringUtils.join(headers, ", ")+". Should be: "+StringUtils.join(cols, ", "));
+				return false;
+			}
+		}
+		
+		int nLines = 0;
+		while (reader.readRecord()) {
+			nLines++;
+		}
+		reader.close();
+		
+		if (nLines == 0) {
+			Log.warning("Error: no annotation line found");
+			return false;
+		}
+		
+		Log.info(NLS.bind("Importing {0} annotations...", nLines));
+		reader = new CsvReader(annotationsFile.getAbsolutePath(), colseparator.charAt(0), Charset.forName(encoding));
+		if (txtseparator.length() > 0) reader.setTextQualifier(txtseparator.charAt(0));
+		reader.readHeaders();
+		ConsoleProgressBar cpb = new ConsoleProgressBar(nLines);
+		this.tempManager.getEntityManager().getTransaction().begin();
+		while (reader.readRecord()) {
+			cpb.tick();
+			String[] record = reader.getValues();
+			String typeName = record[5].trim();
+			String typeEffect = record[7].trim();
+			if (defaultKR.getType(typeName) == null) {
+				defaultKR.addType(typeName, typeName, null, AnnotationEffect.valueOf(typeEffect));
+			}
+			AnnotationType type = defaultKR.getType(typeName);
+			String startId = record[1].trim();
+			String endId = record[2].trim();
+			int startPos = -1;
+			int endPos = -1;
+			if (startId.length() > 0 && endId.length() > 0) { // use the word id if present
+				String textId = record[0].trim();
+				if (startId.equals(endId)) {
+					CQLQuery cql = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", startId, textId));
+					QueryResult qr = corpus.query(cql , "TMP", false);
+					if (qr.getNMatch() == 0) {
+						Log.warning("No match found with CQL="+cql);
+						continue;
+					}
+					startPos = qr.getMatch(0).getStart();
+					endPos = startPos;
+				} else {
+					CQLQuery cql = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", startId, textId));
+					QueryResult qr = corpus.query(cql , "TMP", false);
+					if (qr.getNMatch() == 0) {
+						Log.warning("No match found with CQL="+cql);
+						continue;
+					}
+					startPos = qr.getMatch(0).getStart();
+					qr.drop();
+					cql = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", endId, textId));
+					qr = corpus.query(cql , "TMP", false);
+					if (qr.getNMatch() == 0) {
+						Log.warning("No match found with CQL="+cql);
+						continue;
+					}
+					endPos = qr.getMatch(0).getStart();
+					qr.drop();
+				}
+			} else {
+				startPos = Integer.parseInt(record[3]);
+				endPos = Integer.parseInt(record[4]);
+				
+			}
+			if (type.getTypedValue(record[6]) == null) {
+				defaultKR.addValue(record[6], record[6], typeName);
+			}
+			TypedValue value = type.getTypedValue(record[6]);
+			List<Annotation> a = this.tempManager.createAnnotationNoCommit(type, value, startPos, endPos);
+		}
+		this.tempManager.getEntityManager().getTransaction().commit();
+		cpb.done();
+		
+		return true;
+	}
 }
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 3421)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy	(revision 3422)
@@ -1,105 +0,0 @@
-package org.txm.macro.annotation;
-
-import org.txm.utils.*
-import org.txm.utils.io.*
-
-import java.nio.charset.Charset
-
-import org.kohsuke.args4j.*
-
-import groovy.transform.Field
-
-import org.txm.rcp.swt.widget.parameters.*
-
-@Field @Option(name="inputDirectory", usage="The XML-TXM folder", widget="Folder", required=true, def="")
-def inputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite02")
-
-@Field @Option(name="outputDirectory", usage="The result folder", widget="Folder", required=true, def="")
-def outputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite03")
-
-@Field @Option(name="tsvFile", usage="The annotation TSV file", widget="File", required=true, def="")
-def tsvFile = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/TSV-ITE02.csv")
-
-@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
-def properties = "verificado"
-
-@Field @Option(name="debug", usage="Debug de the macro", widget="Boolean", required=true, def="false")
-def debug = true
-
-if (!ParametersDialog.open(this)) return;
-
-def split = properties.split(",")
-if (split.length == 0) {
-	println "ERROR: no property given"
-	return false
-}
-properties = []
-for (def p : split) properties << p.trim()
-
-println "Injecting annotations with the following parameters:"
-println "- inputDirectory: $inputDirectory"
-println "- outputDirectory: $outputDirectory"
-println "- tsvFile: $tsvFile"
-println "- properties: $properties"
-
-outputDirectory.mkdir()
-if (!outputDirectory.exists()) {
-	println "ERROR: could not create or read $outputDirectory directory"
-	return false
-}
-
-CsvReader records = new CsvReader(tsvFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8"))
-records.setTextQualifier((char)0)
-records.readHeaders();
-
-def header = Arrays.asList(records.getHeaders())
-if (debug) println "CSV header: $header"
-for (def s : properties) if (!header.contains(s)) {
-	println "Missing annotation property : $s"
-	return;
-}
-for (def s : ["text_id", "id"]) if (!header.contains(s)) {
-	println "Missing annotation property : $s"
-	return;
-}
-
-def injections = [:]
-int no = 1;
-while (records.readRecord()) {
-	String textid = records.get("text_id")
-	if (!injections.containsKey(textid)) injections[textid] = [:]
-	
-	def props = [:]
-	for (def s : properties) props[s] = records.get(s)
-	if (records.get("id") == "") {
-		 print "ERROR in record "+no
-	} else {
-		injections[textid][records.get("id")] = props
-	}
-	no++;
-}
-
-println "Injecting..."
-//for (String textid : injections.keySet()) {
-for (File currentXMLFile : inputDirectory.listFiles().sort{ it.name }) {
-	if (currentXMLFile.isDirectory()) continue;
-	if (currentXMLFile.isHidden()) continue;
-	
-	String textid = currentXMLFile.getName();
-	int idx = textid.lastIndexOf(".")
-	if (idx > 0) textid = textid.substring(0, idx);
-	
-	if (injections.containsKey(textid)) {	
-		if (debug) println "Injections of "+injections[textid].size()+" lines."
-		
-		def builder = new AnnotationInjectionFilter(currentXMLFile, injections[textid], properties, debug)
-		println "injecting in $currentXMLFile $properties"
-		builder.process(new File(outputDirectory, currentXMLFile.getName()));
-		println ""+builder.n+" lines injected."
-	} else {
-		println "copying file $currentXMLFile"
-		FileCopy.copy(currentXMLFile, new File(outputDirectory, currentXMLFile.getName()))
-	}
-}
-
-println "New XML-TXM files are saved in ${outputDirectory}."
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy	(revision 3421)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy	(revision 3422)
@@ -1,187 +0,0 @@
-// Copyright © 2010-2013 ENS de Lyon.
-// 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.
-//
-//
-// $LastChangedDate: 2012-10-15 17:35:36 +0200 (lun., 15 oct. 2012) $
-// $LastChangedRevision: 2279 $
-// $LastChangedBy: mdecorde $
-//
-package org.txm.macro.annotation
-
-import org.txm.Toolbox
-import org.txm.searchengine.cqp.corpus.*
-import org.txm.searchengine.cqp.corpus.query.*
-import org.txm.concordance.core.functions.Concordance
-import org.txm.concordance.core.functions.Line
-import org.txm.functions.concordances.*
-import org.txm.functions.concordances.comparators.*
-import org.txm.searchengine.cqp.ReferencePattern
-
-import java.util.List
-
-import org.kohsuke.args4j.*
-import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
-
-if (!(corpusViewSelection instanceof CQPCorpus)) {
-	println "Error: you must select a corpus or a subcorpus to export properties"
-	return false;
-}
-
-CQPCorpus corpus = corpusViewSelection
-
-
-@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
-		def properties = "pos"
-
-@Field @Option(name="query", usage="The query to select words to annotate", widget="Query", required=true, def="[]")
-		def query
-
-@Field @Option(name="leftcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
-		def leftcontextsize = 10
-
-@Field @Option(name="rightcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
-		def rightcontextsize = 10
-
-@Field @Option(name="references", usage="references to show", widget="String", required=true, def="text_id")
-		def references = "text_id, p_id, s_id"
-
-@Field @Option(name="tsvFile", usage="The result TSV file", widget="File", required=true, def="export.tsv")
-		def tsvFile
-
-if (!ParametersDialog.open(this)) return;
-
-def split = properties.split(",")
-if (split.length == 0) {
-	println "ERROR: no property given"
-	return false
-}
-properties = []
-for (def p : split) properties << p.trim()
-
-println "Building Annotation Table with the following parameters: "
-println "- corpus: $corpus"
-println "- query: $query"
-println "- annotation properties: $properties"
-println "- TSV file: $tsvFile"
-
-tsvFile = tsvFile.getAbsoluteFile()
-if (!tsvFile.getParentFile().canWrite()) {
-	println "Error: "+tsvFile.getParentFile()+" is not writable."
-	return;
-}
-
-def annots = []
-for (def p : properties) {
-	def prop = corpus.getProperty(p)
-	if (prop == null) {
-		println "No such property $p in the $corpus corpus"
-		return false;
-	}
-	annots << prop
-}
-def id = corpus.getProperty("id")
-def word = corpus.getProperty("word")
-def text = corpus.getStructuralUnit("text")
-def text_id = text.getProperty("id")
-def refs = references.split(",")
-
-if (annots == null || annots.size() == 0) {
-	println "No such property given"//$annots in the $corpus corpus"
-	return false;
-}
-
-println "Exporting ..."
-def start = System.currentTimeMillis()
-
-// define the references pattern for each concordance line
-def referencePattern = new ReferencePattern()
-referencePattern.addProperty(text_id)
-referencePattern.addProperty(id)
-for (def annot : annots) referencePattern.addProperty(annot)
-
-def refProperties = []
-for (def ref : refs) {
-	ref = ref.trim()
-	try {
-		if (ref.contains("_")) {
-			def split2 = ref.split("_",2)
-			def refp = corpus.getStructuralUnit(split2[0].trim()).getProperty(split2[1].trim())
-			if (ref != "text_id")
-				referencePattern.addProperty(refp)
-			refProperties << refp
-		} else {
-			def p = corpus.getProperty(ref)
-			if (p != null) referencePattern.addProperty(p)
-		}
-	} catch(Exception e) { println "Error while parsing references: "+ref+" "+e}
-}
-
-// compute the concordance with contexts of 15 words on each side of the keyword
-//query = new Query(Query.fixQuery(query))
-def viewprops = [word]
-viewprops.addAll(annots)
-Concordance concordance = new Concordance(corpus)
-concordance.setParameters(query, [word], [word], [word], viewprops, viewprops, viewprops, referencePattern, referencePattern, leftcontextsize, rightcontextsize)
-concordance.compute()
-//println "Conc done "+(System.currentTimeMillis()-start)
-
-def writer = tsvFile.newWriter("UTF-8");
-
-//println "Writing lines..."
-start = System.currentTimeMillis()
-String annotHeader = ""
-for (def annot : annots) annotHeader += "\t$annot"
-writer.write("N"+"\t"+"Références"+"\t"+"ContexteGauche"+"\t"+"Pivot"+annotHeader+"\t"+"ContexteDroit"+"\t"+"id"+"\t"+"text_id\n")
-
-// define which occurrence properties will be displayed
-concordance.setViewProperties([word])
-int NLines = concordance.getNLines();
-int chunk = 1000;
-for (int i = 0 ; i < concordance.getNLines() ; i += chunk) {
-	List<Line> lines
-	if (i+chunk > NLines)
-		lines = concordance.getLines(i, concordance.getNLines()-1)
-	else
-		lines = concordance.getLines(i, i+chunk-1) // e.g. from 0 to 999
-
-	int n = 1
-	for (Line l : lines) {
-		String ntext = l.getViewRef().getValue(text_id)
-		String lcontext = l.leftContextToString()
-		String pivot = l.keywordToString()
-		String rcontext = l.rightContextToString()
-		String ids = l.getViewRef().getValue(id)
-		String refValue = "";
-		for (def refp : refProperties) refValue += " "+l.getViewRef().getValue(refp)
-
-		String poss = "";
-		for (def annot : annots) {
-			poss += "\t"+l.getViewRef().getValue(annot)
-		}
-
-		//println l.getKeywordsViewProperties().get(pos)
-		writer.write(""+(l.getKeywordPosition())+"\t"+refValue+"\t"+lcontext+"\t"+pivot+poss+"\t"+rcontext+"\t"+ids+"\t"+ntext+"\n")
-	}
-	writer.flush()
-}
-println "Saved in "+tsvFile.getAbsolutePath()
-writer.close()
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.groovy	(revision 0)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.groovy	(revision 3422)
@@ -0,0 +1,105 @@
+package org.txm.macro.annotation;
+
+import org.txm.utils.*
+import org.txm.utils.io.*
+
+import java.nio.charset.Charset
+
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.rcp.swt.widget.parameters.*
+
+@Field @Option(name="inputDirectory", usage="The XML-TXM folder", widget="Folder", required=true, def="")
+def inputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite02")
+
+@Field @Option(name="outputDirectory", usage="The result folder", widget="Folder", required=true, def="")
+def outputDirectory = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/ite03")
+
+@Field @Option(name="tsvFile", usage="The annotation TSV file", widget="File", required=true, def="")
+def tsvFile = new File(System.getProperty("user.home"), "xml/anapovoas/HELPTXM-02-131124/TSV-ITE02.csv")
+
+@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
+def properties = "verificado"
+
+@Field @Option(name="debug", usage="Debug de the macro", widget="Boolean", required=true, def="false")
+def debug = true
+
+if (!ParametersDialog.open(this)) return;
+
+def split = properties.split(",")
+if (split.length == 0) {
+	println "ERROR: no property given"
+	return false
+}
+properties = []
+for (def p : split) properties << p.trim()
+
+println "Injecting annotations with the following parameters:"
+println "- inputDirectory: $inputDirectory"
+println "- outputDirectory: $outputDirectory"
+println "- tsvFile: $tsvFile"
+println "- properties: $properties"
+
+outputDirectory.mkdir()
+if (!outputDirectory.exists()) {
+	println "ERROR: could not create or read $outputDirectory directory"
+	return false
+}
+
+CsvReader records = new CsvReader(tsvFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8"))
+records.setTextQualifier((char)0)
+records.readHeaders();
+
+def header = Arrays.asList(records.getHeaders())
+if (debug) println "CSV header: $header"
+for (def s : properties) if (!header.contains(s)) {
+	println "Missing annotation property : $s"
+	return;
+}
+for (def s : ["text_id", "id"]) if (!header.contains(s)) {
+	println "Missing annotation property : $s"
+	return;
+}
+
+def injections = [:]
+int no = 1;
+while (records.readRecord()) {
+	String textid = records.get("text_id")
+	if (!injections.containsKey(textid)) injections[textid] = [:]
+	
+	def props = [:]
+	for (def s : properties) props[s] = records.get(s)
+	if (records.get("id") == "") {
+		 print "ERROR in record "+no
+	} else {
+		injections[textid][records.get("id")] = props
+	}
+	no++;
+}
+
+println "Injecting..."
+//for (String textid : injections.keySet()) {
+for (File currentXMLFile : inputDirectory.listFiles().sort{ it.name }) {
+	if (currentXMLFile.isDirectory()) continue;
+	if (currentXMLFile.isHidden()) continue;
+	
+	String textid = currentXMLFile.getName();
+	int idx = textid.lastIndexOf(".")
+	if (idx > 0) textid = textid.substring(0, idx);
+	
+	if (injections.containsKey(textid)) {	
+		if (debug) println "Injections of "+injections[textid].size()+" lines."
+		
+		def builder = new AnnotationInjectionFilter(currentXMLFile, injections[textid], properties, debug)
+		println "injecting in $currentXMLFile $properties"
+		builder.process(new File(outputDirectory, currentXMLFile.getName()));
+		println ""+builder.n+" lines injected."
+	} else {
+		println "copying file $currentXMLFile"
+		FileCopy.copy(currentXMLFile, new File(outputDirectory, currentXMLFile.getName()))
+	}
+}
+
+println "New XML-TXM files are saved in ${outputDirectory}."
\ No newline at end of file
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ExportWordPropertiesToTableMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ExportWordPropertiesToTableMacro.groovy	(revision 0)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ExportWordPropertiesToTableMacro.groovy	(revision 3422)
@@ -0,0 +1,187 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// 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.
+//
+//
+// $LastChangedDate: 2012-10-15 17:35:36 +0200 (lun., 15 oct. 2012) $
+// $LastChangedRevision: 2279 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.macro.annotation
+
+import org.txm.Toolbox
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.*
+import org.txm.concordance.core.functions.Concordance
+import org.txm.concordance.core.functions.Line
+import org.txm.functions.concordances.*
+import org.txm.functions.concordances.comparators.*
+import org.txm.searchengine.cqp.ReferencePattern
+
+import java.util.List
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcp.swt.widget.parameters.*
+
+if (!(corpusViewSelection instanceof CQPCorpus)) {
+	println "Error: you must select a corpus or a subcorpus to export properties"
+	return false;
+}
+
+CQPCorpus corpus = corpusViewSelection
+
+
+@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn")
+		def properties = "pos"
+
+@Field @Option(name="query", usage="The query to select words to annotate", widget="Query", required=true, def="[]")
+		def query
+
+@Field @Option(name="leftcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
+		def leftcontextsize = 10
+
+@Field @Option(name="rightcontextsize", usage="The context sizes", widget="Integer", required=true, def="10")
+		def rightcontextsize = 10
+
+@Field @Option(name="references", usage="references to show", widget="String", required=true, def="text_id")
+		def references = "text_id, p_id, s_id"
+
+@Field @Option(name="tsvFile", usage="The result TSV file", widget="File", required=true, def="export.tsv")
+		def tsvFile
+
+if (!ParametersDialog.open(this)) return;
+
+def split = properties.split(",")
+if (split.length == 0) {
+	println "ERROR: no property given"
+	return false
+}
+properties = []
+for (def p : split) properties << p.trim()
+
+println "Building Annotation Table with the following parameters: "
+println "- corpus: $corpus"
+println "- query: $query"
+println "- annotation properties: $properties"
+println "- TSV file: $tsvFile"
+
+tsvFile = tsvFile.getAbsoluteFile()
+if (!tsvFile.getParentFile().canWrite()) {
+	println "Error: "+tsvFile.getParentFile()+" is not writable."
+	return;
+}
+
+def annots = []
+for (def p : properties) {
+	def prop = corpus.getProperty(p)
+	if (prop == null) {
+		println "No such property $p in the $corpus corpus"
+		return false;
+	}
+	annots << prop
+}
+def id = corpus.getProperty("id")
+def word = corpus.getProperty("word")
+def text = corpus.getStructuralUnit("text")
+def text_id = text.getProperty("id")
+def refs = references.split(",")
+
+if (annots == null || annots.size() == 0) {
+	println "No such property given"//$annots in the $corpus corpus"
+	return false;
+}
+
+println "Exporting ..."
+def start = System.currentTimeMillis()
+
+// define the references pattern for each concordance line
+def referencePattern = new ReferencePattern()
+referencePattern.addProperty(text_id)
+referencePattern.addProperty(id)
+for (def annot : annots) referencePattern.addProperty(annot)
+
+def refProperties = []
+for (def ref : refs) {
+	ref = ref.trim()
+	try {
+		if (ref.contains("_")) {
+			def split2 = ref.split("_",2)
+			def refp = corpus.getStructuralUnit(split2[0].trim()).getProperty(split2[1].trim())
+			if (ref != "text_id")
+				referencePattern.addProperty(refp)
+			refProperties << refp
+		} else {
+			def p = corpus.getProperty(ref)
+			if (p != null) referencePattern.addProperty(p)
+		}
+	} catch(Exception e) { println "Error while parsing references: "+ref+" "+e}
+}
+
+// compute the concordance with contexts of 15 words on each side of the keyword
+//query = new Query(Query.fixQuery(query))
+def viewprops = [word]
+viewprops.addAll(annots)
+Concordance concordance = new Concordance(corpus)
+concordance.setParameters(query, [word], [word], [word], viewprops, viewprops, viewprops, referencePattern, referencePattern, leftcontextsize, rightcontextsize)
+concordance.compute()
+//println "Conc done "+(System.currentTimeMillis()-start)
+
+def writer = tsvFile.newWriter("UTF-8");
+
+//println "Writing lines..."
+start = System.currentTimeMillis()
+String annotHeader = ""
+for (def annot : annots) annotHeader += "\t$annot"
+writer.write("N"+"\t"+"Références"+"\t"+"ContexteGauche"+"\t"+"Pivot"+annotHeader+"\t"+"ContexteDroit"+"\t"+"id"+"\t"+"text_id\n")
+
+// define which occurrence properties will be displayed
+concordance.setViewProperties([word])
+int NLines = concordance.getNLines();
+int chunk = 1000;
+for (int i = 0 ; i < concordance.getNLines() ; i += chunk) {
+	List<Line> lines
+	if (i+chunk > NLines)
+		lines = concordance.getLines(i, concordance.getNLines()-1)
+	else
+		lines = concordance.getLines(i, i+chunk-1) // e.g. from 0 to 999
+
+	int n = 1
+	for (Line l : lines) {
+		String ntext = l.getViewRef().getValue(text_id)
+		String lcontext = l.leftContextToString()
+		String pivot = l.keywordToString()
+		String rcontext = l.rightContextToString()
+		String ids = l.getViewRef().getValue(id)
+		String refValue = "";
+		for (def refp : refProperties) refValue += " "+l.getViewRef().getValue(refp)
+
+		String poss = "";
+		for (def annot : annots) {
+			poss += "\t"+l.getViewRef().getValue(annot)
+		}
+
+		//println l.getKeywordsViewProperties().get(pos)
+		writer.write(""+(l.getKeywordPosition())+"\t"+refValue+"\t"+lcontext+"\t"+pivot+poss+"\t"+rcontext+"\t"+ids+"\t"+ntext+"\n")
+	}
+	writer.flush()
+}
+println "Saved in "+tsvFile.getAbsolutePath()
+writer.close()
\ No newline at end of file
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java	(revision 3421)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java	(revision 3422)
@@ -41,6 +41,7 @@
 import org.txm.objects.Project;
 import org.txm.objects.Text;
 import org.txm.rcp.StatusLine;
+import org.txm.rcp.commands.ShowSelected;
 import org.txm.rcp.editors.CommandLink;
 import org.txm.rcp.utils.IOClipboard;
 import org.txm.rcp.utils.URLUtils;
@@ -295,7 +296,7 @@
 		try {
 			return getBrowser().execute(code);
 		}
-		catch (Exception e) {
+		catch (Throwable e) {
 			Log.severe("Browser execute error: " + e);
 			Log.printStackTrace(e);
 		}
@@ -552,15 +553,17 @@
 				if (focusedWordID != null) {
 					// System.out.println("Focus on: "+focusedWordID);
 					String s = "try { showElementIfNeeded(document.getElementById(\"" + focusedWordID + "\")); } catch (e) {document.getElementById(\"" + focusedWordID + "\").scrollIntoView();};"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+					//String s = "document.getElementById(\"" + focusedWordID + "\").scrollIntoView();"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 					buffer.append(s + "\n"); //$NON-NLS-1$
 				}
 				
 				if (buffer.length() > 0) {
+				//Object rez2 = execute(buffer.toString());
 					if (execute(buffer.toString())) {
 						focusedWordID = null; // focus one time
 					}
 					else {
-						Log.fine("JS execution (focus) error with=" + buffer);
+						Log.fine("JS execution (focus) error with script=" + buffer);
 					}
 				}
 				
@@ -782,6 +785,8 @@
 			if (currentPage == null || !openedPage.equals(currentPage)) {
 				this.showPage(openedPage);
 				return true;
+			} else {
+				updateWordStyles(); // no need to change the page, but still update the focus&styles
 			}
 		}
 		
@@ -1395,6 +1400,20 @@
 					@Override
 					public void widgetDefaultSelected(SelectionEvent e) {}
 				});
+				
+				MenuItem propertiesItem = new MenuItem(menu, SWT.NONE);
+				propertiesItem.setText("Properties");
+				propertiesItem.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						
+						ShowSelected.print(new File(getURL()));
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
 			}
 			
 			@Override
Index: TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java
===================================================================
--- TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 3421)
+++ TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java	(revision 3422)
@@ -999,13 +999,14 @@
 	public boolean backToText(Text text, String line_wordid) {
 		try {
 			text.compute();
-			this.setText(text, false);
+			//this.setText(text, false); // not necesasry if panel.backtotext is called after
 			
 			for (EditionPanel p : editionPanels.values()) {
 				p.backToText(text, line_wordid);
 			}
 			updatePageLabel();
-			updateWordStyles();
+			
+			//updateWordStyles();
 			notifyExtensions("onBackToText"); //$NON-NLS-1$
 			return true;
 		}
Index: TXM/trunk/org.txm.edition.rcp/res/js/functions.js
===================================================================
--- TXM/trunk/org.txm.edition.rcp/res/js/functions.js	(revision 3421)
+++ TXM/trunk/org.txm.edition.rcp/res/js/functions.js	(revision 3422)
@@ -11,6 +11,7 @@
 		return null;
 }
 txmGetParent = function txmGetParent(node) {
+	if (node == null) return;
 	if (typeof node.parentNode != 'undefined')
 		return node.parentNode;
 	else
@@ -186,6 +187,7 @@
 // }
 
 showElementIfNeeded = function showElementIfNeeded(el) {
+	if (el == null) return;
 	if (!Element.prototype.scrollIntoViewIfNeeded) {
 		if (!isAnyPartOfElementInViewport(el))
 			el.scrollIntoView(false);
@@ -196,6 +198,7 @@
 
 isAnyPartOfElementInViewport = function isAnyPartOfElementInViewport(el) {
 	try {
+		if (el == null) return false;
 		const rect = el.getBoundingClientRect();
 		// DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108,
 		// bottom: 108, left: 8 }
@@ -203,10 +206,8 @@
 		const windowWidth = (window.innerWidth || document.documentElement.clientWidth);
 
 		// http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap
-		const vertInView = (rect.top <= windowHeight)
-				&& ((rect.top + rect.height) >= 0);
-		const horInView = (rect.left <= windowWidth)
-				&& ((rect.left + rect.width) >= 0);
+		const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);
+		const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
 
 		return (vertInView && horInView);
 	} catch (e) {
Index: TXM/trunk/org.txm.setups/shared/win/txm.nsi
===================================================================
--- TXM/trunk/org.txm.setups/shared/win/txm.nsi	(revision 3421)
+++ TXM/trunk/org.txm.setups/shared/win/txm.nsi	(revision 3422)
@@ -15,9 +15,9 @@
 
 OutFile "../TXM_TXMDATEVERSION_Win64_installer.exe"
 
-InstallDir "$PROGRAMFILES64\TXM${Version}"
+InstallDir "$LOCALAPPDATA\TXM${Version}"
 
-RequestExecutionLevel admin
+;RequestExecutionLevel admin
 
 ;compression
 
Index: TXM/trunk/org.txm.setups/logs64
===================================================================
--- TXM/trunk/org.txm.setups/logs64	(revision 3421)
+++ TXM/trunk/org.txm.setups/logs64	(revision 3422)
@@ -1,16 +0,0 @@
-0034:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0070:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0078:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0034:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0078:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0070:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0098:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0098:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-002c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-002c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-00c4:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-00c4:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0024:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0024:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0100:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
-0100:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
Index: TXM/trunk/org.txm.xmleditor.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.xmleditor.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.xmleditor.rcp/plugin.xml	(revision 3422)
@@ -25,6 +25,7 @@
             locationURI="popup:org.txm.edition.rcp.editors.SynopticEditionEditor">
          <command
                commandId="org.txm.xmleditor.OpenXMLEditor"
+               label="%command.label.0"
                style="push">
          </command>
       </menuContribution>
@@ -32,7 +33,7 @@
             locationURI="popup:org.txm.concordance.rcp.editors.ConcordanceEditor">
          <command
                commandId="org.txm.xmleditor.OpenXMLEditor"
-               label="%command.name2"
+               label="%command.label.0"
                style="push">
          </command>
       </menuContribution>
Index: TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/OpenXMLEditor.java
===================================================================
--- TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/OpenXMLEditor.java	(revision 3421)
+++ TXM/trunk/org.txm.xmleditor.rcp/src/org/txm/xmleditor/OpenXMLEditor.java	(revision 3422)
@@ -12,6 +12,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.search.ui.ISearchQuery;
@@ -47,6 +48,7 @@
 	
 	public static String lastopenedfile;
 	
+	public int ALERT = 1000;
 	
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
@@ -68,6 +70,12 @@
 			
 			File txmFile = text.getXMLTXMFile();
 			if (txmFile != null && txmFile.exists()) {
+				if (txmFile.length() > ALERT) {
+					if (!MessageDialog.openQuestion(shell, "Big file /o\\", txmFile.getAbsolutePath()+" is a very big file. Do you want to continue and opens it?")) {
+						Log.info("Aborting the opening of "+txmFile);
+						return null;
+					}
+				}
 				reditor = openfile(txmFile);
 			}
 			else { // wrong link ?
@@ -104,7 +112,7 @@
 				XMLMultiPageEditorPart xmlEditor = (XMLMultiPageEditorPart) reditor;
 				Object selectedPage = xmlEditor.getSelectedPage();
 				if (selectedPage != null && selectedPage instanceof StructuredTextEditor) {
-					System.out.println("Word selection: " + line.getKeywordIds());
+					System.out.println("Word selection identifiers: " + line.getKeywordIds());
 				}
 			}
 		}
Index: TXM/trunk/org.txm.xmleditor.rcp/build.properties
===================================================================
--- TXM/trunk/org.txm.xmleditor.rcp/build.properties	(revision 3421)
+++ TXM/trunk/org.txm.xmleditor.rcp/build.properties	(revision 3422)
@@ -3,6 +3,7 @@
 bin.includes = plugin.xml,\
                META-INF/,\
                .,\
-               OSGI-INF/
+               OSGI-INF/,\
+               OSGI-INF/l10n/bundle.properties
 source..=src/
 #qualifier=svn
Index: TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3421)
+++ TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3422)
@@ -9,6 +9,5 @@
 
 command.name = Ouvrir un fichier XML
 
-command.name2 = Ouvrir le fichier XML-TEI TXM
-
+command.label.0 = Ouvrir le fichier XML-TEI TXM
 command.tooltip = Ouvre le fichier s\u00E9lectionner dans l'\u00E9diteur XML
Index: TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle.properties	(revision 3421)
+++ TXM/trunk/org.txm.xmleditor.rcp/OSGI-INF/l10n/bundle.properties	(revision 3422)
@@ -1,7 +1,7 @@
 #Properties file for XmlEditorRCP
 command.name = Open XML File...
-command.name2 = Open the XML-TEI TXM file
 command.label = XmlEditor
 command.tooltip = Open the selected file with the XML editor
 activity.name = disable activity
-Bundle-Name = XmlEditorRCP
\ No newline at end of file
+Bundle-Name = XmlEditorRCP
+command.label.0 = Open the XML-TEI TXM file
\ No newline at end of file
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ExportPreferencePage.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ExportPreferencePage.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ExportPreferencePage.java	(revision 3422)
@@ -33,7 +33,6 @@
 import org.eclipse.jface.preference.ComboFieldEditor;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.messages.TXMUIMessages;
-// TODO: Auto-generated Javadoc
 /**
  * The Class ExportPreferencePage.
  */
@@ -70,8 +69,7 @@
 	 */
 	@Override
 	protected void createFieldEditors() {
-		Set<String> encodings = java.nio.charset.Charset.availableCharsets()
-				.keySet();
+		Set<String> encodings = java.nio.charset.Charset.availableCharsets().keySet();
 		String[][] values = new String[encodings.size()][2];
 		int i = 0;
 		for (String s : encodings) {
@@ -79,24 +77,19 @@
 			i++;
 		}
 
-		encoding = new ComboFieldEditor(TBXPreferences.EXPORT_ENCODING,
-				TXMUIMessages.exportFileEncoding, values, getFieldEditorParent());
+		encoding = new ComboFieldEditor(TBXPreferences.EXPORT_ENCODING, TXMUIMessages.exportFileEncoding, values, getFieldEditorParent());
 		addField(encoding);
 		
-		String[][] cols = {{"\t","\t"}, {",", ","}, {";", ";"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-		String txts[][] = {{"", ""}, {"\"", "\""}, {"'", "'"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-		colseparators = new ComboFieldEditor(TBXPreferences.EXPORT_COL_SEPARATOR,
-				TXMUIMessages.columnsSeparatedBy, cols, getFieldEditorParent());
+		String[][] cols = {{TXMUIMessages.tabulation, "\t"}, {",", ","}, {";", ";"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		String txts[][] = {{TXMUIMessages.nothing, ""}, {"\"", "\""}, {"'", "'"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		colseparators = new ComboFieldEditor(TBXPreferences.EXPORT_COL_SEPARATOR, TXMUIMessages.columnsSeparatedBy, cols, getFieldEditorParent());
 		addField(colseparators);
 		
 		
-		txtseparators = new ComboFieldEditor(TBXPreferences.EXPORT_TXT_SEPARATOR,
-				TXMUIMessages.textSeparator, txts, getFieldEditorParent());
+		txtseparators = new ComboFieldEditor(TBXPreferences.EXPORT_TXT_SEPARATOR, TXMUIMessages.textSeparator, txts, getFieldEditorParent());
 		addField(txtseparators);
 
-		show_export = new BooleanFieldEditor(TBXPreferences.EXPORT_SHOW,
-				TXMUIMessages.showExportResultInTheTextEditor,
-				BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent());
+		show_export = new BooleanFieldEditor(TBXPreferences.EXPORT_SHOW, TXMUIMessages.showExportResultInTheTextEditor, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent());
 		addField(show_export);
 		
 		
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiestoTable.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiestoTable.java	(revision 0)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiestoTable.java	(revision 3422)
@@ -0,0 +1,25 @@
+package org.txm.rcp.commands.function;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.rcp.handlers.scripts.ExecuteGroovyMacro;
+
+public class WordPropertiestoTable extends AbstractHandler{
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IWorkbenchPart part = HandlerUtil.getActivePart(event);
+		IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
+		
+		File script = new File(Toolbox.getTxmHomePath(), "/scripts/groovy/user/org/txm/macro/annotation/ExportWordPropertiesToTableMacro.groovy");
+		ExecuteGroovyMacro.execute(script.getAbsolutePath(), part, selection, "");
+		return null;
+	}
+}

Property changes on: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiestoTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiesFromTable.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiesFromTable.java	(revision 0)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiesFromTable.java	(revision 3422)
@@ -0,0 +1,26 @@
+package org.txm.rcp.commands.function;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.rcp.handlers.scripts.ExecuteGroovyMacro;
+
+public class WordPropertiesFromTable extends AbstractHandler{
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IWorkbenchPart part = HandlerUtil.getActivePart(event);
+		IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
+		
+		File script = new File(Toolbox.getTxmHomePath(), "/scripts/groovy/user/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.groovy");
+		ExecuteGroovyMacro.execute(script.getAbsolutePath(), part, selection, "");
+		return null;
+	}
+	
+}

Property changes on: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiesFromTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenWelcomePage.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenWelcomePage.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenWelcomePage.java	(revision 3422)
@@ -45,7 +45,7 @@
 	/** The Constant ID. */
 	public final static String ID = "org.txm.rcp.commands.OpenWelcomePage"; //$NON-NLS-1$
 	
-	public static String WELCOME = "https://pages.textometrie.org/textometrie/files/software/TXM/";
+	public static String WELCOME = "https://pages.textometrie.org/textometrie/files/software/TXM/"; //$NON-NLS-1$
 	
 	/*
 	 * (non-Javadoc)
@@ -63,13 +63,11 @@
 		int idx = version.lastIndexOf("."); //$NON-NLS-1$
 		if (idx > 0) version = version.substring(0, idx); // remove the "qualifier" part
 		
-		// version += "beta";
-		
 		if ("fr".equals(locale)) {
-			return OpenBrowser.openfile(WELCOME + version + "/welcome") != null;
+			return OpenBrowser.openfile(WELCOME + version + "/welcome") != null; //$NON-NLS-1$ $NON-NLS-2$
 		}
 		else {
-			return OpenBrowser.openfile(OpenLocalizedWebPage.getValidURL(WELCOME + version + "/" + locale + "/welcome", (WELCOME + version + "/welcome"))) != null;
+			return OpenBrowser.openfile(OpenLocalizedWebPage.getValidURL(WELCOME + version + "/" + locale + "/welcome", (WELCOME + version + "/welcome"))) != null; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
 		}
 	}
 }
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/ShowSelected.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/ShowSelected.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/ShowSelected.java	(revision 3422)
@@ -66,4 +66,24 @@
 		}
 		return null;
 	}
+	
+	public static void print(IStructuredSelection structSelection) {
+		if (structSelection == null) System.out.println("no selection.");
+		
+		for (Object elem : structSelection.toList()) {
+			print(elem);
+		}
+	}
+	
+	public static void print(Object elem) {
+		if (elem instanceof File) {
+			File f = (File)elem;
+			System.out.println(TXMUIMessages.fileColon);
+			System.out.println(" path="+f.getAbsolutePath());
+			System.out.println(" size="+f.length()/1000+" kb");
+			System.out.println(" rights: read="+f.canRead()+" write="+f.canWrite()+" execute="+f.canExecute());
+		} else {
+			System.out.println(elem);
+		}
+	}
 }
\ No newline at end of file
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java	(revision 3422)
@@ -27,8 +27,11 @@
 //
 package org.txm.rcp;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.e4.ui.model.application.ui.SideValue;
 import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
 import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
@@ -38,14 +41,20 @@
 import org.eclipse.e4.ui.workbench.modeling.EModelService;
 import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchAdvisor;
 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
 import org.eclipse.ui.internal.WorkbenchWindow;
+import org.txm.Toolbox;
+import org.txm.annotation.core.AnnotationEngine;
+import org.txm.annotation.core.AnnotationEnginesManager;
+import org.txm.core.engines.EngineType;
+import org.txm.objects.CorpusBuild;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.utils.logger.Log;
 
@@ -156,4 +165,31 @@
 		// }
 		// }
 	}
+	
+    /**
+	 * Check if some annotations are not saved and ask the user if he really wish to close TXM.
+	 *
+	 * @return <code>true</code> to allow the window to close, and
+	 *         <code>false</code> if some annotations are not saved and the user wants to save them before
+	 * @see org.eclipse.ui.IWorkbenchWindow#close
+	 * @see WorkbenchAdvisor#preShutdown()
+	 */
+	public boolean preWindowShellClose() {
+		AnnotationEnginesManager aem = (AnnotationEnginesManager) Toolbox.getEngineManager(EngineType.ANNOTATION);
+		HashMap<CorpusBuild, ArrayList<AnnotationEngine>> notSaved = aem.getEnginesWithSaveNeededPerCorpus();
+		if (notSaved.size() > 0) {
+			StringBuilder mess = new StringBuilder();
+			mess.append( "Some annotations are not saved for corpus and engines:");
+			for (CorpusBuild corpus : notSaved.keySet())  {
+				mess.append("\n- "+corpus+":");
+				for (AnnotationEngine a: notSaved.get(corpus)) {
+					mess.append("\n  - "+a.getName());
+				}
+			}
+			mess.append("\n\nContinue and lost the unsaved annotations ?");
+			return MessageDialog.openConfirm(this.getWindowConfigurer().getWindow().getShell(), "Some annotations are not saved", mess.toString());
+		} else {
+			return true;
+		}
+	}
 }
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java	(revision 3422)
@@ -1,389 +0,0 @@
-package org.txm.rcp.editors.imports.sections;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.txm.objects.Project;
-import org.txm.rcp.editors.imports.ImportFormEditor;
-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;
-
-public class TokenizerSection extends ImportEditorSection {
-	
-	static final int SECTION_SIZE = 1;
-	
-	Text wordElementText;
-	
-	Button doTokenizeStepButton;
-	
-	Button doRetokenizeStepButton;
-	
-	Button doBuildWordIDsButton;
-	
-	Text textElisions;
-	
-	Text textPuncts;
-	
-	Text textPunctsStrong;
-	
-	Text textWhiteSpaces;
-	
-	Label titleLabel;
-	
-	TableViewer tokenizerParamsViewer;
-	
-	TableViewer tokenizerParamsViewer2;
-	
-	private HashMap<String, Boolean> moduleParams;
-	
-	public TokenizerSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style, HashMap<String, Boolean> moduleParams) {
-		super(editor, toolkit2, form2, parent, style, "tokenizer");
-		this.moduleParams = moduleParams;
-		this.section.setText(TXMUIMessages.lexicalSegmentation);
-		TableWrapLayout layout = new TableWrapLayout();
-		layout.makeColumnsEqualWidth = true;
-		this.section.setLayout(layout);
-		this.section.setLayoutData(getSectionGridData(SECTION_SIZE));
-		this.section.setEnabled(false);
-		
-		this.section.addExpansionListener(new ExpansionAdapter() {
-			
-			@Override
-			public void expansionStateChanged(ExpansionEvent e) {
-				form.layout(true);
-			}
-		});
-		
-		Composite sectionClient = toolkit.createComposite(this.section);
-		TableWrapLayout slayout = new TableWrapLayout();
-		slayout.makeColumnsEqualWidth = false;
-		slayout.numColumns = 3;
-		sectionClient.setLayout(slayout);
-		this.section.setClient(sectionClient);
-		
-		Label tmpLabel3 = toolkit.createLabel(sectionClient, TXMUIMessages.wordTag);
-		TableWrapData gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		tmpLabel3.setLayoutData(gdata);
-		tmpLabel3.setToolTipText(TXMUIMessages.xmlTagNameThatEncodesWords);
-		tmpLabel3.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		
-		wordElementText = toolkit.createText(sectionClient, "w", SWT.BORDER); //$NON-NLS-1$
-		gdata = getTextGridData();
-		wordElementText.setLayoutData(gdata);
-		wordElementText.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		doTokenizeStepButton = toolkit.createButton(sectionClient, TXMUIMessages.tokenization, SWT.CHECK);
-		doTokenizeStepButton.setSelection(true);
-		doTokenizeStepButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 3;
-		doTokenizeStepButton.setLayoutData(gdata);
-		doTokenizeStepButton.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				updateFieldsEnableState();
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-		});
-		
-		doRetokenizeStepButton = toolkit.createButton(sectionClient, TXMUIMessages.retokenizePreEncodedWords, SWT.CHECK);
-		doRetokenizeStepButton.setToolTipText(TXMUIMessages.performWordSegmentationWithinWord);
-		doRetokenizeStepButton.setSelection(true);
-		doRetokenizeStepButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.indent = 20;
-		gdata.colspan = 3;
-		doRetokenizeStepButton.setLayoutData(gdata);
-		
-		doBuildWordIDsButton = toolkit.createButton(sectionClient, "Build word identifiers", SWT.CHECK);
-		doBuildWordIDsButton.setToolTipText(TXMUIMessages.performWordSegmentationWithinWord);
-		doBuildWordIDsButton.setSelection(true);
-		doBuildWordIDsButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.indent = 20;
-		gdata.colspan = 3;
-		doBuildWordIDsButton.setLayoutData(gdata);
-		
-		Label l0 = toolkit.createLabel(sectionClient, TXMUIMessages.separatorCharacters, SWT.WRAP);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 3;
-		gdata.indent = 20;
-		l0.setLayoutData(gdata);
-		
-		Label l1 = toolkit.createLabel(sectionClient, TXMUIMessages.spaces, SWT.WRAP);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		gdata.indent = 40;
-		l1.setLayoutData(gdata);
-		
-		textWhiteSpaces = toolkit.createText(sectionClient, "", SWT.BORDER);
-		gdata = getLongTextGridData();
-		textWhiteSpaces.setLayoutData(gdata);
-		
-		Label l2 = toolkit.createLabel(sectionClient, TXMUIMessages.punctuations, SWT.WRAP);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		gdata.indent = 40;
-		l2.setLayoutData(gdata);
-		
-		textPuncts = toolkit.createText(sectionClient, "", SWT.BORDER);
-		gdata = getLongTextGridData();
-		textPuncts.setLayoutData(gdata);
-		
-		Label l4 = toolkit.createLabel(sectionClient, TXMUIMessages.elisionCharacters, SWT.WRAP);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		gdata.indent = 20;
-		l4.setLayoutData(gdata);
-		
-		textElisions = toolkit.createText(sectionClient, "", SWT.BORDER);
-		gdata = getLongTextGridData();
-		textElisions.setLayoutData(gdata);
-		
-		Label l3 = toolkit.createLabel(sectionClient, TXMUIMessages.endOfSentenceCharacters, SWT.WRAP);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		gdata.indent = 20;
-		l3.setLayoutData(gdata);
-		
-		textPunctsStrong = toolkit.createText(sectionClient, "", SWT.BORDER);
-		gdata = getLongTextGridData();
-		textPunctsStrong.setLayoutData(gdata);
-		
-		Button defaultBtn = toolkit.createButton(sectionClient, TXMUIMessages._default_2, SWT.PUSH);
-		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
-		gdata.colspan = 2;
-		gdata.indent = 20;
-		defaultBtn.setLayoutData(gdata);
-		defaultBtn.addSelectionListener(new SelectionListener() {
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {}
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				TokenizerClasses tc = new TokenizerClasses(); // use default tokenizer classes
-				textWhiteSpaces.setText(tc.whitespaces);
-				textPuncts.setText(tc.regPunct);
-				textPunctsStrong.setText(tc.punct_strong);
-				textElisions.setText(tc.regElision);
-			}
-		});
-		
-		/*
-		 * setAddSetTestsButton = toolkit.createButton(sectionClient, Messages.CorpusPage_28, SWT.CHECK);
-		 * setAddSetTestsButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,4,1));
-		 * // setAddSetTestsButton.setSelection(params.getTokenizerElement(params.getCorpusElement()))
-		 * Button addButton = toolkit.createButton(sectionClient, Messages.CorpusPage_29, SWT.PUSH);
-		 * addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
-		 * addButton.addSelectionListener(new SelectionListener() {
-		 * @Override
-		 * public void widgetDefaultSelected(SelectionEvent e) {
-		 * }
-		 * @Override
-		 * public void widgetSelected(SelectionEvent e) {
-		 * if (params == null) return;
-		 * LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
-		 * values.put("name", ""); //$NON-NLS-1$ //$NON-NLS-2$
-		 * values.put("value", ""); //$NON-NLS-1$ //$NON-NLS-2$
-		 * MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_29, values);
-		 * if (dlg.open() == Window.OK) {
-		 * params.addTokenizerParameter(params.getCorpusElement(), values.get("name"), values.get("value")); //$NON-NLS-1$ //$NON-NLS-2$
-		 * updateTokenizerSection();
-		 * }
-		 * }
-		 * });
-		 * Button removeButton = toolkit.createButton(sectionClient, Messages.CorpusPage_31, SWT.PUSH);
-		 * removeButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
-		 * removeButton.addSelectionListener(new SelectionListener() {
-		 * @Override
-		 * public void widgetDefaultSelected(SelectionEvent e) {
-		 * }
-		 * @Override
-		 * public void widgetSelected(SelectionEvent e) {
-		 * if (params == null) return;
-		 * ISelection sel = tokenizerParamsViewer.getSelection();
-		 * IStructuredSelection ssel = (IStructuredSelection) sel;
-		 * Object obj = ssel.getFirstElement();
-		 * if (obj instanceof Element) {
-		 * Element query = (Element) obj;
-		 * params.getTokenizerElement(params.getCorpusElement()).removeChild(query);
-		 * updateTokenizerSection();
-		 * }
-		 * }
-		 * });
-		 * Button addButton2 = toolkit.createButton(sectionClient, Messages.CorpusPage_32, SWT.PUSH);
-		 * addButton2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
-		 * addButton2.addSelectionListener(new SelectionListener() {
-		 * @Override
-		 * public void widgetDefaultSelected(SelectionEvent e) {
-		 * }
-		 * @Override
-		 * public void widgetSelected(SelectionEvent e) {
-		 * if (params == null) return;
-		 * LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
-		 * values.put("value", "\\A(.+)(.+)(.+)\\Z"); //$NON-NLS-1$ //$NON-NLS-2$
-		 * values.put("type", "w"); //$NON-NLS-1$ //$NON-NLS-2$
-		 * values.put("before", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-		 * values.put("hit", "2"); //$NON-NLS-1$ //$NON-NLS-2$
-		 * values.put("after", "3"); //$NON-NLS-1$ //$NON-NLS-2$
-		 * MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_33, values);
-		 * if (dlg.open() == Window.OK) {
-		 * params.addTokenizerTest(params.getCorpusElement(), values.get("value"), values.get("type"), values.get("before"), values.get("hit"), values.get("after")); //$NON-NLS-1$ //$NON-NLS-2$
-		 * //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-		 * updateTokenizerSection();
-		 * }
-		 * }
-		 * });
-		 * Button removeButton2 = toolkit.createButton(sectionClient, Messages.CorpusPage_34, SWT.PUSH);
-		 * removeButton2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
-		 * removeButton2.addSelectionListener(new SelectionListener() {
-		 * @Override
-		 * public void widgetDefaultSelected(SelectionEvent e) {
-		 * }
-		 * @Override
-		 * public void widgetSelected(SelectionEvent e) {
-		 * if (params == null) return;
-		 * ISelection sel = tokenizerParamsViewer2.getSelection();
-		 * IStructuredSelection ssel = (IStructuredSelection) sel;
-		 * Object obj = ssel.getFirstElement();
-		 * if (obj instanceof Element) {
-		 * Element test = (Element) obj;
-		 * params.getTokenizerElement(params.getCorpusElement()).removeChild(test);
-		 * updateTokenizerSection();
-		 * }
-		 * }
-		 * });
-		 * Table table = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
-		 * tokenizerParamsViewer = new TableViewer(table);
-		 * tokenizerParamsViewer.getTable().addKeyListener(new TableKeyListener(tokenizerParamsViewer));
-		 * GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
-		 * gd.heightHint = 150;
-		 * tokenizerParamsViewer.getTable().setLayoutData(gd);
-		 * tokenizerParamsViewer.setContentProvider(new NodeListContentProvider());
-		 * tokenizerParamsViewer.getTable().setHeaderVisible(true);
-		 * tokenizerParamsViewer.getTable().setLinesVisible(true);
-		 * String[] cols = {"name", "value"}; //$NON-NLS-1$ //$NON-NLS-2$
-		 * for (String col : cols) {
-		 * TableViewerColumn columnViewer = new TableViewerColumn(tokenizerParamsViewer, SWT.NONE);
-		 * TableColumn column = columnViewer.getColumn();
-		 * column.setText(col);
-		 * column.setWidth(100);
-		 * columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
-		 * }
-		 * Table table2 = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
-		 * tokenizerParamsViewer2 = new TableViewer(table2);
-		 * tokenizerParamsViewer2.getTable().addKeyListener(new TableKeyListener(tokenizerParamsViewer2));
-		 * GridData gd2 = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
-		 * gd.heightHint = 150;
-		 * tokenizerParamsViewer2.getTable().setLayoutData(gd2);
-		 * tokenizerParamsViewer2.setContentProvider(new NodeListContentProvider());
-		 * tokenizerParamsViewer2.getTable().setHeaderVisible(true);
-		 * tokenizerParamsViewer2.getTable().setLinesVisible(true);
-		 * String[] cols2 = {"value", "type", "before", "hit", "after"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-		 * for (String col : cols2) {
-		 * TableViewerColumn columnViewer = new TableViewerColumn(tokenizerParamsViewer2, SWT.NONE);
-		 * TableColumn column = columnViewer.getColumn();
-		 * column.setText(col);
-		 * column.setWidth(100);
-		 * columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
-		 * }
-		 */
-		
-	}
-	
-	protected void updateFieldsEnableState() {
-		boolean enabled = doTokenizeStepButton.getSelection();
-		doRetokenizeStepButton.setEnabled(enabled);
-		doBuildWordIDsButton.setEnabled(enabled);
-		if (!enabled) {
-			doRetokenizeStepButton.setSelection(false);
-			doBuildWordIDsButton.setSelection(false);
-		}
-		textWhiteSpaces.setEnabled(enabled);
-		textPuncts.setEnabled(enabled);
-		textElisions.setEnabled(enabled);
-		textPunctsStrong.setEnabled(enabled);
-	}
-	
-	@Override
-	public void updateFields(Project project) {
-		if (this.section.isDisposed()) return;
-		if (project == null) return;
-		
-		TokenizerClasses tc = new TokenizerClasses();
-		tc.loadFromProject(project.getPreferencesScope());
-		
-		textWhiteSpaces.setText(project.getTokenizerParameter("whitespaces", tc.whitespaces)); //$NON-NLS-1$
-		textPuncts.setText(project.getTokenizerParameter("regPunct", tc.regPunct)); //$NON-NLS-1$
-		textPunctsStrong.setText(project.getTokenizerParameter("punct_strong", tc.punct_strong)); //$NON-NLS-1$
-		textElisions.setText(project.getTokenizerParameter("regElision", tc.regElision)); //$NON-NLS-1$
-		
-		String wtagElement = project.getTokenizerWordElement();
-		wordElementText.setText(wtagElement);
-		
-		boolean doTokenizeStep = project.getDoTokenizerStep();
-		doTokenizeStepButton.setSelection(doTokenizeStep);
-		boolean doRetokenizeStep = "true".equals(project.getTokenizerParameter("doRetokenizeStep", "false")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		doRetokenizeStepButton.setSelection(doRetokenizeStep);
-		boolean doBuildWordIds = "true".equals(project.getTokenizerParameter("doBuildWordIds", "true")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		doBuildWordIDsButton.setSelection(doBuildWordIds);
-		updateFieldsEnableState();
-		
-		// HashMap<String, TTest> additionalTests = project.getTokenizerAdditionalTests();
-		// try {
-		// setAddSetTestsButton.setSelection(Boolean.parseBoolean(value.toString()));
-		// } catch (Exception e) { };
-	}
-	
-	@Override
-	public boolean saveFields(Project project) {
-		
-		if (textWhiteSpaces.getText().length() == 0 && textPuncts.getText().length() == 0) {
-			System.out.println(TXMUIMessages.errorWhileSavingTokenizerParameters);
-			return false;
-		}
-		project.addTokenizerParameter("whitespaces", textWhiteSpaces.getText()); //$NON-NLS-1$
-		project.addTokenizerParameter("regPunct", textPuncts.getText()); //$NON-NLS-1$
-		project.addTokenizerParameter("punct_strong", textPunctsStrong.getText()); //$NON-NLS-1$
-		project.addTokenizerParameter("regElision", textElisions.getText()); //$NON-NLS-1$
-		project.addTokenizerParameter("word_tags", wordElementText.getText()); //$NON-NLS-1$
-		project.addTokenizerParameter("doTokenizeStep", "" + doTokenizeStepButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
-		project.addTokenizerParameter("doRetokenizeStep", "" + doRetokenizeStepButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
-		project.addTokenizerParameter("doBuildWordIds", "" + doBuildWordIDsButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
-		project.addTokenizerParameter("onlyThoseTests", "false"); //$NON-NLS-1$ //$NON-NLS-2$
-		// project.setTokenizerAdditionalTests(additionalTokenizerTests); //$NON-NLS-1$
-		
-		return true;
-	}
-	
-	@Override
-	public boolean checkFields() {
-		return true;
-	}
-	
-	@Override
-	public int getSectionSize() {
-		return SECTION_SIZE;
-	}
-}
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TextualPlansSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TextualPlansSection.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TextualPlansSection.java	(revision 3422)
@@ -23,12 +23,6 @@
 	
 	private Text outsideTextElementsToEditText;
 	
-	private Text noteElementsText;
-	
-	private Text milestoneElementsText;
-
-	private Text projectionsText;
-	
 	public TextualPlansSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style) {
 		super(editor, toolkit2, form2, parent, style, "textualplans");
 		
@@ -69,33 +63,6 @@
 		gdata = getTextGridData();
 		outsideTextElementsToEditText.setLayoutData(gdata);
 		
-		Label tmpLabel3 = toolkit.createLabel(sectionClient, "Note elements");
-		tmpLabel3.setToolTipText("Note elements that encodes ponctual notes");
-		tmpLabel3.setLayoutData(getLabelGridData());
-		
-		noteElementsText = toolkit.createText(sectionClient, "note", SWT.BORDER); //$NON-NLS-1$
-		gdata = getTextGridData();
-		noteElementsText.setLayoutData(gdata);
-		
-		Label tmpLabel4 = toolkit.createLabel(sectionClient, TXMUIMessages.milestoneElements);
-		tmpLabel4.setToolTipText(TXMUIMessages.listOfMilestoneElementsSeparatedByComma);
-		tmpLabel4.setLayoutData(getLabelGridData());
-		
-		milestoneElementsText = toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
-		gdata = getTextGridData();
-		milestoneElementsText.setLayoutData(gdata);
-		
-		Label label = toolkit.createLabel(sectionClient, "CQP Structure properties projections", SWT.WRAP);
-		gdata = getLabelGridData();
-		gdata.colspan = 2;
-		label.setLayoutData(gdata);
-		
-		projectionsText = toolkit.createText(sectionClient, "", SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); //$NON-NLS-1$
-		gdata = getTextGridData();
-		gdata.heightHint = 50;
-		gdata.colspan = 2;
-		
-		projectionsText.setLayoutData(gdata);
 	}
 	
 	@Override
@@ -103,9 +70,6 @@
 		if (this.section != null && !section.isDisposed()) {
 			outsideTextElementsText.setText(project.getTextualPlan("OutSideTextTags"));
 			outsideTextElementsToEditText.setText(project.getTextualPlan("OutSideTextTagsAndKeepContent"));
-			noteElementsText.setText(project.getTextualPlan("Note"));
-			milestoneElementsText.setText(project.getTextualPlan("MileStones"));
-			projectionsText.setText(project.getTextualPlan("Projections"));
 		}
 	}
 	
@@ -117,12 +81,6 @@
 			
 			project.setTextualPlan("OutSideTextTagsAndKeepContent", outsideTextElementsToEditText.getText().trim());
 			
-			project.setTextualPlan("Note", noteElementsText.getText());
-			
-			project.setTextualPlan("MileStones", milestoneElementsText.getText().trim());
-			
-			project.setTextualPlan("Projections", projectionsText.getText().trim());
-			
 			return true;
 		}
 		
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 3422)
@@ -37,6 +37,8 @@
 	
 	Button collapsibleMetadataDefaultEditionButton;
 	
+	private Text noteElementsText;
+	
 	Text wordsPerPageText;
 	
 	Text pageBreakText;
@@ -128,6 +130,17 @@
 		
 		if (scriptName.startsWith("xtz")) {
 			
+			Label tmpLabel3 = toolkit.createLabel(sectionClient, "Note elements");
+			tmpLabel3.setToolTipText("Note elements that encodes ponctual notes");
+			TableWrapData gdata3 = getLabelGridData();
+			gdata3.indent = 40;
+			tmpLabel3.setLayoutData(gdata3);
+			
+			noteElementsText = toolkit.createText(sectionClient, "note", SWT.BORDER); //$NON-NLS-1$
+			gdata3 = getTextGridData();
+			gdata3.colspan = 3; // one line
+			noteElementsText.setLayoutData(gdata3);
+			
 			// build text edition or not button
 			buildFacsEditionCheckButton = toolkit.createButton(sectionClient, "Build 'facs' edition", SWT.CHECK);
 			buildFacsEditionCheckButton.setSelection(false);
@@ -280,6 +293,8 @@
 			int wppt = edition_params.getWordsPerPage();
 			wordsPerPageText.setText("" + wppt); //$NON-NLS-1$
 			
+			if (noteElementsText != null) noteElementsText.setText(project.getTextualPlan("Note"));
+			
 			String pbt = edition_params.getPageElement();
 			if (pageBreakText != null)
 				pageBreakText.setText(pbt);
@@ -328,6 +343,8 @@
 			edition_params.setPaginateEdition(paginate);
 			edition_params.setEnableCollapsible(collapsible);
 			
+			if (noteElementsText != null) project.setTextualPlan("Note", noteElementsText.getText());
+			
 			if (buildFacsEditionCheckButton != null) {
 				
 				String images_directory = "";
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/WordsSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/WordsSection.java	(revision 0)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/WordsSection.java	(revision 3422)
@@ -0,0 +1,389 @@
+package org.txm.rcp.editors.imports.sections;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.txm.objects.Project;
+import org.txm.rcp.editors.imports.ImportFormEditor;
+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;
+
+public class WordsSection extends ImportEditorSection {
+	
+	static final int SECTION_SIZE = 1;
+	
+	Text wordElementText;
+	
+	Button doTokenizeStepButton;
+	
+	Button doRetokenizeStepButton;
+	
+	Button doBuildWordIDsButton;
+	
+	Text textElisions;
+	
+	Text textPuncts;
+	
+	Text textPunctsStrong;
+	
+	Text textWhiteSpaces;
+	
+	Label titleLabel;
+	
+	TableViewer tokenizerParamsViewer;
+	
+	TableViewer tokenizerParamsViewer2;
+	
+	private HashMap<String, Boolean> moduleParams;
+	
+	public WordsSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style, HashMap<String, Boolean> moduleParams) {
+		super(editor, toolkit2, form2, parent, style, "words");
+		this.moduleParams = moduleParams;
+		this.section.setText("Words");
+		TableWrapLayout layout = new TableWrapLayout();
+		layout.makeColumnsEqualWidth = true;
+		this.section.setLayout(layout);
+		this.section.setLayoutData(getSectionGridData(SECTION_SIZE));
+		this.section.setEnabled(false);
+		
+		this.section.addExpansionListener(new ExpansionAdapter() {
+			
+			@Override
+			public void expansionStateChanged(ExpansionEvent e) {
+				form.layout(true);
+			}
+		});
+		
+		Composite sectionClient = toolkit.createComposite(this.section);
+		TableWrapLayout slayout = new TableWrapLayout();
+		slayout.makeColumnsEqualWidth = false;
+		slayout.numColumns = 3;
+		sectionClient.setLayout(slayout);
+		this.section.setClient(sectionClient);
+		
+		Label tmpLabel3 = toolkit.createLabel(sectionClient, TXMUIMessages.wordTag);
+		TableWrapData gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		tmpLabel3.setLayoutData(gdata);
+		tmpLabel3.setToolTipText(TXMUIMessages.xmlTagNameThatEncodesWords);
+		tmpLabel3.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
+		
+		wordElementText = toolkit.createText(sectionClient, "w", SWT.BORDER); //$NON-NLS-1$
+		gdata = getTextGridData();
+		wordElementText.setLayoutData(gdata);
+		wordElementText.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
+		doTokenizeStepButton = toolkit.createButton(sectionClient, TXMUIMessages.tokenization, SWT.CHECK);
+		doTokenizeStepButton.setSelection(true);
+		doTokenizeStepButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 3;
+		doTokenizeStepButton.setLayoutData(gdata);
+		doTokenizeStepButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				updateFieldsEnableState();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		doRetokenizeStepButton = toolkit.createButton(sectionClient, TXMUIMessages.retokenizePreEncodedWords, SWT.CHECK);
+		doRetokenizeStepButton.setToolTipText(TXMUIMessages.performWordSegmentationWithinWord);
+		doRetokenizeStepButton.setSelection(true);
+		doRetokenizeStepButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.indent = 20;
+		gdata.colspan = 3;
+		doRetokenizeStepButton.setLayoutData(gdata);
+		
+		doBuildWordIDsButton = toolkit.createButton(sectionClient, "Build word identifiers", SWT.CHECK);
+		doBuildWordIDsButton.setToolTipText(TXMUIMessages.performWordSegmentationWithinWord);
+		doBuildWordIDsButton.setSelection(true);
+		doBuildWordIDsButton.setVisible(moduleParams.get(ImportModuleCustomization.ADVANCEDTOKENIZER));
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.indent = 20;
+		gdata.colspan = 3;
+		doBuildWordIDsButton.setLayoutData(gdata);
+		
+		Label l0 = toolkit.createLabel(sectionClient, TXMUIMessages.separatorCharacters, SWT.WRAP);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 3;
+		gdata.indent = 20;
+		l0.setLayoutData(gdata);
+		
+		Label l1 = toolkit.createLabel(sectionClient, TXMUIMessages.spaces, SWT.WRAP);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		gdata.indent = 40;
+		l1.setLayoutData(gdata);
+		
+		textWhiteSpaces = toolkit.createText(sectionClient, "", SWT.BORDER);
+		gdata = getLongTextGridData();
+		textWhiteSpaces.setLayoutData(gdata);
+		
+		Label l2 = toolkit.createLabel(sectionClient, TXMUIMessages.punctuations, SWT.WRAP);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		gdata.indent = 40;
+		l2.setLayoutData(gdata);
+		
+		textPuncts = toolkit.createText(sectionClient, "", SWT.BORDER);
+		gdata = getLongTextGridData();
+		textPuncts.setLayoutData(gdata);
+		
+		Label l4 = toolkit.createLabel(sectionClient, TXMUIMessages.elisionCharacters, SWT.WRAP);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		gdata.indent = 20;
+		l4.setLayoutData(gdata);
+		
+		textElisions = toolkit.createText(sectionClient, "", SWT.BORDER);
+		gdata = getLongTextGridData();
+		textElisions.setLayoutData(gdata);
+		
+		Label l3 = toolkit.createLabel(sectionClient, TXMUIMessages.endOfSentenceCharacters, SWT.WRAP);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		gdata.indent = 20;
+		l3.setLayoutData(gdata);
+		
+		textPunctsStrong = toolkit.createText(sectionClient, "", SWT.BORDER);
+		gdata = getLongTextGridData();
+		textPunctsStrong.setLayoutData(gdata);
+		
+		Button defaultBtn = toolkit.createButton(sectionClient, TXMUIMessages._default_2, SWT.PUSH);
+		gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL);
+		gdata.colspan = 2;
+		gdata.indent = 20;
+		defaultBtn.setLayoutData(gdata);
+		defaultBtn.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TokenizerClasses tc = new TokenizerClasses(); // use default tokenizer classes
+				textWhiteSpaces.setText(tc.whitespaces);
+				textPuncts.setText(tc.regPunct);
+				textPunctsStrong.setText(tc.punct_strong);
+				textElisions.setText(tc.regElision);
+			}
+		});
+		
+		/*
+		 * setAddSetTestsButton = toolkit.createButton(sectionClient, Messages.CorpusPage_28, SWT.CHECK);
+		 * setAddSetTestsButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,4,1));
+		 * // setAddSetTestsButton.setSelection(params.getTokenizerElement(params.getCorpusElement()))
+		 * Button addButton = toolkit.createButton(sectionClient, Messages.CorpusPage_29, SWT.PUSH);
+		 * addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
+		 * addButton.addSelectionListener(new SelectionListener() {
+		 * @Override
+		 * public void widgetDefaultSelected(SelectionEvent e) {
+		 * }
+		 * @Override
+		 * public void widgetSelected(SelectionEvent e) {
+		 * if (params == null) return;
+		 * LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
+		 * values.put("name", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		 * values.put("value", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		 * MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_29, values);
+		 * if (dlg.open() == Window.OK) {
+		 * params.addTokenizerParameter(params.getCorpusElement(), values.get("name"), values.get("value")); //$NON-NLS-1$ //$NON-NLS-2$
+		 * updateTokenizerSection();
+		 * }
+		 * }
+		 * });
+		 * Button removeButton = toolkit.createButton(sectionClient, Messages.CorpusPage_31, SWT.PUSH);
+		 * removeButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
+		 * removeButton.addSelectionListener(new SelectionListener() {
+		 * @Override
+		 * public void widgetDefaultSelected(SelectionEvent e) {
+		 * }
+		 * @Override
+		 * public void widgetSelected(SelectionEvent e) {
+		 * if (params == null) return;
+		 * ISelection sel = tokenizerParamsViewer.getSelection();
+		 * IStructuredSelection ssel = (IStructuredSelection) sel;
+		 * Object obj = ssel.getFirstElement();
+		 * if (obj instanceof Element) {
+		 * Element query = (Element) obj;
+		 * params.getTokenizerElement(params.getCorpusElement()).removeChild(query);
+		 * updateTokenizerSection();
+		 * }
+		 * }
+		 * });
+		 * Button addButton2 = toolkit.createButton(sectionClient, Messages.CorpusPage_32, SWT.PUSH);
+		 * addButton2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
+		 * addButton2.addSelectionListener(new SelectionListener() {
+		 * @Override
+		 * public void widgetDefaultSelected(SelectionEvent e) {
+		 * }
+		 * @Override
+		 * public void widgetSelected(SelectionEvent e) {
+		 * if (params == null) return;
+		 * LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
+		 * values.put("value", "\\A(.+)(.+)(.+)\\Z"); //$NON-NLS-1$ //$NON-NLS-2$
+		 * values.put("type", "w"); //$NON-NLS-1$ //$NON-NLS-2$
+		 * values.put("before", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		 * values.put("hit", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+		 * values.put("after", "3"); //$NON-NLS-1$ //$NON-NLS-2$
+		 * MultipleValueDialog dlg = new MultipleValueDialog(form.getShell(), Messages.CorpusPage_33, values);
+		 * if (dlg.open() == Window.OK) {
+		 * params.addTokenizerTest(params.getCorpusElement(), values.get("value"), values.get("type"), values.get("before"), values.get("hit"), values.get("after")); //$NON-NLS-1$ //$NON-NLS-2$
+		 * //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		 * updateTokenizerSection();
+		 * }
+		 * }
+		 * });
+		 * Button removeButton2 = toolkit.createButton(sectionClient, Messages.CorpusPage_34, SWT.PUSH);
+		 * removeButton2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,1,1));
+		 * removeButton2.addSelectionListener(new SelectionListener() {
+		 * @Override
+		 * public void widgetDefaultSelected(SelectionEvent e) {
+		 * }
+		 * @Override
+		 * public void widgetSelected(SelectionEvent e) {
+		 * if (params == null) return;
+		 * ISelection sel = tokenizerParamsViewer2.getSelection();
+		 * IStructuredSelection ssel = (IStructuredSelection) sel;
+		 * Object obj = ssel.getFirstElement();
+		 * if (obj instanceof Element) {
+		 * Element test = (Element) obj;
+		 * params.getTokenizerElement(params.getCorpusElement()).removeChild(test);
+		 * updateTokenizerSection();
+		 * }
+		 * }
+		 * });
+		 * Table table = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
+		 * tokenizerParamsViewer = new TableViewer(table);
+		 * tokenizerParamsViewer.getTable().addKeyListener(new TableKeyListener(tokenizerParamsViewer));
+		 * GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
+		 * gd.heightHint = 150;
+		 * tokenizerParamsViewer.getTable().setLayoutData(gd);
+		 * tokenizerParamsViewer.setContentProvider(new NodeListContentProvider());
+		 * tokenizerParamsViewer.getTable().setHeaderVisible(true);
+		 * tokenizerParamsViewer.getTable().setLinesVisible(true);
+		 * String[] cols = {"name", "value"}; //$NON-NLS-1$ //$NON-NLS-2$
+		 * for (String col : cols) {
+		 * TableViewerColumn columnViewer = new TableViewerColumn(tokenizerParamsViewer, SWT.NONE);
+		 * TableColumn column = columnViewer.getColumn();
+		 * column.setText(col);
+		 * column.setWidth(100);
+		 * columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
+		 * }
+		 * Table table2 = toolkit.createTable(sectionClient, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.VIRTUAL);
+		 * tokenizerParamsViewer2 = new TableViewer(table2);
+		 * tokenizerParamsViewer2.getTable().addKeyListener(new TableKeyListener(tokenizerParamsViewer2));
+		 * GridData gd2 = new GridData(GridData.FILL, GridData.FILL, false, false,2,1);
+		 * gd.heightHint = 150;
+		 * tokenizerParamsViewer2.getTable().setLayoutData(gd2);
+		 * tokenizerParamsViewer2.setContentProvider(new NodeListContentProvider());
+		 * tokenizerParamsViewer2.getTable().setHeaderVisible(true);
+		 * tokenizerParamsViewer2.getTable().setLinesVisible(true);
+		 * String[] cols2 = {"value", "type", "before", "hit", "after"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		 * for (String col : cols2) {
+		 * TableViewerColumn columnViewer = new TableViewerColumn(tokenizerParamsViewer2, SWT.NONE);
+		 * TableColumn column = columnViewer.getColumn();
+		 * column.setText(col);
+		 * column.setWidth(100);
+		 * columnViewer.setLabelProvider(new ElementColumnLabelProvider(col));
+		 * }
+		 */
+		
+	}
+	
+	protected void updateFieldsEnableState() {
+		boolean enabled = doTokenizeStepButton.getSelection();
+		doRetokenizeStepButton.setEnabled(enabled);
+		doBuildWordIDsButton.setEnabled(enabled);
+		if (!enabled) {
+			doRetokenizeStepButton.setSelection(false);
+			doBuildWordIDsButton.setSelection(false);
+		}
+		textWhiteSpaces.setEnabled(enabled);
+		textPuncts.setEnabled(enabled);
+		textElisions.setEnabled(enabled);
+		textPunctsStrong.setEnabled(enabled);
+	}
+	
+	@Override
+	public void updateFields(Project project) {
+		if (this.section.isDisposed()) return;
+		if (project == null) return;
+		
+		TokenizerClasses tc = new TokenizerClasses();
+		tc.loadFromProject(project.getPreferencesScope());
+		
+		textWhiteSpaces.setText(project.getTokenizerParameter("whitespaces", tc.whitespaces)); //$NON-NLS-1$
+		textPuncts.setText(project.getTokenizerParameter("regPunct", tc.regPunct)); //$NON-NLS-1$
+		textPunctsStrong.setText(project.getTokenizerParameter("punct_strong", tc.punct_strong)); //$NON-NLS-1$
+		textElisions.setText(project.getTokenizerParameter("regElision", tc.regElision)); //$NON-NLS-1$
+		
+		String wtagElement = project.getTokenizerWordElement();
+		wordElementText.setText(wtagElement);
+		
+		boolean doTokenizeStep = project.getDoTokenizerStep();
+		doTokenizeStepButton.setSelection(doTokenizeStep);
+		boolean doRetokenizeStep = "true".equals(project.getTokenizerParameter("doRetokenizeStep", "false")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		doRetokenizeStepButton.setSelection(doRetokenizeStep);
+		boolean doBuildWordIds = "true".equals(project.getTokenizerParameter("doBuildWordIds", "true")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		doBuildWordIDsButton.setSelection(doBuildWordIds);
+		updateFieldsEnableState();
+		
+		// HashMap<String, TTest> additionalTests = project.getTokenizerAdditionalTests();
+		// try {
+		// setAddSetTestsButton.setSelection(Boolean.parseBoolean(value.toString()));
+		// } catch (Exception e) { };
+	}
+	
+	@Override
+	public boolean saveFields(Project project) {
+		
+		if (textWhiteSpaces.getText().length() == 0 && textPuncts.getText().length() == 0) {
+			System.out.println(TXMUIMessages.errorWhileSavingTokenizerParameters);
+			return false;
+		}
+		project.addTokenizerParameter("whitespaces", textWhiteSpaces.getText()); //$NON-NLS-1$
+		project.addTokenizerParameter("regPunct", textPuncts.getText()); //$NON-NLS-1$
+		project.addTokenizerParameter("punct_strong", textPunctsStrong.getText()); //$NON-NLS-1$
+		project.addTokenizerParameter("regElision", textElisions.getText()); //$NON-NLS-1$
+		project.addTokenizerParameter("word_tags", wordElementText.getText()); //$NON-NLS-1$
+		project.addTokenizerParameter("doTokenizeStep", "" + doTokenizeStepButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
+		project.addTokenizerParameter("doRetokenizeStep", "" + doRetokenizeStepButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
+		project.addTokenizerParameter("doBuildWordIds", "" + doBuildWordIDsButton.getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
+		project.addTokenizerParameter("onlyThoseTests", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+		// project.setTokenizerAdditionalTests(additionalTokenizerTests); //$NON-NLS-1$
+		
+		return true;
+	}
+	
+	@Override
+	public boolean checkFields() {
+		return true;
+	}
+	
+	@Override
+	public int getSectionSize() {
+		return SECTION_SIZE;
+	}
+}

Property changes on: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/WordsSection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/StructuresSection.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/StructuresSection.java	(revision 0)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/StructuresSection.java	(revision 3422)
@@ -0,0 +1,101 @@
+package org.txm.rcp.editors.imports.sections;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.txm.objects.Project;
+import org.txm.rcp.editors.imports.ImportFormEditor;
+import org.txm.rcp.messages.TXMUIMessages;
+
+public class StructuresSection extends ImportEditorSection {
+	
+	private static final int SECTION_SIZE = 1;
+	
+	private Text milestoneElementsText;
+
+	private Text projectionsText;
+	
+	public StructuresSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style) {
+		super(editor, toolkit2, form2, parent, style, "structures");
+		
+		this.section.setText("Structures");
+		TableWrapLayout layout = new TableWrapLayout();
+		layout.makeColumnsEqualWidth = true;
+		this.section.setLayout(layout);
+		this.section.setLayoutData(getSectionGridData(SECTION_SIZE));
+		this.section.setEnabled(false);
+		this.section.addExpansionListener(new ExpansionAdapter() {
+			
+			@Override
+			public void expansionStateChanged(ExpansionEvent e) {
+				form.layout(true);
+			}
+		});
+		
+		Composite sectionClient = toolkit.createComposite(this.section);
+		TableWrapLayout slayout = new TableWrapLayout();
+		slayout.makeColumnsEqualWidth = false;
+		slayout.numColumns = 2;
+		sectionClient.setLayout(slayout);
+		this.section.setClient(sectionClient);
+		
+		Label tmpLabel4 = toolkit.createLabel(sectionClient, TXMUIMessages.milestoneElements);
+		tmpLabel4.setToolTipText(TXMUIMessages.listOfMilestoneElementsSeparatedByComma);
+		tmpLabel4.setLayoutData(getLabelGridData());
+		
+		milestoneElementsText = toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
+		TableWrapData gdata = getTextGridData();
+		milestoneElementsText.setLayoutData(gdata);
+		
+		Label label = toolkit.createLabel(sectionClient, "CQP Structure properties projections", SWT.WRAP);
+		gdata = getLabelGridData();
+		gdata.colspan = 2;
+		label.setLayoutData(gdata);
+		
+		projectionsText = toolkit.createText(sectionClient, "", SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); //$NON-NLS-1$
+		gdata = getTextGridData();
+		gdata.heightHint = 50;
+		gdata.colspan = 2;
+		
+		projectionsText.setLayoutData(gdata);
+	}
+	
+	@Override
+	public void updateFields(Project project) {
+		if (this.section != null && !section.isDisposed()) {
+			milestoneElementsText.setText(project.getTextualPlan("MileStones"));
+			projectionsText.setText(project.getTextualPlan("Projections"));
+		}
+	}
+	
+	@Override
+	public boolean saveFields(Project project) {
+		if (this.section != null && !section.isDisposed()) {
+			
+			project.setTextualPlan("MileStones", milestoneElementsText.getText().trim());
+			
+			project.setTextualPlan("Projections", projectionsText.getText().trim());
+			
+			return true;
+		}
+		
+		return true;
+	}
+	
+	@Override
+	public boolean checkFields() {
+		return true;
+	}
+	
+	@Override
+	public int getSectionSize() {
+		return SECTION_SIZE;
+	}
+}

Property changes on: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/StructuresSection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 3422)
@@ -70,8 +70,9 @@
 import org.txm.rcp.editors.imports.sections.InfosSection;
 import org.txm.rcp.editors.imports.sections.LangSection;
 import org.txm.rcp.editors.imports.sections.OptionsSection;
+import org.txm.rcp.editors.imports.sections.StructuresSection;
 import org.txm.rcp.editors.imports.sections.TextualPlansSection;
-import org.txm.rcp.editors.imports.sections.TokenizerSection;
+import org.txm.rcp.editors.imports.sections.WordsSection;
 import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.utils.SWTEditorsUtils;
@@ -121,6 +122,8 @@
 	
 	ImportEditorSection textualPlansSection;
 	
+	ImportEditorSection structuresSection;
+	
 	ImportEditorSection optionsSection;
 	
 	/**
@@ -211,7 +214,7 @@
 			N_SECTIONS += createLangSection();
 		}
 		
-		if (moduleParams.get(ImportModuleCustomization.TOKENIZER)) {
+		if (moduleParams.get(ImportModuleCustomization.WORDS)) {
 			N_SECTIONS += createTokenizerSection();
 		}
 		
@@ -235,6 +238,9 @@
 		if (moduleParams.get(ImportModuleCustomization.TEXTUALPLANS)) {
 			N_SECTIONS += createTextualPlansSection();
 		}
+		if (moduleParams.get(ImportModuleCustomization.STRUCTURES)) {
+			N_SECTIONS += createStructuresSection();
+		}
 		if (moduleParams.get(ImportModuleCustomization.OPTIONS)) {
 			N_SECTIONS += createOptionsSection();
 		}
@@ -264,6 +270,11 @@
 		return textualPlansSection.getSectionSize();
 	}
 	
+	private int createStructuresSection() {
+		structuresSection = new StructuresSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
+		return structuresSection.getSectionSize();
+	}
+	
 	private int createOptionsSection() {
 		optionsSection = new OptionsSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
 		return optionsSection.getSectionSize();
@@ -705,7 +716,7 @@
 	 * Creates the tokenizer section.
 	 */
 	private int createTokenizerSection() {
-		tokenizerSection = new TokenizerSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams);
+		tokenizerSection = new WordsSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams);
 		return tokenizerSection.getSectionSize();
 	}
 	
@@ -879,6 +890,11 @@
 			textualPlansSection.update(project);
 		}
 		
+		if (structuresSection != null && !structuresSection.isDisposed()) {
+			structuresSection.setEnabled(true);
+			structuresSection.update(project);
+		}
+		
 		if (optionsSection != null && !optionsSection.isDisposed()) {
 			optionsSection.setEnabled(true);
 			optionsSection.update(project);
@@ -958,6 +974,9 @@
 		if (textualPlansSection != null && !textualPlansSection.isDisposed()) {
 			doSave = doSave & textualPlansSection.check();
 		}
+		if (structuresSection != null && !structuresSection.isDisposed()) {
+			doSave = doSave & structuresSection.check();
+		}
 		if (optionsSection != null && !optionsSection.isDisposed()) {
 			doSave = doSave & optionsSection.check();
 		}
@@ -998,6 +1017,9 @@
 		if (textualPlansSection != null && !textualPlansSection.isDisposed()) {
 			successfulSave = successfulSave & textualPlansSection.save(project);
 		}
+		if (structuresSection != null && !structuresSection.isDisposed()) {
+			successfulSave = successfulSave & structuresSection.save(project);
+		}
 		if (optionsSection != null && !optionsSection.isDisposed()) {
 			successfulSave = successfulSave & optionsSection.save(project);
 		}
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportModuleCustomization.java	(revision 3422)
@@ -27,7 +27,7 @@
 	
 	public static final String XSLT = "xslt"; //$NON-NLS-1$
 	
-	public static final String TOKENIZER = "tokenizer"; //$NON-NLS-1$
+	public static final String WORDS = "words"; //$NON-NLS-1$
 	
 	public static final String ADVANCEDTOKENIZER = "tokenizer-advanced"; //$NON-NLS-1$
 	
@@ -49,6 +49,8 @@
 	
 	public static final String TEXTUALPLANS = "textualplans";
 	
+	public static final String STRUCTURES = "structures";
+	
 	public static final String IMPORT_NAME = "import_name";
 	
 	public static HashMap<String, HashMap<String, Boolean>> sectionsPerImportModule = new HashMap<>();
@@ -63,7 +65,7 @@
 		params.put(ENCODING, true);
 		params.put(LANG, false);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, false);
+		params.put(WORDS, false);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -73,6 +75,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("discoursLoader.groovy", params); //$NON-NLS-1$
 		names.put("discoursLoader.groovy", "CNR + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -83,7 +86,7 @@
 		params.put(ENCODING, true);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -93,6 +96,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("cqpLoader.groovy", params); //$NON-NLS-1$
 		names.put("cqpLoader.groovy", "CQP"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -102,7 +106,7 @@
 		params.put(ENCODING, true);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, false);
+		params.put(WORDS, false);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -112,6 +116,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("hyperbaseLoader.groovy", params); //$NON-NLS-1$
 		names.put("hyperbaseLoader.groovy", "Hyperbase"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -121,7 +126,7 @@
 		params.put(ENCODING, true);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -131,6 +136,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("alcesteLoader.groovy", params); //$NON-NLS-1$
 		names.put("alcesteLoader.groovy", "Alceste"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -140,7 +146,7 @@
 		params.put(ENCODING, true);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -150,6 +156,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("txtLoader.groovy", params); //$NON-NLS-1$
 		names.put("txtLoader.groovy", "TXT + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -159,7 +166,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, true);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -169,6 +176,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, true);
+		params.put(STRUCTURES, true);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("transcriberLoader.groovy", params); //$NON-NLS-1$
 		names.put("transcriberLoader.groovy", "XML-TRS + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -178,7 +186,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -188,6 +196,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("tmxLoader.groovy", params); //$NON-NLS-1$
 		names.put("tmxLoader.groovy", "XML-TMX"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -197,7 +206,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, true);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -207,6 +216,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("xmlLoader.groovy", params); //$NON-NLS-1$
 		names.put("xmlLoader.groovy", "XML/w + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -216,7 +226,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -226,6 +236,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("xmltxmLoader.groovy", params); //$NON-NLS-1$
 		names.put("xmltxmLoader.groovy", "XML-TEI TXM"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -235,7 +246,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -245,6 +256,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("factivaLoader.groovy", params); //$NON-NLS-1$
 		names.put("factivaLoader.groovy", "XML-PPS"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -254,7 +266,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -264,6 +276,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("factivamailLoader.groovy", params); //$NON-NLS-1$
 		names.put("factivamailLoader.groovy", "Factiva TXT"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -273,7 +286,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -283,6 +296,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("bfmLoader.groovy", params); //$NON-NLS-1$
 		names.put("bfmLoader.groovy", "XML-TEI BFM"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -292,7 +306,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, true);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, false);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, false);
@@ -302,6 +316,7 @@
 		params.put(QUERIES, true);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, false);
+		params.put(STRUCTURES, false);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("frantextLoader.groovy", params); //$NON-NLS-1$
 		names.put("frantextLoader.groovy", "XML-TEI Frantext"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -311,7 +326,7 @@
 		params.put(ENCODING, false);
 		params.put(LANG, true);
 		params.put(XSLT, false);
-		params.put(TOKENIZER, true);
+		params.put(WORDS, true);
 		params.put(ADVANCEDTOKENIZER, true);
 		params.put(EDITIONS_WORDSPERPAGE, true);
 		params.put(EDITIONS_PAGEELEMENT, true);
@@ -321,6 +336,7 @@
 		params.put(QUERIES, false);
 		params.put(UI, true);
 		params.put(TEXTUALPLANS, true);
+		params.put(STRUCTURES, true);
 		params.put(OPTIONS, true);
 		sectionsPerImportModule.put("xtzLoader.groovy", params); //$NON-NLS-1$
 		names.put("xtzLoader.groovy", "XML-TEI Zero + CSV"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -360,7 +376,7 @@
 			params.put(ENCODING, true);
 			params.put(LANG, true);
 			params.put(XSLT, true);
-			params.put(TOKENIZER, true);
+			params.put(WORDS, true);
 			params.put(ADVANCEDTOKENIZER, false);
 			params.put(EDITIONS_WORDSPERPAGE, true);
 			params.put(EDITIONS_PAGEELEMENT, true);
@@ -370,6 +386,7 @@
 			params.put(QUERIES, true);
 			params.put(UI, true);
 			params.put(TEXTUALPLANS, false);
+			params.put(STRUCTURES, false);
 			params.put(OPTIONS, true);
 			return params;
 		}
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java	(revision 3422)
@@ -33,6 +33,7 @@
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.preferences.IPreferencesService;
 import org.eclipse.jface.viewers.ISelection;
@@ -44,7 +45,6 @@
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.ide.FileStoreEditorInput;
 import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.editors.TxtEditor;
 import org.txm.rcp.swt.dialog.LastOpened;
 // TODO: Auto-generated Javadoc
@@ -112,19 +112,18 @@
 			LastOpened.set(ID, new File(result));
 		}
 
-		execute(result, page, selection, stringArgs);
-		return null;
+		return execute(result, page, selection, stringArgs);
 	}
 	
-	public static void execute(String scriptpath, IWorkbenchPart page, ISelection selection, String stringArgs) {
+	public static IStatus execute(String scriptpath, IWorkbenchPart page, ISelection selection, String stringArgs) {
 		//IPreferencesService service = Platform.getPreferencesService();
 		String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts"; //$NON-NLS-1$
 		File currentRootDir = new File(scriptRootDir, "groovy/user"); //$NON-NLS-1$
 		
 		if (scriptpath.endsWith(".groovy")) {
-			ExecuteGroovyScript.executeScript(currentRootDir, scriptpath, page, selection, false, stringArgs);
+			return ExecuteGroovyScript.executeScript(currentRootDir, scriptpath, page, selection, false, stringArgs);
 		} else {
-			ExecuteScript.executeScript(scriptpath, page, selection, stringArgs);
+			return ExecuteScript.executeScript(scriptpath, page, selection, stringArgs);
 		}
 	}
 }
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 3422)
@@ -2,6 +2,9 @@
 #TXM messages generated by the PluginMessagesManager class
 #Tue Dec 18 10:24:08 CET 2018
 
+nothing=<rien>
+tabulation=<tabulation>
+
 EMPTY = \	\n
 
 Explorer_4 = ⇧
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 3422)
@@ -1181,6 +1181,9 @@
 	public static String xmlTagNameThatEncodesWords;
 
 	public static String numberOfLines;
+
+	public static String tabulation;
+	public static String nothing;
 	
 	static {
 		// initialize resource bundle
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 3421)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 3422)
@@ -2,6 +2,9 @@
 #TXM messages generated by the PluginMessagesManager class
 #Tue Dec 18 10:24:08 CET 2018
 
+nothing=<nothing>
+tabulation=<tabulation>
+
 pattern=pattern
 sprintf_pattern_tooltip=sprintf pattern
 
Index: TXM/trunk/org.txm.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.rcp/plugin.xml	(revision 3422)
@@ -523,6 +523,21 @@
                      name="menu.file.import.separator.end"
                      visible="false">
                </separator>
+               <menu
+                     icon="icons/functions/pencil.png"
+                     id="menu.file.import.annotations"
+                     label="Annotations">
+                  <command
+                        commandId="org.txm.rcp.commands.function.WordPropertiesFromTable"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <reference
+                              definitionId="OneMainCorpusSelected">
+                        </reference>
+                     </visibleWhen>
+                  </command>
+               </menu>
             </menu>
             <menu
                   id="menu.file.load"
@@ -551,6 +566,39 @@
                      visible="false">
                </separator>
                <menu
+                     icon="icons/objects/corpus.png"
+                     id="menu.file.export.corpus"
+                     label="Corpus">
+                  <command
+                        commandId="org.txm.rcp.commands.ExportXMLTXMFiles"
+                        icon="icons/objects/script.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <and>
+                           <reference
+                                 definitionId="OneMainCorpusSelected">
+                           </reference>
+                        </and>
+                     </visibleWhen>
+                  </command>
+               </menu>
+               <menu
+                     id="menu.file.export.properties"
+                     label="Properties">
+                  <command
+                        commandId="org.txm.rcp.commands.function.WordPropertiesToTable"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <reference
+                              definitionId="OneMainCorpusSelected">
+                        </reference>
+                     </visibleWhen>
+                  </command>
+               </menu>
+               <menu
+                     icon="icons/functions/pencil.png"
                      id="menu.file.export.annotations"
                      label="Annotations">
                </menu>
@@ -578,19 +626,6 @@
                      </and>
                   </visibleWhen>
                </command>
-               <command
-                     commandId="org.txm.rcp.commands.ExportXMLTXMFiles"
-                     icon="icons/functions/export.png"
-                     style="push">
-                  <visibleWhen
-                        checkEnabled="false">
-                     <and>
-                        <reference
-                              definitionId="OneMainCorpusSelected">
-                        </reference>
-                     </and>
-                  </visibleWhen>
-               </command>
             </menu>
             <separator
                   name="menu.file.separator.file"
@@ -1119,10 +1154,6 @@
                   </or>
                </visibleWhen>
             </command>
-            <menu
-                  id="menu.corpus.import"
-                  label="Import">
-            </menu>
             
          </menu>
          <menu
@@ -2626,6 +2657,18 @@
             id="org.txm.rcp.commands.ExportXMLTXMFiles"
             name="Corpus au format XML-TXM (.xml)...">
       </command>
+      <command
+            categoryId="org.txm.rcp.category.txm"
+            defaultHandler="org.txm.rcp.commands.function.WordPropertiesFromTable"
+            id="org.txm.rcp.commands.function.WordPropertiesFromTable"
+            name="Word properties from table (.csv)">
+      </command>
+      <command
+            categoryId="org.txm.rcp.category.txm"
+            defaultHandler="org.txm.rcp.commands.function.WordPropertiestoTable"
+            id="org.txm.rcp.commands.function.WordPropertiesToTable"
+            name="Word properties to table (.csv)">
+      </command>
    </extension>
    <extension
          id="links"
Index: TXM/trunk/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/objects/Project.java	(revision 3421)
+++ TXM/trunk/org.txm.core/src/java/org/txm/objects/Project.java	(revision 3422)
@@ -1135,6 +1135,8 @@
 	@Override
 	public void clean() {
 		
+		Toolbox.notifyEngines(this, "before_clean"); // if an extension needs to free some files before
+		
 		if (rcpProject != null) {
 			try {
 				// Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP").stop(); //$NON-NLS-1$
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/URSCorpora.java
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/URSCorpora.java	(revision 3421)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/URSCorpora.java	(revision 3422)
@@ -106,7 +106,7 @@
 	/**
 	 * need the corpus to be loaded
 	 * 
-	 * @param name
+	 * @param mcorpus
 	 * @return the corpus Vue
 	 */
 	public static Vue getVue(CorpusBuild mcorpus) {
@@ -124,6 +124,18 @@
 	}
 	
 	/**
+	 * Has a Vue being loaded for a Corpusbuild
+	 * 
+	 * @param mcorpus
+	 * @return true if a Vue is loaded
+	 */
+	public static boolean hasVue(CorpusBuild mcorpus) {
+		mcorpus = mcorpus.getRootCorpusBuild(); // ensure this is the root CorpusBuild
+		
+		return vues.containsKey(mcorpus);
+	}
+	
+	/**
 	 * Save the associated AnalecCorpus
 	 * 
 	 * @param mcorpus
@@ -203,6 +215,11 @@
 			CorpusBuild mcorpus = (CorpusBuild) r;
 			mcorpus = mcorpus.getRootCorpusBuild(); // ensure this is the root CorpusBuild
 			
+			if (URSCorpora.hasCorpus(mcorpus)) {
+				Corpus analec_corpus = URSCorpora.getCorpus(mcorpus);
+				analec_corpus.fermer();
+			}
+
 			URSCorpora.removeCorpus(mcorpus);
 			
 			File fichierCorpus = new File(mcorpus.getProjectDirectory(), "analec/" + mcorpus.getID() + ".ec"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -248,7 +265,7 @@
 	
 	@Override
 	public boolean hasAnnotationsToSave(CorpusBuild mcorpus) {
-		if (URSCorpora.hasCorpus(mcorpus)) return false; // no corpus instanced -> no annotations to save
+		if (!URSCorpora.hasCorpus(mcorpus)) return false; // no corpus instanced -> no annotations to save
 		return URSCorpora.getCorpus(mcorpus).isModifie();
 	}
 	
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitConcordanceToolbar.java
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitConcordanceToolbar.java	(revision 3421)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitConcordanceToolbar.java	(revision 3422)
@@ -408,7 +408,7 @@
 		onAnnotationTypeSelected(null);
 		
 		editor.layout(true);
-		ext.getSaveButton().setEnabled(true);
+//		ext.getSaveButton().setEnabled(true);
 		return true;
 	}
 	
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java	(revision 3421)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java	(revision 3422)
@@ -135,7 +135,7 @@
 			// this.selected_unit_color = new RGBA(selected_unit_color_pref, 1f);
 		}
 		
-		this.button = extension.getSaveButton();
+		//		this.button = extension.getSaveButton();
 		this.maincorpus = this.editor.getCorpus().getMainCorpus();
 		try {
 			maxCorpusPosition = maincorpus.getSize();
@@ -649,6 +649,7 @@
 	}
 	
 	public String uniteToWords(Unite unit) {
+		
 		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		String[] firstWords = null;
 		try {
@@ -669,6 +670,7 @@
 	 * Highlight units of the current page
 	 */
 	protected synchronized void highlightType() {
+		
 		if (unites == null) return;
 		if (editor.getEditionPanels().size() == 0) return;
 		
@@ -690,13 +692,23 @@
 			int last_ids[] = null;
 			if (next != null && next != page) {
 				String nextPageWordID = next.getWordId();
-				last_ids = CQPSearchEngine.getCqiClient().str2Id(qid, new String[] { nextPageWordID });
+				if (!("w_0".equals(nextPageWordID))) {
+					last_ids = CQPSearchEngine.getCqiClient().str2Id(qid, new String[] { nextPageWordID });
+					if (last_ids.length == 0 || last_ids[0] == -1) {
+						Log.warning("No CQP id for word id="+nextPageWordID);
+					}
+				}
 			}
 			
 			int first_pos = CQPSearchEngine.getCqiClient().id2Cpos(qid, first_id)[0];
 			int last_pos = Integer.MAX_VALUE;
-			if (last_ids != null && last_ids.length > 0) {
-				last_pos = CQPSearchEngine.getCqiClient().id2Cpos(qid, last_ids[0])[0];
+			if (last_ids != null && last_ids.length > 0 && last_ids[0] != -1) {
+				int[] v = CQPSearchEngine.getCqiClient().id2Cpos(qid, last_ids[0]);
+				if (v.length == 0) {
+					Log.warning("No position found for CQP id="+last_ids[0]);
+				} else {
+					last_pos = v[0];
+				}
 			}
 			
 			int n2 = 0; // first loop to determine the allpositions array length
@@ -1258,7 +1270,7 @@
 	public boolean hasChanges() {
 		return analecCorpus.isModifie();
 	}
-
+	
 	@Override
 	public boolean needToUpdateEditions() {
 		
Index: TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java
===================================================================
--- TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java	(revision 3421)
+++ TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/URSAnnotationToolbar.java	(revision 3422)
@@ -71,7 +71,7 @@
 	
 	protected SynopticEditionEditor editor;
 	
-	protected ToolItem button;
+//	protected ToolItem button;
 	
 	private Button closeButton;
 
@@ -165,8 +165,8 @@
 			analecCorpus.ajouterProp(Unite.class, "Entity", "Property");
 		}
 		
-		button = extension.getSaveButton();
-		button.setEnabled(analecCorpus.isModifie());
+//		button = extension.getSaveButton();
+//		button.setEnabled(analecCorpus.isModifie());
 		
 		_install(txmeditor, extension, parent, position);
 		
@@ -278,33 +278,33 @@
 			
 			// System.out.println("StartButton.corpusListener.traiterEvent: "+e);
 			
-			button.getDisplay().syncExec(new Runnable() {
-				
-				@Override
-				public void run() {
-					if (e.getType() == TypeMessage.MODIF_STRUCTURE) {
-						boolean ready = URSCorpora.isAnnotationStructureReady(maincorpus);
-						button.setEnabled(ready);
-						// if (!ready && utoolbar != null && !utoolbar.isDisposed()) utoolbar.clearHighlight();
-					}
-					
-					if (e.getType() == TypeMessage.MODIF_ELEMENT) {
-						button.setEnabled(URSCorpora.isAnnotationStructureReady(maincorpus));
-						if (!maincorpus.isModified()) {
-							maincorpus.setIsModified(true); // to show the * in corpora view
-							updateCorporaView(maincorpus);
-						}
-						
-					}
-					else if (e.getType() == TypeMessage.CORPUS_SAVED) {
-						button.setEnabled(false);
-						if (maincorpus.isModified()) {
-							maincorpus.setIsModified(false); // to remove the * in corpora view
-							updateCorporaView(maincorpus);
-						}
-					}
-				}
-			});
+//			button.getDisplay().syncExec(new Runnable() {
+//				
+//				@Override
+//				public void run() {
+//					if (e.getType() == TypeMessage.MODIF_STRUCTURE) {
+//						boolean ready = URSCorpora.isAnnotationStructureReady(maincorpus);
+//						button.setEnabled(ready);
+//						// if (!ready && utoolbar != null && !utoolbar.isDisposed()) utoolbar.clearHighlight();
+//					}
+//					
+//					if (e.getType() == TypeMessage.MODIF_ELEMENT) {
+//						button.setEnabled(URSCorpora.isAnnotationStructureReady(maincorpus));
+//						if (!maincorpus.isModified()) {
+//							maincorpus.setIsModified(true); // to show the * in corpora view
+//							updateCorporaView(maincorpus);
+//						}
+//						
+//					}
+//					else if (e.getType() == TypeMessage.CORPUS_SAVED) {
+//						button.setEnabled(false);
+//						if (maincorpus.isModified()) {
+//							maincorpus.setIsModified(false); // to remove the * in corpora view
+//							updateCorporaView(maincorpus);
+//						}
+//					}
+//				}
+//			});
 			
 		}
 	};
@@ -380,6 +380,6 @@
 	
 	public void fireIsDirty() {
 		editor.fireIsDirty();
-		this.extension.getSaveButton().setEnabled(true);
+//		this.extension.getSaveButton().setEnabled(true);
 	}
 }
Index: TXM/trunk/org.txm.searchengine.cqp.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 3422)
@@ -222,7 +222,7 @@
          </command>
       </menuContribution>
       <menuContribution
-            locationURI="menu:menu.file.export?after=menu.file.export.begin">
+            locationURI="menu:menu.file.export.corpus">
          <command
                commandId="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
                icon="icons/functions/compress.png"
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 3422)
@@ -194,7 +194,7 @@
 			}
 		});
 		
-		ext.getSaveButton().setEnabled(true);
+//		ext.getSaveButton().setEnabled(true);
 		return composeAnnotationArea(parent);
 	}
 	
@@ -1050,7 +1050,7 @@
 	
 	@Override
 	public boolean isDirty() {
-		return annotManager != null;
+		return annotManager != null && annotManager.isDirty();
 	}
 	
 	@Override
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 3422)
@@ -831,7 +831,7 @@
 		
 		updateAnnotationWidgetStates();
 		editor.layout(true);
-		ext.getSaveButton().setEnabled(true);
+//		ext.getSaveButton().setEnabled(true);
 		return true;
 	}
 	
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 3422)
@@ -388,7 +388,7 @@
 		updateAnnotationWidgetStates();
 		editor.layout(true);
 		
-		ext.getSaveButton().setEnabled(true);
+//		ext.getSaveButton().setEnabled(true);
 		return true;
 	}
 	
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ImportTable.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ImportTable.java	(revision 0)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ImportTable.java	(revision 3422)
@@ -0,0 +1,147 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.annotation.kr.rcp.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.annotation.kr.core.AnnotationManager;
+import org.txm.annotation.kr.core.KRAnnotationEngine;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.logger.Log;
+
+/**
+ * Open a file in the TxtEditor 
+ * 
+ * @author mdecorde.
+ */
+public class ImportTable extends AbstractHandler {
+	
+	public static final String ID = ImportTable.class.getCanonicalName();
+	
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		ISelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (!(sel instanceof IStructuredSelection)) return null;
+		IStructuredSelection selection = (IStructuredSelection) sel;
+		
+		Object s = selection.getFirstElement();
+		if (!(s instanceof MainCorpus)) {
+			Log.warning(NLS.bind("Selection is not a Corpus: {0}. Aborting.", s));
+			return null;
+		}
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		//FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+		MainCorpus corpus = (MainCorpus) s;
+		String path = Toolbox.getTxmHomePath();
+		dialog.setFilterPath(path); //To set a specific path
+		dialog.setFileName(corpus.getID()+"_annotations.csv");
+		dialog.setFilterExtensions(new String[]{"*.csv", "*.tsv"});
+		if (dialog.open() != null) {
+			StatusLine.setMessage(TXMUIMessages.exportingAnnotations);
+			String filepath = dialog.getFilterPath();
+			String filename = dialog.getFileName();
+			
+			final File resultFile = new File(filepath, filename);
+			LastOpened.set(ID, resultFile.getParent(), resultFile.getName());
+			
+			try {
+				importAnnotations(corpus, resultFile);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				return null;
+			}
+		}
+		return corpus;
+	}
+	
+	public static boolean importAnnotations(final MainCorpus corpus, final File annotationsFile) throws Exception {
+		final AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
+		if (am == null) return true; // nothing to do
+				
+		JobHandler jobhandler = new JobHandler("Importing annotations in table for "+corpus) { //$NON-NLS-1$
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				try {
+					monitor.beginTask("Importing annotations as standoff", 100);
+					
+					monitor.setTaskName("Reading annotations in the table file: "+annotationsFile);
+					/*if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Before saving annotations...", "All editors using this corpus are going to be closed. Continue ?")) {
+						return false;
+					}*/
+					
+					///lecture de tous les fichiers un par un
+					///chaque annotation est récupérée et selon l'annotateur, écrite dans un fichier spécifique à celui-ci
+					
+					if (!am.importAnnotationsFromTable(annotationsFile)) {
+						Log.warning("Error while importing annotations (see logs above).");
+						return Status.CANCEL_STATUS;
+					}
+					monitor.worked(30);
+					
+					Log.info("Done.");
+					
+				} catch(Exception e) {
+					Log.warning(NLS.bind("Error while importing annotations: {0}.", e));
+					Log.printStackTrace(e);
+					return Status.CANCEL_STATUS;
+				}
+				return Status.OK_STATUS;
+			}
+		};
+		
+		jobhandler.startJob(true);
+		return true;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ImportTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/krview/Add.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/krview/Add.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/krview/Add.java	(revision 3422)
@@ -66,7 +66,7 @@
 	}
 
 	/**
-	 * Copy.
+	 * Add a new annotation type or value.
 	 *
 	 * @param selection the selection
 	 */
Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ExportTable.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ExportTable.java	(revision 0)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ExportTable.java	(revision 3422)
@@ -0,0 +1,147 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.annotation.kr.rcp.commands;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.annotation.kr.core.AnnotationManager;
+import org.txm.annotation.kr.core.KRAnnotationEngine;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.logger.Log;
+
+/**
+ * Open a file in the TxtEditor 
+ * 
+ * @author mdecorde.
+ */
+public class ExportTable extends AbstractHandler {
+	
+	public static final String ID = ExportTable.class.getCanonicalName();
+	
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		ISelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (!(sel instanceof IStructuredSelection)) return null;
+		IStructuredSelection selection = (IStructuredSelection) sel;
+		
+		Object s = selection.getFirstElement();
+		if (!(s instanceof MainCorpus)) {
+			Log.warning(NLS.bind("Selection is not a Corpus: {0}. Aborting.", s));
+			return null;
+		}
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		//FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+		MainCorpus corpus = (MainCorpus) s;
+		String path = Toolbox.getTxmHomePath();
+		dialog.setFilterPath(path); //To set a specific path
+		dialog.setFileName(corpus.getID()+"_annotations.csv");
+		dialog.setFilterExtensions(new String[]{"*.csv", "*.tsv"});
+		if (dialog.open() != null) {
+			StatusLine.setMessage(TXMUIMessages.exportingAnnotations);
+			String filepath = dialog.getFilterPath();
+			String filename = dialog.getFileName();
+			
+			final File resultFile = new File(filepath, filename);
+			LastOpened.set(ID, resultFile.getParent(), resultFile.getName());
+			
+			try {
+				exportAnnotations(corpus, resultFile);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				return null;
+			}
+		}
+		return corpus;
+	}
+	
+	public static boolean exportAnnotations(final MainCorpus corpus, final File resultFile) throws Exception {
+		final AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
+		if (am == null) return true; // nothing to do
+				
+		JobHandler jobhandler = new JobHandler("Exporting annotations in table for "+corpus) { //$NON-NLS-1$
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				try {
+					monitor.beginTask("Exporting annotations as standoff", 100);
+					
+					monitor.setTaskName("Writing annotations in the table file: "+resultFile);
+					/*if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Before saving annotations...", "All editors using this corpus are going to be closed. Continue ?")) {
+						return false;
+					}*/
+					
+					///lecture de tous les fichiers un par un
+					///chaque annotation est récupérée et selon l'annotateur, écrite dans un fichier spécifique à celui-ci
+					
+					if (!am.exportAnnotationsToTable(resultFile)) {
+						Log.warning("Error while exporting annotations (see logs above).");
+						return Status.CANCEL_STATUS;
+					}
+					monitor.worked(30);
+					
+					Log.info("Done.");
+					
+				} catch(Exception e) {
+					Log.warning(NLS.bind("Error while saving annotations: {0}.", e));
+					Log.printStackTrace(e);
+					return Status.CANCEL_STATUS;
+				}
+				return Status.OK_STATUS;
+			}
+		};
+		
+		jobhandler.startJob(true);
+		return true;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/ExportTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/edition/WordAnnotationToolbar.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/edition/WordAnnotationToolbar.java	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/edition/WordAnnotationToolbar.java	(revision 3422)
@@ -715,7 +715,7 @@
 		
 		updateAnnotationWidgetStates();
 		editor.layout(true);
-		ext.getSaveButton().setEnabled(true);
+//		ext.getSaveButton().setEnabled(true);
 		return true;
 	}
 	
Index: TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3422)
@@ -2,6 +2,7 @@
 #Mon Jun 08 11:30:22 CEST 2020
 command.label=Entrep�t de connaissances
 command.label.0=Textes et Annotations CQP de s�quences de mots au format XML-TEI SyMoGIH (.xml)...
+command.label.1=Annotations CQP au format Table (.csv)...
 command.name=Recoder
 command.name.0=Enregistrer les annotations
 command.name.1=Ouvrir la vue d'entrep�ts de connaissance
Index: TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle.properties	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/OSGI-INF/l10n/bundle.properties	(revision 3422)
@@ -3,6 +3,7 @@
 Bundle-Name=KR Annotation RCP
 command.label=Knowledge Respository
 command.label.0=Texts and CQP Annotations of word sequences in XML-TEI SyMoGIH format (.xml)
+command.label.1=CQP Annotations in Table format (.csv)
 command.name=Recode
 command.name.0=Save annotations
 command.name.1=Open Knowledge Repository View
Index: TXM/trunk/org.txm.annotation.kr.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.annotation.kr.rcp/plugin.xml	(revision 3422)
@@ -56,6 +56,16 @@
             id="org.txm.annotation.kr.rcp.commands.SaveAnnotationsAndUpdateCorpus"
             name="%command.label.111">
       </command>
+      <command
+            defaultHandler="org.txm.annotation.kr.rcp.commands.ExportTable"
+            id="org.txm.annotation.kr.rcp.commands.ExportTable"
+            name="Export in table">
+      </command>
+      <command
+            defaultHandler="org.txm.annotation.kr.rcp.commands.ImportTable"
+            id="org.txm.annotation.kr.rcp.commands.ImportTable"
+            name="Import from table">
+      </command>
    </extension>
   <extension
         point="org.eclipse.ui.preferencePages">
@@ -178,26 +188,42 @@
       </menuContribution>
      <menuContribution
            allPopups="false"
+           locationURI="menu:menu.file.export.properties">
+        <command
+              commandId="org.txm.rcp.commands.annotation.ExportStandoff"
+              id="menu.file.export.exporttei"
+              label="%command.label.0"
+              style="push">
+           <visibleWhen
+                 checkEnabled="false">
+              <reference
+                    definitionId="OneMainCorpusSelected">
+              </reference>
+           </visibleWhen>
+        </command>
+     </menuContribution>
+     <menuContribution
+           allPopups="false"
            locationURI="menu:menu.file.export.annotations">
            <command
-                     commandId="org.txm.rcp.commands.annotation.ExportStandoff"
-                     id="menu.file.export.exporttei"
-                     label="%command.label.0"
-                     style="push">
-                  <visibleWhen
-                        checkEnabled="false">
-                     <reference
-                           definitionId="OneMainCorpusSelected">
-                     </reference>
-                  </visibleWhen>
-               </command>
+                 commandId="org.txm.annotation.kr.rcp.commands.ExportTable"
+                 id="menu.file.export.exporttable"
+                 label="%command.label.1"
+                 style="push">
+              <visibleWhen
+                    checkEnabled="false">
+                 <reference
+                       definitionId="OneMainCorpusSelected">
+                 </reference>
+              </visibleWhen>
+           </command>
      </menuContribution>
      <menuContribution
            allPopups="false"
            locationURI="menu:corporaview.menu.file.export?after=org.txm.rcp.views.corpora.CorporaView.annotation">
             <command
                   commandId="org.txm.rcp.commands.annotation.ExportStandoff"
-                  label="%command.label.193"
+                  label="%command.label.0"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
@@ -206,6 +232,17 @@
                   </reference>
                </visibleWhen>
             </command>
+            <command
+                  commandId="org.txm.annotation.kr.rcp.commands.ExportTable"
+                  label="%command.label.1"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="OneMainCorpusSelected">
+                  </reference>
+               </visibleWhen>
+            </command>
      </menuContribution>
      <menuContribution
            allPopups="false"
@@ -255,6 +292,20 @@
            </visibleWhen>
         </command>
      </menuContribution>
+     <menuContribution
+           locationURI="menu:menu.file.import.annotations">
+        <command
+              commandId="org.txm.annotation.kr.rcp.commands.ImportTable"
+              label="CQP Annotation from Table (.csv)"
+              style="push">
+           <visibleWhen
+                 checkEnabled="false">
+              <reference
+                    definitionId="OneMainCorpusSelected">
+              </reference>
+           </visibleWhen>
+        </command>
+     </menuContribution>
   </extension>
   <extension
          point="org.eclipse.ui.contexts">
Index: TXM/trunk/org.txm.conllu.rcp/plugin.xml
===================================================================
--- TXM/trunk/org.txm.conllu.rcp/plugin.xml	(revision 3421)
+++ TXM/trunk/org.txm.conllu.rcp/plugin.xml	(revision 3422)
@@ -38,7 +38,7 @@
          </command>
       </menuContribution>
       <menuContribution
-            locationURI="menu:menu.file.export">
+            locationURI="menu:menu.file.export.corpus">
          <command
                commandId="org.txm.conllu.rcp.commands.ExportCorpusAsCoNLLU"
                icon="icons/functions/UD.png"
@@ -53,7 +53,7 @@
          </command>
       </menuContribution>
       <menuContribution
-            locationURI="menu:menu.corpus.import">
+            locationURI="menu:menu.file.import.annotations">
          <command
                commandId="org.txm.conllu.rcp.commands.ImportCoNLLUAnnotationsFromDirectory"
                icon="icons/functions/UDplus.png"
