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 2914)
+++ tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java	(revision 2915)
@@ -506,7 +506,7 @@
 		try {
 			if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
 				if (Log.getLevel().intValue() < Level.INFO.intValue()) annotManager.checkData();
-				editor.refresh(false);
+				// editor.fillDisplayArea(false);
 			}
 			else {
 				return;
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 2914)
+++ tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java	(revision 2915)
@@ -79,81 +79,87 @@
 import org.txm.utils.logger.Log;
 
 public class KRAnnotation extends AnnotationArea {
-
+	
 	/**
 	 * the limit number of annotation when a confirm dialog box is shown
 	 */
 	protected static final int NALERTAFFECTANNOTATIONS = 100;
+	
 	public static final String EMPTYTEXT = ""; //$NON-NLS-1$
-
+	
 	/** The annotation service */
 	protected AnnotationManager annotManager;
-
-	//boolean annotation_expert_mode = TxmPreferences.getBoolean(AnnotationPreferencePage.MODE, false);
-
+	
+	// boolean annotation_expert_mode = TxmPreferences.getBoolean(AnnotationPreferencePage.MODE, false);
+	
 	protected Point annotationSize;
-
+	
 	/** The annot btn : starts the annotation */
 	private Button addAnnotationTypeLink;
-
+	
 	protected Text annotationValuesText;
+	
 	protected ComboViewer annotationTypesCombo;
-
+	
 	protected List<TypedValue> typeValuesList;
-
+	
 	protected TableColumn annotationColumn;
-
+	
 	protected Combo addRemoveCombo;
+	
 	protected Combo affectCombo;
+	
 	protected Button affectAnnotationButton;
-
+	
 	protected Button infosAnnotTypeSelectedLink;
-
+	
 	protected KnowledgeRepository currentKnowledgeRepository = null;
-	protected Vector<AnnotationType> typesList = new Vector<AnnotationType>(); 
-
+	
+	protected Vector<AnnotationType> typesList = new Vector<>();
+	
 	protected Button addTypedValueLink;
-
+	
 	protected Label withLabel;
-
+	
 	protected Label equalLabel;
-
+	
 	protected TypedValue value_to_add;
-
+	
 	protected Concordance concordance;
-
+	
 	private CQPCorpus corpus;
-
+	
 	private ConcordanceAnnotations annotations = null;
-
+	
 	ConcordanceEditor editor;
-
+	
 	public KRAnnotation() {
-
+		
 	}
-
+	
+	@Override
 	public String getName() {
 		return KRAnnotationUIMessages.squencesDeMotsCatgorievaleur;
 	}
-
+	
 	@Override
 	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
-
+		
 		this.extension = ext;
-		this.editor = (ConcordanceEditor)txmeditor;
+		this.editor = (ConcordanceEditor) txmeditor;
 		this.concordance = this.editor.getConcordance();
 		this.corpus = concordance.getCorpus();
 		this.annotations = new ConcordanceAnnotations(this.editor.getConcordance());
 		this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
-
+		
 		TableViewer viewer = this.editor.getLineTableViewer();
-
+		
 		// RESULT
-
+		
 		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(KRAnnotationUIMessages.category);
@@ -162,97 +168,100 @@
 		annotationColumn.pack();
 		annotationColumn.addControlListener(new ConcordanceColumnSizeControlListener(annotationColumn));
 		annotationColumnViewer.setLabelProvider(new ColumnLabelProvider() {
-
+			
 			@Override
 			public String getText(Object element) {
-				Line line = (Line)element;
+				Line line = (Line) element;
 				AnnotationLine annotationLine = annotations.getAnnotationLine(line);
-				if (annotationLine == null) return EMPTYTEXT ;
-				if (annotationLine.getAnnotation()!=null) {
+				if (annotationLine == null) return EMPTYTEXT;
+				if (annotationLine.getAnnotation() != null) {
 					String value = annotationLine.getAnnotationValue().getStandardName();
 					Annotation a = annotationLine.getAnnotation();
 					if (value == null) value = a.getValue();
-
+					
 					if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
-						value = "… "+value; //$NON-NLS-1$
+						value = "… " + value; //$NON-NLS-1$
 					}
-
+					
 					if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
-						value = value+" …"; //$NON-NLS-1$
-					} 
+						value = value + " …"; //$NON-NLS-1$
+					}
 					return value;
-				} else {
+				}
+				else {
 					return EMPTYTEXT;
 				}
 			}
 		});
-
+		
 		ext.getSaveButton().setEnabled(true);
 		return composeAnnotationArea(parent);
 	}
-
+	
 	public boolean initialiseInput(ConcordanceEditor editor) throws Exception {
 		this.editor = editor;
 		concordance = editor.getConcordance();
 		annotations = new ConcordanceAnnotations(concordance);
 		corpus = concordance.getCorpus();
-
+		
 		CQPCorpus corpus = editor.getCorpus();
-
+		
 		this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
-
+		
 		return true;
 	}
-
-	private boolean composeAnnotationArea(final Composite parent){ 
-
+	
+	private boolean composeAnnotationArea(final Composite parent) {
+		
 		List<KnowledgeRepository> krs = InitializeKnowledgeRepository.get(corpus.getMainCorpus());
 		typesList.clear();
-		Log.fine("Corpus KRs: "+krs); //$NON-NLS-1$
-
+		Log.fine("Corpus KRs: " + krs); //$NON-NLS-1$
+		
 		for (KnowledgeRepository kr : krs) {
 			if (kr == null) continue;
-
+			
 			currentKnowledgeRepository = kr;
-			Log.fine(" KR: "+kr); //$NON-NLS-1$
+			Log.fine(" KR: " + kr); //$NON-NLS-1$
 			List<AnnotationType> krtypes = kr.getAllAnnotationTypes();
 			for (AnnotationType type : krtypes) {
 				if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
 					typesList.add(type);
 				}
 			}
-
+			
 			Log.fine(NLS.bind(KRAnnotationUIMessages.availableAnnotationTypesColonP0, typesList));
 			break;
 		}
-
+		
 		if (currentKnowledgeRepository == null) {
 			System.out.println(KRAnnotationUIMessages.errorColonNoSuitableKnowledgeRepositoryFound);
 			return false;
 		}
-
+		
 		annotationArea = new GLComposite(parent, SWT.NONE, KRAnnotationUIMessages.concordanceAnnotationArea);
 		annotationArea.getLayout().numColumns = 12;
 		annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
+		
 		addRemoveCombo = new Combo(annotationArea, SWT.READ_ONLY);
 		String affectLabel = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_22"); //$NON-NLS-1$
-		if (affectLabel == null) affectLabel= KRAnnotationUIMessages.affect;
+		if (affectLabel == null) affectLabel = KRAnnotationUIMessages.affect;
 		String removeLabel = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_24"); //$NON-NLS-1$
-		if (removeLabel == null) removeLabel= KRAnnotationUIMessages.delete;
-		String items[] = {affectLabel, removeLabel};
+		if (removeLabel == null) removeLabel = KRAnnotationUIMessages.delete;
+		String items[] = { affectLabel, removeLabel };
 		addRemoveCombo.setItems(items);
 		addRemoveCombo.select(0);
 		addRemoveCombo.addSelectionListener(new SelectionListener() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				if (addRemoveCombo.getSelectionIndex() == 0) { // add
 					annotationValuesText.setEnabled(true);
 					String withLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_83"); //$NON-NLS-1$
-					if (withLabelText == null) withLabelText= KRAnnotationUIMessages.withTheCategory;
+					if (withLabelText == null) withLabelText = KRAnnotationUIMessages.withTheCategory;
 					withLabel.setText(withLabelText);
 					if (equalLabel != null) equalLabel.setText("="); //$NON-NLS-1$
-				} else { // remove
+				}
+				else { // remove
 					annotationValuesText.setEnabled(false);
 					withLabel.setText(""); //$NON-NLS-1$
 					if (equalLabel != null) equalLabel.setText(""); //$NON-NLS-1$
@@ -261,47 +270,51 @@
 				annotationArea.layout();
 				updateAnnotationWidgetStates();
 			}
+			
 			@Override
-			public void widgetDefaultSelected(SelectionEvent e) { }
+			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
 		GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
 		gdata.widthHint = 90;
 		addRemoveCombo.setLayoutData(gdata);
-
+		
 		withLabel = new Label(annotationArea, SWT.NONE);
 		String withLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_83"); //$NON-NLS-1$
-		if (withLabelText == null) withLabelText= KRAnnotationUIMessages.withTheCategory;
+		if (withLabelText == null) withLabelText = KRAnnotationUIMessages.withTheCategory;
 		withLabel.setText(withLabelText);
 		withLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
-
+		
 		equalLabel = new Label(annotationArea, SWT.NONE);
 		equalLabel.setText("="); //$NON-NLS-1$
 		equalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
-
-		//Display combo with list of Annotation Type 
+		
+		// Display combo with list of Annotation Type
 		annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
 		annotationTypesCombo.setContentProvider(new ArrayContentProvider());
 		annotationTypesCombo.setLabelProvider(new SimpleLabelProvider() {
+			
 			@Override
 			public String getColumnText(Object element, int columnIndex) {
-				return ((AnnotationType)element).getName(); //$NON-NLS-1$
+				return ((AnnotationType) element).getName();
 			}
+			
 			@Override
 			public String getText(Object element) {
-				return ((AnnotationType)element).getName(); //$NON-NLS-1$
+				return ((AnnotationType) element).getName();
 			}
 		});
 		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
 		gdata.widthHint = 200;
-
+		
 		annotationTypesCombo.getCombo().setLayoutData(gdata);
 		annotationTypesCombo.setInput(typesList);
 		if (typesList.size() > 0) {
 			annotationTypesCombo.getCombo().select(0);
 			annotations.setViewAnnotation(typesList.get(0));
 		}
-
+		
 		annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+			
 			@Override
 			public void selectionChanged(SelectionChangedEvent event) {
 				AnnotationType type = getSelectedAnnotationType();
@@ -310,39 +323,42 @@
 					try {
 						KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
 						typeValuesList = kr.getValues(type);
-					} catch (Exception e) {
+					}
+					catch (Exception e) {
 						// TODO Auto-generated catch block
 						e.printStackTrace();
 					}
 				}
-
+				
 				annotationColumn.setText(type.getName());
 				if (concordance != null) {
 					annotations.setViewAnnotation(type);
 					annotations.setAnnotationOverlap(true);
 					try {
 						editor.refresh(false);
-					} catch (Exception e) {
+					}
+					catch (Exception e) {
 						// TODO Auto-generated catch block
 						e.printStackTrace();
 					}
 				}
-
+				
 				updateAnnotationWidgetStates();
 			}
 		});
-
+		
 		if (currentKnowledgeRepository instanceof SQLKnowledgeRepository) {
 			infosAnnotTypeSelectedLink = new Button(annotationArea, SWT.PUSH);
 			infosAnnotTypeSelectedLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_INFO));
 			infosAnnotTypeSelectedLink.setEnabled(true);
-			infosAnnotTypeSelectedLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
+			infosAnnotTypeSelectedLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 			infosAnnotTypeSelectedLink.addSelectionListener(new SelectionListener() {
+				
 				@Override
 				public void widgetSelected(SelectionEvent e) {
 					AnnotationType type = getSelectedAnnotationType();
 					if (type == null) return;
-
+					
 					String typedValueURL = type.getURL(); // may be null/empty
 					if (typedValueURL != null && typedValueURL.length() > 0) {
 						KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
@@ -350,36 +366,39 @@
 					}
 					if (typedValueURL != null && typedValueURL.length() > 0) {
 						OpenBrowser.openfile(typedValueURL, new File(typedValueURL).getName());
-					} else {
+					}
+					else {
 						IWorkbenchWindow window = editor.getSite().getWorkbenchWindow();
 						try {
 							OpenKRView.openView(window, type);
-						} catch (PartInitException e1) {
+						}
+						catch (PartInitException e1) {
 							e1.printStackTrace();
 						}
 					}
 				}
-
+				
 				@Override
-				public void widgetDefaultSelected(SelectionEvent e) { }
+				public void widgetDefaultSelected(SelectionEvent e) {}
 			});
 		}
-
+		
 		if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
 			addAnnotationTypeLink = new Button(annotationArea, SWT.PUSH);
 			addAnnotationTypeLink.setToolTipText(KRAnnotationUIMessages.addANewCategory);
 			addAnnotationTypeLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
 			addAnnotationTypeLink.setEnabled(true);
-			addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
+			addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 			addAnnotationTypeLink.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(), KRAnnotationUIMessages.newCategory, KRAnnotationUIMessages.pleaseEnterTheNewTypeName, "", null); //$NON-NLS-3$ //$NON-NLS-1$
+					
+					LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
+					
+					InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), KRAnnotationUIMessages.newCategory, KRAnnotationUIMessages.pleaseEnterTheNewTypeName, "", null); //$NON-NLS-1$
 					if (dialog.open() == InputDialog.OK) {
 						String name = dialog.getValue();
 						if (name.trim().length() == 0) return;
@@ -393,93 +412,112 @@
 						AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
 						type.setEffect(AnnotationEffect.SEGMENT);
 						typesList.add(type);
-
+						
 						if (annotationTypesCombo != null) annotationTypesCombo.refresh();
-						if (typesList.size() == 1) {
-							if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
-							if (concordance != null) {
-								annotations.setViewAnnotation(type);
-								annotations.setAnnotationOverlap(true);
-								editor.fillDisplayArea(false);
-							}
-							annotationArea.layout(true);
-						} else {
-							if (typesList.size() > 1) {
-								if (annotationTypesCombo != null) {
-									annotationTypesCombo.getCombo().select(typesList.size()-1);
-								}
-							}
-						}
+						
+						// if (typesList.size() == 1) {
+						// if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
+						// if (concordance != null) {
+						// annotations.setAnnotationOverlap(true);
+						// try {
+						// annotationColumn.setText(type.getId());
+						// 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);
+						// }
+						// }
+						// }
+						
+						annotations.setViewAnnotation(type);
+						annotationTypesCombo.setSelection(new StructuredSelection(typesList.get(typesList.size() - 1))); // select the new annotation
+						annotationArea.layout(true);
+						
 						KRView.refresh();
 						updateAnnotationWidgetStates();
-					} else {
+					}
+					else {
 						System.out.println("Creation aborted."); //$NON-NLS-1$
 					}
 				}
-
+				
 				@Override
-				public void widgetDefaultSelected(SelectionEvent e) { }
+				public void widgetDefaultSelected(SelectionEvent e) {}
 			});
 		}
-
+		
 		Label valueLabel = new Label(annotationArea, SWT.NONE);
 		String valueLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_80"); //$NON-NLS-1$
 		if (valueLabelText == null) {
-			valueLabelText= KRAnnotationUIMessages.valueEquals;
+			valueLabelText = KRAnnotationUIMessages.valueEquals;
 		}
 		valueLabel.setText(valueLabelText);
 		valueLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
-
+		
 		annotationValuesText = new Text(annotationArea, SWT.BORDER);
 		annotationValuesText.setToolTipText(KRAnnotationUIMessages.enterAValueForAnId);
 		GridData gdata2 = new GridData(SWT.FILL, SWT.CENTER, false, false);
 		gdata2.widthHint = 200;
 		annotationValuesText.setLayoutData(gdata2);
 		annotationValuesText.addKeyListener(new KeyListener() {
+			
 			@Override
 			public void keyReleased(KeyEvent e) {
 				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
 					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
 				}
 			}
-
+			
 			@Override
-			public void keyPressed(KeyEvent e) { }
+			public void keyPressed(KeyEvent e) {}
 		});
-
+		
 		if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
 			addTypedValueLink = new Button(annotationArea, SWT.PUSH);
 			addTypedValueLink.setText("..."); //$NON-NLS-1$
 			addTypedValueLink.setToolTipText(KRAnnotationUIMessages.selectAValueAmongTheList);
 			addTypedValueLink.setEnabled(true);
-			addTypedValueLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
+			addTypedValueLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 			addTypedValueLink.addSelectionListener(new SelectionListener() {
+				
 				@Override
 				public void widgetSelected(SelectionEvent e) {
 					if (currentKnowledgeRepository == null) return;
 					if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
-
+					
 					AnnotationType type = getSelectedAnnotationType();
 					if (type == null) return;
-
-					LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
-
+					
+					LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
+					
 					ListDialog dialog = new ListDialog(e.widget.getDisplay().getActiveShell());
 					String title = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_100"); //$NON-NLS-1$
 					if (title == null) title = KRAnnotationUIMessages.availableValuesForP0;
-					dialog.setTitle(ConcordanceUIMessages.bind(title, type.getName()));//+"valeurs de "+type.getName());
+					dialog.setTitle(ConcordanceUIMessages.bind(title, type.getName()));// +"valeurs de "+type.getName());
 					dialog.setContentProvider(new ArrayContentProvider());
 					dialog.setLabelProvider(new SimpleLabelProvider() {
+						
+						@Override
 						public String getColumnText(Object element, int columnIndex) {
 							if (element instanceof TypedValue)
-								return ((TypedValue)element).getId();
+								return ((TypedValue) element).getId();
 							return element.toString();
 						}
 					});
 					List<TypedValue> values;
 					try {
 						values = kr.getValues(type);
-					} catch (Exception e1) {
+					}
+					catch (Exception e1) {
 						e1.printStackTrace();
 						return;
 					}
@@ -488,103 +526,107 @@
 						TypedValue value = (TypedValue) dialog.getResult()[0];
 						String name = value.getId();
 						if (name.trim().length() == 0) return;
-
+						
 						annotationValuesText.setText(name);
-					} else {
-
 					}
+					else {
+						
+					}
 				}
-
+				
 				@Override
-				public void widgetDefaultSelected(SelectionEvent e) { }
+				public void widgetDefaultSelected(SelectionEvent e) {}
 			});
 		}
-
+		
 		affectCombo = new Combo(annotationArea, SWT.READ_ONLY);
 		affectCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
-		String items2[] = {KRAnnotationUIMessages.selectedLines, KRAnnotationUIMessages.allLines};
+		String items2[] = { KRAnnotationUIMessages.selectedLines, KRAnnotationUIMessages.allLines };
 		affectCombo.setItems(items2);
 		affectCombo.select(0);
 		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
 		gdata.widthHint = 140;
 		affectCombo.setLayoutData(gdata);
-
+		
 		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
 		affectAnnotationButton.setText(KRAnnotationUIMessages.oK);
 		affectAnnotationButton.setToolTipText(KRAnnotationUIMessages.proceedToAnnotation);
 		affectAnnotationButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
 		affectAnnotationButton.addSelectionListener(new SelectionListener() {
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				int isel = affectCombo.getSelectionIndex();
 				if (isel == 0) { // selected line
 					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
-				} else { // all
+				}
+				else { // all
 					try {
 						List<? extends Match> matches = concordance.getMatches();
 						affectMatchesToSelection(matches);
-					} catch (Exception e1) {
+					}
+					catch (Exception e1) {
 						Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceColonP0, e1.getLocalizedMessage()));
 						Log.printStackTrace(e1);
 						return;
 					}
 				}
 			}
-
+			
 			@Override
-			public void widgetDefaultSelected(SelectionEvent e) { }
+			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
-		//		Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
-		//		saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
-		//		saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
+		// Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
+		// saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
+		// saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
 		//
-		//		saveAnnotationButton.addSelectionListener(new SelectionListener() {
-		//			@Override
-		//			public void widgetSelected(SelectionEvent e) {
+		// saveAnnotationButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
 		//
-		//				try {
-		//					AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
-		//					if (am != null && am.hasChanges()) {
-		//						// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
-		//						JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
-		//						
-		//						if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
-		//							// update editor corpus
-		//							System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
-		//						}
-		//						
-		//						CorporaView.refresh();
-		//					}
-		//				} catch(Exception ex) {
-		//					ex.printStackTrace();
-		//				}
-		//			}
+		// try {
+		// AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
+		// if (am != null && am.hasChanges()) {
+		// // && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
+		// JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
 		//
-		//			@Override
-		//			public void widgetDefaultSelected(SelectionEvent e) { }
-		//		});
-
+		// if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
+		// // update editor corpus
+		// System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
+		// }
+		//
+		// CorporaView.refresh();
+		// }
+		// } catch(Exception ex) {
+		// ex.printStackTrace();
+		// }
+		// }
+		//
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) { }
+		// });
+		
 		Button closeButton = new Button(annotationArea, SWT.PUSH);
 		closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
 		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
 		closeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
 		closeButton.addSelectionListener(new SelectionListener() {
-
+			
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				extension.removeAnnotationArea(KRAnnotation.this);
 			}
-
+			
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
-
+		
 		updateAnnotationWidgetStates();
 		editor.layout(true);
-
+		
 		return true;
 	}
-
+	
 	@Override
 	public boolean hasChanges() {
 		AnnotationManager am;
@@ -592,108 +634,117 @@
 			am = KRAnnotationEngine.getAnnotationManager(corpus);
 			if (am != null && am.hasChanges()) {
 				return am.hasChanges();
-			} else {
+			}
+			else {
 				return false;
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 			return false;
 		}
 	}
-
+	
 	protected void affectAnnotationToSelection(ISelection selection) {
-
+		
 		final IStructuredSelection lineSelection = (IStructuredSelection) selection;
 		List<Line> lines = lineSelection.toList();
-		ArrayList<Match> matches = new ArrayList<Match>();
+		ArrayList<Match> matches = new ArrayList<>();
 		for (Line l : lines) {
 			matches.add(l.getMatch());
 		}
-
+		
 		affectMatchesToSelection(matches);
 	}
-
+	
 	protected AnnotationType getSelectedAnnotationType() {
 		if (annotationTypesCombo.getCombo().isDisposed()) return null;
-
-		IStructuredSelection isel = (IStructuredSelection)annotationTypesCombo.getSelection();
+		
+		IStructuredSelection isel = (IStructuredSelection) annotationTypesCombo.getSelection();
 		if (isel.isEmpty()) {
 			return null;
 		}
 		return (AnnotationType) isel.getFirstElement();
 	}
-
+	
 	protected void affectMatchesToSelection(final List<? extends Match> matches) {
 		final AnnotationType type = getSelectedAnnotationType();
 		final String svalue = annotationValuesText.getText();
 		final boolean doAffect = addRemoveCombo.getSelectionIndex() == 0; // add is default
-
+		
 		JobHandler job = new JobHandler(KRAnnotationUIMessages.annotatingConcordanceSelection, true) {
+			
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
 				this.runInit(monitor);
 				try {
 					if (doAffect) {
 						affectAnnotationValues(matches, type, svalue, this);
-					} else {
+					}
+					else {
 						deleteAnnotationValues(matches, type, this);
 					}
-				} catch(Exception e) {
+				}
+				catch (Exception e) {
 					Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceSelectionColonP0, e));
 					Log.printStackTrace(e);
 					return Status.CANCEL_STATUS;
-				} catch(ThreadDeath td) {
+				}
+				catch (ThreadDeath td) {
 					System.out.println(KRAnnotationUIMessages.annotationCanceledByUser);
 					return Status.CANCEL_STATUS;
 				}
-
+				
 				return Status.OK_STATUS;
 			}
 		};
 		job.startJob(true);
 	}
-
+	
 	public void updateAnnotationWidgetStates() {
 		if (annotationArea == null) return; // :)
 		if (annotationArea.isDisposed()) return;
-
+		
 		annotationArea.getDisplay().syncExec(new Runnable() {
-
+			
 			@Override
 			public void run() {
 				if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
-
+					
 					if (getSelectedAnnotationType() != null) {
 						annotationValuesText.setEnabled(true);
-
+						
 						affectAnnotationButton.setEnabled(true);
 						affectCombo.setEnabled(true);
-					} else {
+					}
+					else {
 						annotationValuesText.setEnabled(false);
-
+						
 						affectAnnotationButton.setEnabled(false);
 						affectCombo.setEnabled(false);
 					}
-				} else {
+				}
+				else {
 					annotationValuesText.setEnabled(false);
-
+					
 					if (getSelectedAnnotationType() != null) {
 						affectAnnotationButton.setEnabled(true);
 						affectCombo.setEnabled(true);
-					} else {
+					}
+					else {
 						affectAnnotationButton.setEnabled(false);
 						affectCombo.setEnabled(false);
 					}
 				}
-
+				
 				if (infosAnnotTypeSelectedLink != null) {
 					infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
 				}
 				if (addTypedValueLink != null) {
 					addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
 				}
-
+				
 				if (concordance == null) {
 					affectAnnotationButton.setEnabled(false);
 					affectCombo.setEnabled(false);
@@ -701,46 +752,55 @@
 			}
 		});
 	}
-
+	
 	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
 		if (concordance == null) {
 			return;
 		}
-
+		
 		if (matches.size() == 0) {
 			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
 			return;
 		}
-
+		
 		if (type == null) {
 			return;
 		}
-
+		
 		if (concordance != null) {
 			try {
 				if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
 					if (Log.getLevel().intValue() < Level.INFO.intValue()) annotManager.checkData();
-					concordance.reloadLines(editor.getTopLine(), editor.getBottomLine()+1);
-				} else {
+					concordance.reloadLines(editor.getTopLine(), editor.getBottomLine() + 1);
+				}
+				else {
 					return;
 				}
-			} catch (Exception e1) {
+			}
+			catch (Exception e1) {
 				System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
 				Log.printStackTrace(e1);
 				return;
 			}
-
+			
 			job.syncExec(new Runnable() {
+				
 				@Override
 				public void run() {
-					editor.fillDisplayArea(false);
+					try {
+						editor.refresh(false);
+					}
+					catch (Exception e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
 					CorporaView.refreshObject(corpus);
 				}
 			});
 		}
 	}
-
-	protected void affectAnnotationValues(final List<? extends Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
+	
+	protected void affectAnnotationValues(final List<? extends Match> matches, final AnnotationType type, final String svalue, JobHandler job) {
 		value_to_add = null; // reset
 		if (concordance == null) {
 			System.out.println("No concordance done. Aborting."); //$NON-NLS-1$
@@ -751,16 +811,17 @@
 			return;
 		}
 		if (type == null) return; // no type, no annotation
-
+		
 		job.syncExec(new Runnable() {
+			
 			@Override
 			public void run() {
 				if (matches.size() > NALERTAFFECTANNOTATIONS) {
-					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
+					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(),
 							"confirm_annotate",  //$NON-NLS-1$
-							KRAnnotationUIMessages.confirmAnnotationAffectation, 
+							KRAnnotationUIMessages.confirmAnnotationAffectation,
 							NLS.bind(KRAnnotationUIMessages.youAreAboutToAnnotateP0ElementsContinue, matches.size()));
-
+					
 					if (dialog.open() == ConfirmDialog.CANCEL) {
 						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
 						matches.clear();
@@ -768,40 +829,43 @@
 				}
 			}
 		});
-
+		
 		// get value from combo text value
 		Log.fine(NLS.bind(KRAnnotationUIMessages.lookingForTypedValueWithIdEqualsP0, svalue));
 		final KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
 		value_to_add = kr.getValue(type, svalue);
-
-
+		
+		
 		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) { // create or not the annotation is simple mode
 			job.syncExec(new Runnable() {
+				
 				@Override
 				public void run() {
 					String title = kr.getString(editor.getLocale(), "ConcordancesEditor_110"); //$NON-NLS-1$
 					String content = kr.getString(editor.getLocale(), "ConcordancesEditor_112"); //$NON-NLS-1$
-					if (title == null ) title = KRAnnotationUIMessages.newValueP0ForCategoryP1;
-					if (content == null ) content = KRAnnotationUIMessages.theValueP0IsNotAssociatedWithTheCategoryP1AssociateIt;
-					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
+					if (title == null) title = KRAnnotationUIMessages.newValueP0ForCategoryP1;
+					if (content == null) content = KRAnnotationUIMessages.theValueP0IsNotAssociatedWithTheCategoryP1AssociateIt;
+					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(),
 							"create_value", //$NON-NLS-1$
-							ConcordanceUIMessages.bind(title, svalue, type.getName()),  
+							ConcordanceUIMessages.bind(title, svalue, type.getName()),
 							ConcordanceUIMessages.bind(content, svalue, type.getName()));
 					if (dialog.open() == ConfirmDialog.CANCEL) {
 						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
 						return;
-					} else {
+					}
+					else {
 						value_to_add = kr.addValue(svalue, svalue, type.getId());
 						KRView.refresh();
 					}
 				}
 			});
 		}
-
+		
 		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) return; // canceled
-
-		if (value_to_add == null) {	
+		
+		if (value_to_add == null) {
 			job.syncExec(new Runnable() {
+				
 				@Override
 				public void run() {
 					String mess = ConcordanceUIMessages.bind(KRAnnotationUIMessages.noValueFoundWithTheP0Id, svalue);
@@ -811,67 +875,74 @@
 			});
 			return;
 		}
-
-		//Log.info("AFFECT "+value_to_add+" to SELECTION="+matches); //$NON-NLS-1$ //$NON-NLS-1$
-
+		
+		// Log.info("AFFECT "+value_to_add+" to SELECTION="+matches); //$NON-NLS-1$ //$NON-NLS-1$
+		
 		// finally we can 'try' to create the annotations \o/
 		try {
 			HashMap<Match, List<Annotation>> existingAnnots = annotManager.createAnnotations(type, value_to_add, matches, job);
-
+			
 			// did we had problems ?
-			if (existingAnnots!=null && existingAnnots.size() > 0) {
+			if (existingAnnots != null && existingAnnots.size() > 0) {
 				String message = NLS.bind(KRAnnotationUIMessages.couldNotAnnotateTheValueP0OnCertainSequences, value_to_add.getStandardName());
 				for (Match m : existingAnnots.keySet()) {
 					message += NLS.bind(KRAnnotationUIMessages.theSequenceP0IsOverlappingWith, m);
-
+					
 					for (Annotation existingAnnot : existingAnnots.get(m)) {
-						if (existingAnnot.getStart() < m.getStart()){
+						if (existingAnnot.getStart() < m.getStart()) {
 							message += TXMCoreMessages.bind(KRAnnotationUIMessages.theEndOfAStructureP0AtP1P2, existingAnnot.getType(), existingAnnot.getStart(), existingAnnot.getEnd());
-						} else {
+						}
+						else {
 							message += TXMCoreMessages.bind(KRAnnotationUIMessages.theStartOfAStructureP0AtP1P2, existingAnnot.getType(), existingAnnot.getStart(), existingAnnot.getEnd());
 						}
 					}
 				}
 				final String final_message = message;
 				job.syncExec(new Runnable() {
+					
 					@Override
 					public void run() {
 						MessageDialog.openInformation(editor.getSite().getShell(), KRAnnotationUIMessages.aboutAnnotations, final_message);
 					}
 				});
 			}
-			//				if (history != null && !history.get(type).contains(value_to_add))
-			//					history.get(type).add(value_to_add);
-
+			// if (history != null && !history.get(type).contains(value_to_add))
+			// history.get(type).add(value_to_add);
+			
 			if (Log.getLevel().intValue() < Level.INFO.intValue() && annotManager != null) {
 				annotManager.checkData();
 			}
 			concordance.reloadCurrentLines();
-		} catch (Exception e1) {
+		}
+		catch (Exception e1) {
 			System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileAffectionAnnotationColonP0, e1));
 			Log.printStackTrace(e1);
 			return;
 		}
-
+		
 		job.syncExec(new Runnable() {
+			
 			@Override
 			public void run() {
 				try {
 					editor.refresh(false);
 					CorporaView.refreshObject(corpus);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					e.printStackTrace();
 				}
 			}
 		});
-
+		
 	}
-
+	
+	@Override
 	public boolean notifyStartOfCompute() throws Exception {
 		if (annotationArea == null) return false;
 		if (annotationArea.isDisposed()) return false;
-
+		
 		annotationArea.getDisplay().syncExec(new Runnable() {
+			
 			@Override
 			public void run() {
 				AnnotationType type = getSelectedAnnotationType();
@@ -881,10 +952,11 @@
 				}
 			}
 		});
-
+		
 		return true;
 	}
-
+	
+	@Override
 	public boolean notifyEndOfCompute() throws Exception {
 		updateAnnotationWidgetStates();
 		if (annotationArea == null) return false;
@@ -893,50 +965,57 @@
 		// update annotation column width
 		if (annotationArea != null) {
 			annotationArea.getDisplay().syncExec(new Runnable() {
+				
 				@Override
 				public void run() {
 					annotationColumn.pack();
 					annotationColumn.setResizable(true);
 				}
 			});
-		} else { 
+		}
+		else {
 			annotationColumn.setWidth(0);
 		}
-
+		
 		return true;
 	}
-
-
+	
+	
+	@Override
 	public boolean isAnnotationEnable() {
 		return annotationArea != null;
 	}
-
+	
 	@Override
 	public boolean save() {
 		try {
 			AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
 			if (am != null && am.hasChanges()) {
-				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
+				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now
+				// ?")
 				JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
 				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
 					// update editor corpus
 					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
 					return false;
-				} else {
+				}
+				else {
 					if (annotationColumn != null && !annotationColumn.isDisposed()) {
 						annotationColumn.setText(annotations.getViewAnnotation().getName());
 					}
 					return true; // something was saved
 				}
-			} else {
+			}
+			else {
 				return false;
 			}
-		} catch(Exception ex) {
+		}
+		catch (Exception ex) {
 			ex.printStackTrace();
 			return false;
 		}
 	}
-
+	
 	@Override
 	protected void _close() {
 		if (!annotationColumn.isDisposed()) annotationColumn.dispose();
@@ -945,41 +1024,42 @@
 		}
 		extension.layout();
 	}
-
+	
 	@Override
 	public void notifyEndOfRefresh() throws Exception {
 		// TODO Auto-generated method stub
-
+		
 	}
-
+	
 	@Override
 	public void notifyStartOfCreatePartControl() throws Exception {
 		// TODO Auto-generated method stub
-
+		
 	}
-
+	
 	@Override
 	public void notifyStartOfRefresh() throws Exception {
-		List<Line> lines = concordance.getLines(concordance.getTopIndex(), concordance.getTopIndex()+concordance.getNLinePerPage());
+		List<Line> lines = concordance.getLines(concordance.getTopIndex(), concordance.getTopIndex() + concordance.getNLinePerPage());
 		annotations.computeLines(lines);
 	}
-
+	
 	@Override
 	public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
 		return Concordance.class;
 	}
-
+	
+	@Override
 	public boolean isDirty() {
 		return annotManager != null;
 	}
-
+	
 	@Override
 	public boolean discardChanges() {
 		return false;
 	}
-
+	
 	@Override
 	public boolean needToUpdateIndexes() {
 		return true;
 	}
-}
\ No newline at end of file
+}
