Index: tmp/org.txm.rcp/icons/remove.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.rcp/icons/remove.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java	(revision 859)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java	(revision 860)
@@ -229,6 +229,7 @@
 	public static final String PENCIL_CLOSE = "icons/functions/pencil_close.png"; //$NON-NLS-1$
 	
 	public static final String ACTION_ADD = "icons/add.png";//$NON-NLS-1$
+	public static final String ACTION_REMOVE = "icons/remove.png";//$NON-NLS-1$
 	public static final String WORLD = "icons/world.png";
 
 	public static final String TXM_ICON = "icons/logo/TXM logo.png";
@@ -237,6 +238,8 @@
 	public static final String OPEN_DECORATOR = "icons/decorators/bullet_arrow_down.png";
 	public static final String CLOSE_DECORATOR = "icons/decorators/bullet_arrow_up.png";
 
+
+
 	/**
 	 * Gets the image.
 	 *
Index: tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationArea.java
===================================================================
--- tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationArea.java	(revision 859)
+++ tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationArea.java	(revision 860)
@@ -40,7 +40,7 @@
 	 * @return
 	 * @throws Exception 
 	 */
-	public abstract boolean install(TXMEditor<? extends TXMResult> editor, AnnotationExtension extension, Composite parent) throws Exception;
+	public abstract boolean install(TXMEditor<? extends TXMResult> editor, AnnotationExtension extension, Composite parent, int position) throws Exception;
 	
 	/**
 	 * use this to dispose your extension widgets (and save eventually)
Index: tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java
===================================================================
--- tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 859)
+++ tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 860)
@@ -26,10 +26,12 @@
 	private SelectionListener defaultListener;
 
 	private ToolItem saveButton;
+	
+	public static final String GROUP_NAME = "Annotation";
 
 	@Override
 	public String getName() {
-		return "Annotation";
+		return GROUP_NAME;
 	}
 
 	/**
@@ -76,7 +78,7 @@
 					public void widgetSelected(SelectionEvent e) {
 						try {
 							Object o = celement.createExecutableExtension("class"); //$NON-NLS-1$
-							openAnnotationMode(o);
+							openAnnotationMode((AnnotationArea)o, -1);
 						} catch (Exception e1) {
 							// TODO Auto-generated catch block
 							e1.printStackTrace();
@@ -111,7 +113,7 @@
 
 		defaultListener = listeners.get(0);
 		String defaultMode = modes.get(0);
-		controlArea = editor.getTopToolbar().installAlternativesGroup("Annotation", "annotation tools: "+defaultMode,
+		controlArea = editor.getTopToolbar().installAlternativesGroup(GROUP_NAME, "annotation tools: "+defaultMode,
 				"platform:/plugin/org.txm.rcp/icons/functions/pencil_open.png", 
 				"platform:/plugin/org.txm.rcp/icons/functions/pencil_close.png", false, 
 				openCloseSelectionListener, modes, listeners);
@@ -136,26 +138,26 @@
 		saveButton.setEnabled(false);
 	}
 
-	protected void openAnnotationMode(Object o) throws Exception {
-		AnnotationArea aa = (AnnotationArea)o;
+	public void openAnnotationMode(AnnotationArea aa, int position) throws Exception {
+		//AnnotationArea aa = (AnnotationArea)o;
 		if (!aa.allowMultipleAnnotations()) {
 			for (AnnotationArea a : annotationAreas) {
-				if (a.getClass().equals(aa.getClass())) {
-					return; // already opened
-				}
+				a.close();
 			}
-
+			annotationAreas.clear();
+		} else { // close the other annotation modes
 			for (AnnotationArea a : annotationAreas) {
-				a.close();
+				if (!a.getClass().equals(aa.getClass())) {
+					a._close();
+				}
 			}
-			annotationAreas.clear();
 		}
 
-		System.out.println("Starting "+aa.getName());
+		//System.out.println("Starting "+aa.getName());
 
-		aa.install(editor, AnnotationExtension.this, controlArea);
+		aa.install(editor, AnnotationExtension.this, controlArea, position);
 
-		editor.getTopToolbar().setVisible("annotation", true);
+		editor.getTopToolbar().setVisible(GROUP_NAME, true);
 		annotationAreas.add(aa);
 		editor.refresh(false); // refresh the concordance display
 	}
@@ -164,7 +166,7 @@
 		annotationAreas.remove(aa);
 		aa._close();
 		if (annotationAreas.size() == 0) {
-			editor.getTopToolbar().setVisible("Annotation", false);
+			editor.getTopToolbar().setVisible(GROUP_NAME, false);
 		}
 	}
 	
Index: tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java
===================================================================
--- tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 859)
+++ tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 860)
@@ -130,14 +130,9 @@
 	public String getName() {
 		return "KR Annotation";
 	}
-
-	@Override
-	public boolean allowMultipleAnnotations() {
-		return true;
-	}
 	
 	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent) throws Exception {
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
 
 		this.extension = ext;
 		this.editor = (ConcordanceEditor)txmeditor;
@@ -150,7 +145,9 @@
 
 		// RESULT
 
-		int position = 3+extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
+		if (position < 0) {
+			position = 3+extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
+		}
 		TableViewerColumn annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
 		annotationColumn = annotationColumnViewer.getColumn();
 		annotationColumn.setText(ConcordanceUIMessages.ConcordancesEditor_15);
Index: tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java
===================================================================
--- tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 859)
+++ tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java	(revision 860)
@@ -25,6 +25,7 @@
 import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.TypedEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
@@ -111,6 +112,7 @@
 
 	protected Concordance concordance;
 	private Corpus corpus;
+	private TableViewerColumn annotationColumnViewer;
 
 	public String getName() {
 		return "Word properties";
@@ -318,7 +320,7 @@
 	}
 
 	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent) throws Exception {
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
 
 		this.extension = ext;
 		this.editor = (ConcordanceEditor)txmeditor;
@@ -331,8 +333,10 @@
 
 		// RESULT
 
-		int position = 3+extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
-		TableViewerColumn annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
+		if (position < 0) {
+			position = 3 + extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
+		}
+		annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
 		annotationColumn = annotationColumnViewer.getColumn();
 		annotationColumn.setText("Property");
 		annotationColumn.setToolTipText(ConcordanceUIMessages.ConcordancesEditor_17);
@@ -388,6 +392,7 @@
 
 		List<WordProperty> wordProperties = corpus.getProperties();
 		for (WordProperty p : wordProperties) {
+			if (p.getName().equals("id")) continue;
 			AnnotationType type = currentKnowledgeRepository.getType(p.getName());
 			if (type == null) {
 				AnnotationType t = currentKnowledgeRepository.addType(p.getName(), p.getName());
@@ -412,7 +417,7 @@
 		gdata.widthHint = 90;
 
 		//Display combo with list of Annotation Type 
-		annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
+		annotationTypesCombo = new ComboViewer(annotationArea, SWT.SINGLE);
 		annotationTypesCombo.setContentProvider(new ArrayContentProvider());
 		annotationTypesCombo.setLabelProvider(new SimpleLabelProvider() {
 			@Override
@@ -424,6 +429,21 @@
 				return ((AnnotationType)element).getName(); //$NON-NLS-1$
 			}
 		});
+		annotationTypesCombo.getCombo().addKeyListener(new KeyListener() {
+			
+			@Override
+			public void keyReleased(KeyEvent e) {
+				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+					String name = annotationTypesCombo.getCombo().getText();
+					if (currentKnowledgeRepository.getType(name) == null) {
+						createNewType(e, name);
+					}
+				}
+			}
+			
+			@Override
+			public void keyPressed(KeyEvent e) { }
+		});
 	
 		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
 		gdata.widthHint = 200;
@@ -464,62 +484,6 @@
 			}
 		});
 
-		addAnnotationTypeButton = new Button(annotationArea, SWT.PUSH);
-		addAnnotationTypeButton.setToolTipText(ConcordanceUIMessages.ConcordancesEditor_115);
-		addAnnotationTypeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
-		addAnnotationTypeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
-		addAnnotationTypeButton.addSelectionListener(new SelectionListener() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				if (currentKnowledgeRepository == null) return;
-				if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
-
-				LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
-
-				InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), "Nouvelle propriété", "Nom de la propriété pattern=[a-z][-a-z0-9]+", "", null); //$NON-NLS-3$
-				if (dialog.open() == InputDialog.OK) {
-					String name = dialog.getValue();
-					if (name.trim().length() == 0) return;
-					String baseid = AsciiUtils.buildId(name);
-					String id = AsciiUtils.buildId(name);
-					int c = 1;
-					while (kr.getType(id) != null) {
-						id = baseid+"_"+(c++); //$NON-NLS-1$
-					}
-					AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
-					type.setEffect(AnnotationEffect.TOKEN);
-					typesList.add(type);
-
-					if (annotationTypesCombo != null) annotationTypesCombo.refresh();
-					if (typesList.size() == 1) {
-						if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
-						annotations.setViewAnnotation(type);
-						annotations.setAnnotationOverlap(true);
-						try {
-							editor.refresh(false);
-						} catch (Exception e1) {
-							// TODO Auto-generated catch block
-							e1.printStackTrace();
-						}
-						annotationArea.layout(true);
-					} else {
-						if (typesList.size() > 1) {
-							if (annotationTypesCombo != null) {
-								annotationTypesCombo.getCombo().select(typesList.size()-1);
-							}
-						}
-					}
-					KRView.refresh();
-					updateAnnotationWidgetStates();
-				} else {
-					System.out.println("Creation aborted."); //$NON-NLS-1$
-				}
-			}
-
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) { }
-		});
-
 		equalLabel = new Label(annotationArea, SWT.NONE);
 		equalLabel.setText("="); //$NON-NLS-1$
 		equalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
@@ -577,10 +541,37 @@
 			public void widgetDefaultSelected(SelectionEvent e) { }
 		});
 		
+		addAnnotationTypeButton = new Button(annotationArea, SWT.PUSH);
+		addAnnotationTypeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
+		addAnnotationTypeButton.setToolTipText(ConcordanceUIMessages.ConcordancesEditor_115);
+		addAnnotationTypeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
+		addAnnotationTypeButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				try {
+					int position = -1;
+					TableColumn[] columns = editor.getLineTableViewer().getTable().getColumns();
+					TableColumn column = annotationColumnViewer.getColumn();
+					for (int i = 0 ; i < columns.length ; i++) {
+						if (columns[i] == column) {
+							position = i +1; // after the current column
+						}
+					}
+					extension.openAnnotationMode(new WordAnnotationToolbar(), position);
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
 		Button closeButton = new Button(annotationArea, SWT.PUSH);
 		closeButton.setToolTipText("Close the toolbar without saving");
-		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
-		closeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
+		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_REMOVE));
+		
 		closeButton.addSelectionListener(new SelectionListener() {
 			
 			@Override
@@ -591,6 +582,8 @@
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
+		
+		
 
 		updateAnnotationWidgetStates();
 		editor.layout(true);
@@ -598,6 +591,53 @@
 		return true;
 	}
 
+	protected void createNewType(TypedEvent e, String typeName) {
+		
+		if (currentKnowledgeRepository == null) return;
+		if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
+
+		LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
+		if (typeName == null) typeName = "";
+		InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), "Nouvelle propriété", "Nom de la propriété pattern=[a-z][-a-z0-9]+", typeName, null); //$NON-NLS-3$
+		if (dialog.open() == InputDialog.OK) {
+			String name = dialog.getValue();
+			if (name.trim().length() == 0) return;
+			String baseid = AsciiUtils.buildId(name);
+			String id = AsciiUtils.buildId(name);
+			int c = 1;
+			while (kr.getType(id) != null) {
+				id = baseid+"_"+(c++); //$NON-NLS-1$
+			}
+			AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
+			type.setEffect(AnnotationEffect.TOKEN);
+			typesList.add(type);
+
+			if (annotationTypesCombo != null) annotationTypesCombo.refresh();
+			if (typesList.size() == 1) {
+				if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
+				annotations.setViewAnnotation(type);
+				annotations.setAnnotationOverlap(true);
+				try {
+					editor.refresh(false);
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+				annotationArea.layout(true);
+			} else {
+				if (typesList.size() > 1) {
+					if (annotationTypesCombo != null) {
+						annotationTypesCombo.getCombo().select(typesList.size()-1);
+					}
+				}
+			}
+			KRView.refresh();
+			updateAnnotationWidgetStates();
+		} else {
+			System.out.println("Creation aborted."); //$NON-NLS-1$
+		}
+	}
+
 	@Override
 	public boolean save() {
 		try {
Index: tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java
===================================================================
--- tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 859)
+++ tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 860)
@@ -113,14 +113,9 @@
 	public String getName() {
 		return "Tag Annotation";
 	}
-	
+		
 	@Override
-	public boolean allowMultipleAnnotations() {
-		return true;
-	}
-	
-	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent) throws Exception {
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
 
 		this.extension = ext;
 		this.editor = (ConcordanceEditor)txmeditor;
@@ -133,7 +128,10 @@
 
 		// RESULT
 
-		int position = 3+extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
+		if (position < 0) {
+			position = 3+extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
+		}
+		
 		TableViewerColumn annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
 		annotationColumn = annotationColumnViewer.getColumn();
 		annotationColumn.setText(ConcordanceUIMessages.ConcordancesEditor_15);
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java	(revision 859)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/UnitToolbar.java	(revision 860)
@@ -97,8 +97,8 @@
 	public UnitToolbar() { }
 
 	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent) throws Exception {
-		super.install(txmeditor, extension, parent);
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
+		super.install(txmeditor, extension, parent, position);
 		
 		annotationArea.getLayout().numColumns = 10;
 		annotationArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java	(revision 859)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/SchemaToolbar.java	(revision 860)
@@ -86,8 +86,8 @@
 	public SchemaToolbar() { }
 
 	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent) throws Exception {
-		super.install(txmeditor, extension, parent);
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
+		super.install(txmeditor, extension, parent, position);
 		
 		annotationArea.getLayout().numColumns = 7;
 		annotationArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/URSAnnotationToolbar.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/URSAnnotationToolbar.java	(revision 859)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/toolbar/URSAnnotationToolbar.java	(revision 860)
@@ -65,7 +65,7 @@
 	public abstract void select(Element currentElement);
 
 	@Override
-	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent) throws Exception {
+	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
 
 		this.editor = (SynopticEditionEditor) txmeditor;
 		this.maincorpus = (MainCorpus) this.editor.getCorpus();
