Index: TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/SaveAnnotationsAndUpdateCorpus.java
===================================================================
--- TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/SaveAnnotationsAndUpdateCorpus.java	(revision 3569)
+++ TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/SaveAnnotationsAndUpdateCorpus.java	(revision 3570)
@@ -17,9 +17,6 @@
 import org.txm.annotation.kr.core.AnnotationManager;
 import org.txm.annotation.kr.core.KRAnnotationEngine;
 import org.txm.annotation.kr.core.preferences.KRAnnotationPreferences;
-import org.txm.concordance.rcp.editors.ConcordanceEditor;
-import org.txm.core.results.TXMResult;
-import org.txm.objects.CorpusBuild;
 import org.txm.objects.Workspace;
 import org.txm.rcp.commands.workspace.UpdateCorpus;
 import org.txm.rcp.messages.TXMUIMessages;
@@ -33,70 +30,104 @@
 	
 	public static final String ID = SaveAnnotationsAndUpdateCorpus.class.getCanonicalName();
 	
+	LinkedHashMap<String, MainCorpus> selectedCorporaToSave = null;
+	
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		
-//		ISelection sel = HandlerUtil.getCurrentSelection(event);
-//		if (!(sel instanceof IStructuredSelection)) {
-//			Log.info("No available selection to target the corpus annotations to save");	
-//			return null;
-//		}
-//		IStructuredSelection selection = (IStructuredSelection) sel;
-//		
-//		MainCorpus corpus = null;
-//
-//		if (HandlerUtil.getActiveEditor(event) instanceof ConcordanceEditor) {
-//			corpus = ((ConcordanceEditor) HandlerUtil.getActiveEditor(event)).getCorpus().getMainCorpus();
-//		} else {
-//			Object s = selection.getFirstElement();
-//			if (s == null) {
-//				Log.info("No available selection to target the corpus annotations to save");
-//				return null;
-//			} else if ((s instanceof MainCorpus)) {
-//				corpus = (MainCorpus) s;
-//			} else if (s instanceof TXMResult) {
-//				corpus = ((TXMResult) s).getFirstParent(MainCorpus.class);
-//			} else {
-//				Log.info("No available selection to target the corpus annotations to save");
-//				return null;
-//			}
-//		}
-//		
+		selectedCorporaToSave = null;
+		ISelection sel = HandlerUtil.getCurrentSelection(event);
+		IStructuredSelection selection = null;
+		if (sel instanceof IStructuredSelection) {
+			selection = (IStructuredSelection) sel;
+		}
+		if (selection.size() > 0) {
+			if (selection.getFirstElement() instanceof MainCorpus) {
+				MainCorpus corpus = (MainCorpus) selection.getFirstElement();
+				
+				AnnotationManager am;
+				try {
+					am = KRAnnotationEngine.getAnnotationManager(corpus);
+					if (am == null) {
+						Log.warning("No annotation to save for: "+corpus);
+						return null; // nothing to do
+					}
+					
+					if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
+						Log.warning("No annotation to save for: "+corpus);
+						return null;
+					}
+					
+					selectedCorporaToSave = new LinkedHashMap<>();
+					selectedCorporaToSave.put(corpus.getName(), corpus);
+				}
+				catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				
+				
+				
+			}
+		}
+		//		
+		//		MainCorpus corpus = null;
+		//
+		//		if (HandlerUtil.getActiveEditor(event) instanceof ConcordanceEditor) {
+		//			corpus = ((ConcordanceEditor) HandlerUtil.getActiveEditor(event)).getCorpus().getMainCorpus();
+		//		} else {
+		//			Object s = selection.getFirstElement();
+		//			if (s == null) {
+		//				Log.info("No available selection to target the corpus annotations to save");
+		//				return null;
+		//			} else if ((s instanceof MainCorpus)) {
+		//				corpus = (MainCorpus) s;
+		//			} else if (s instanceof TXMResult) {
+		//				corpus = ((TXMResult) s).getFirstParent(MainCorpus.class);
+		//			} else {
+		//				Log.info("No available selection to target the corpus annotations to save");
+		//				return null;
+		//			}
+		//		}
+		//		
 		
-		
-		LinkedHashMap<String, MainCorpus> corporaWithAnnotationsToSave = new LinkedHashMap<>();
-		for (MainCorpus corpus : Workspace.getInstance().getDeepChildren(MainCorpus.class)) {
-			if (!corpus.getProject().isOpen()) continue;
-			AnnotationManager am;
-			try {
-				am = KRAnnotationEngine.getAnnotationManager(corpus);
+		LinkedHashMap<String, MainCorpus> corporaWithAnnotationsToSave = null;
+		if (selectedCorporaToSave == null) {
+			
+			corporaWithAnnotationsToSave = new LinkedHashMap<>();
+			for (MainCorpus corpus : Workspace.getInstance().getDeepChildren(MainCorpus.class)) {
+				if (!corpus.getProject().isOpen()) continue;
+				AnnotationManager am;
+				try {
+					am = KRAnnotationEngine.getAnnotationManager(corpus);
+				}
+				catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+					continue;
+				}
+				if (am == null) {
+					continue; // nothing to do
+				}
+				
+				if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
+					continue;
+				}
+				
+				corporaWithAnnotationsToSave.put(corpus.getName(), corpus);
 			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				continue;
-			}
-			if (am == null) {
-				continue; // nothing to do
-			}
 			
-			if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
-				continue;
+			if (corporaWithAnnotationsToSave.size() == 0) {
+				Log.info("No CQP annotation found to save in the corpora.");
+				return null;
 			}
-			
-			corporaWithAnnotationsToSave.put(corpus.getName(), corpus);
 		}
 		
-		if (corporaWithAnnotationsToSave.size() == 0) {
-			Log.info("No CQP annotation found to save in the corpora.");
-			return null;
-		}
-		
 		try {
-//			if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
-//				Log.info(NLS.bind("No CQP annotation found to save in the {0} corpus.", corpus));
-//				return null;
-//			}
+			//			if (!KRAnnotationEngine.needToSaveAnnotations(corpus)) {
+			//				Log.info(NLS.bind("No CQP annotation found to save in the {0} corpus.", corpus));
+			//				return null;
+			//			}
 			
 			// System.out.println("DISPLAY="+Display.getDefault());
 			final Boolean[] doit = new Boolean[1];
@@ -116,16 +147,18 @@
 				@Override
 				public void run() {
 					
-					
 					doit[0] = dialog.open() == Window.OK;
 					doupdateedition[0] = dialog.getDoUpdateEdition();
+					if (dialog.getSelectedCorpus() != null) {
+						selectedCorporaToSave = dialog.getSelectedCorpus();
+					}
 				}
 			});
 			if (doit[0] == false) {
 				return null;
 			}
 			
-			if (dialog.getSelectedCorpus().size() == 0) {
+			if (selectedCorporaToSave.size() == 0) {
 				Log.info("No corpus selected. Aborting.");
 				return null;
 			}
@@ -133,8 +166,8 @@
 			
 			JobHandler job = null;
 			
-			Log.info(NLS.bind("Saving {0} annotations...", dialog.getSelectedCorpus().keySet()));
-			for (MainCorpus corpus :  dialog.getSelectedCorpus().values()) {
+			Log.info(NLS.bind("Saving {0} annotations...", selectedCorporaToSave.keySet()));
+			for (MainCorpus corpus :  selectedCorporaToSave.values()) {
 				try {
 					job = SaveAnnotations.save(corpus);
 					if (job == null) {
@@ -149,7 +182,7 @@
 					return null;
 				}
 			}
-
+			
 			if (job != null && job.getState() == Status.OK_STATUS.getCode()) {
 				if (KRAnnotationPreferences.getInstance().getBoolean(KRAnnotationPreferences.UPDATE)) {
 					
@@ -160,8 +193,8 @@
 							this.runInit(monitor);
 							
 							try {
-								monitor.setTaskName("Updating corpora: "+dialog.getSelectedCorpus().values());
-								for (MainCorpus fcorpus :  dialog.getSelectedCorpus().values()) {
+								monitor.setTaskName("Updating corpora: "+selectedCorporaToSave.values());
+								for (MainCorpus fcorpus :  selectedCorporaToSave.values()) {
 									JobHandler job2 = UpdateCorpus.update(fcorpus, false, doupdateedition[0]);
 									if (fcorpus != null && job2 != null) {
 										try {
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/UpdateCorpusDialog.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/UpdateCorpusDialog.java	(revision 3569)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/UpdateCorpusDialog.java	(revision 3570)
@@ -38,7 +38,6 @@
 		
 		super(parentShell);
 		this.corpora = corpora;
-		this.selectedCorpora = new LinkedHashMap<>();
 	}
 	
 	@Override
@@ -75,8 +74,11 @@
 	
 	private void createCorporaSelectionArea(Composite p) {
 		
+		this.selectedCorpora = new LinkedHashMap<>();
+		
 		Label valuesListLabel = new Label(p, SWT.NONE);
 		valuesListLabel.setText("Select the corpus annotations to save :");
+		
 		valuesList = new List(p, SWT.MULTI | SWT.BORDER);
 		GridData data = new GridData(GridData.FILL_HORIZONTAL);
 		valuesList.setLayoutData(data);
