Index: TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 3633)
+++ TXM/trunk/org.txm.core/src/java/org/txm/utils/BundleUtils.java	(revision 3634)
@@ -154,9 +154,11 @@
 		
 		File bundleDir = getBundleFile(bundle_id);
 		long l1 = bundleDir.lastModified();
+//		System.out.println("bundle dir "+bundleDir+" date="+l1);
 		
 		Bundle bundle = Platform.getBundle(bundle_id);
 		long l2 = bundle.getLastModified();
+//		System.out.println("bundle dir "+bundle+" date="+l2);
 		return Math.max(l1, l2);
 	}
 	
Index: TXM/trunk/org.txm.core/src/java/org/txm/Toolbox.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/Toolbox.java	(revision 3633)
+++ TXM/trunk/org.txm.core/src/java/org/txm/Toolbox.java	(revision 3634)
@@ -838,8 +838,8 @@
 	
 	public static void writeStartupCorporaDiagnostics(File checkupResultFile) {
 		
-		Log.warning(NLS.bind("TXM was not correctly closed, see the report in the ''{0}'' file", checkupResultFile.getAbsolutePath()));
 		
+		
 		StringBuilder builder = new StringBuilder();
 		
 		IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
@@ -919,6 +919,9 @@
 			}
 		}
 		
-		IOUtils.write(checkupResultFile, builder.toString());
+		if (builder.length() > 0) {
+			IOUtils.write(checkupResultFile, builder.toString());
+			Log.warning(NLS.bind("TXM was not correctly closed, see the report in the ''{0}'' file", checkupResultFile.getAbsolutePath()));
+		}
 	}
 }
Index: TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java	(revision 3633)
+++ TXM/trunk/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java	(revision 3634)
@@ -107,6 +107,7 @@
 		File backUserDirectory = new File(parentFiletoUse, directorytoBackUp.getName()+"-"+Toolbox.dateformat.format(new Date()));
 		int nBackupedFiles = 0;
 		long updateTime = BundleUtils.getDate(bundle_id);
+//		System.out.println("update time: "+updateTime+" of "+bundle_id);
 		for (File f : DeleteDir.scanDirectory(directorytoBackUp, true, true)) {
 			long t = f.lastModified();
 			
@@ -129,7 +130,7 @@
 			}
 		}
 		if (nBackupedFiles > 0) {
-			Log.info(NLS.bind("Modified Groovy files saved in {0} ({1})", backUserDirectory, nBackupedFiles));
+			Log.info(NLS.bind("Some modified Groovy files have been saved in the {0} directory ({1})", backUserDirectory, nBackupedFiles));
 		}
 		
 	}
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/WordProperty2WordMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/WordProperty2WordMacro.groovy	(revision 3633)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/WordProperty2WordMacro.groovy	(revision 3634)
@@ -1,106 +0,0 @@
-// Copyright © 2021 ENS Lyon
-// Licensed under the terms of the GNU General Public License version 3 (http://www.gnu.org/licenses/gpl-3.0.html)
-// @author mdecorde
-// @author sheiden
-
-package org.txm.macro.annotation
-
-// STANDARD DECLARATIONS
-import org.txm.rcpapplication.swt.widget.parameters.*
-import org.txm.searchengine.cqp.corpus.*
-import org.txm.xml.DOMIdentityHook
-import org.txm.xml.LocalNameHookActivator
-import org.txm.xml.XMLProcessor
-import org.txm.objects.*
-import org.txm.rcp.utils.JobHandler
-import org.txm.rcp.views.corpora.CorporaView
-import org.eclipse.core.runtime.Status
-import org.txm.annotation.kr.core.KRAnnotationEngine
-import org.txm.annotation.kr.core.repository.*
-import org.txm.annotation.kr.rcp.commands.SaveAnnotations
-import org.txm.annotation.kr.rcp.concordance.WordAnnotationToolbar
-import org.txm.importer.StaxIdentityParser
-
-def scriptName = this.class.getSimpleName()
-
-if (!(corpusViewSelection instanceof MainCorpus)) {
-	println "** $scriptName: please select a Corpus in the Corpus view."
-	return 0
-}
-
-MainCorpus mcorpus = corpusViewSelection
-Project project = mcorpus.getProject()
-File txmDir = new File(project.getProjectDirectory(), "txm/"+mcorpus.getName())
-
-@Field @Option(name="outputDirectory", usage="Directory of resulting XML-TXM files", widget="Folder", required=true, def="")
-File outputDirectory
-
-@Field @Option(name="word_property", usage="The word property to project", widget="String", required=true, def="type")
-String word_property
-
-@Field @Option(name="values_to_ignore_regex", usage="regex of values not to project", widget="String", required=true, def="")
-String values_to_ignore_regex
-
-@Field @Option(name="debug", usage="Afficher les messages de debug", widget="Boolean", required=true, def="false")
-def debug
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return
-
-if (!outputDirectory.exists()) {
-	println "Error: output directory not found: "+outputDirectory
-	return false
-}
-
-values_to_ignore_regex = /$values_to_ignore_regex/
-
-for (Text text : project.getChildren(Text.class)) {
-	println "Text: "+text
-	
-	File orig = text.getXMLTXMFile()
-	if (!orig.exists()) {
-		println "Warning: no XML-TXM file found for "+text
-		continue // next !
-	}
-	
-	File result = new File(outputDirectory, orig.getName())
-	
-	if (false && result.lastModified() > orig.lastModified()) {
-		println "Skipping $text: result file is more recent: $result"
-		continue // next !
-	}
-	
-	XMLProcessor xp = new XMLProcessor(orig);
-	LocalNameHookActivator activator = new LocalNameHookActivator("w")
-	new DOMIdentityHook("word", activator, xp) {
-		@Override
-		public void processDom() {
-			//println dom
-			use(groovy.xml.dom.DOMCategory) {
-				def form = dom.form[0]
-				def anatype = dom.ana.findAll(){ a ->
-					if (debug && (a['@type'] == "#$word_property")) {
-						println 'a["@type"] = '+a["@type"]
-						println 'a.text() = '+a.text()
-						println 'a["@type"] == "#$word_property"'+" = "+(a['@type'] == "#$word_property")
-						println "values_to_ignore_regex = "+values_to_ignore_regex
-						println '!(a.text() ==~ values_to_ignore_regex))'+" = "+(!(a.text() ==~ values_to_ignore_regex))
-						println '((a["@type"] == "#$word_property") && !(a.text() ==~ values_to_ignore_regex)) = '+((a['@type'] == "#$word_property") && !(a.text() ==~ values_to_ignore_regex))
-					}
-					return ((a['@type'] == "#$word_property") && !(a.text() ==~ values_to_ignore_regex))
-				}
-//				println form.text()+" -> $anatype"
-				if (anatype.size() > 0) { // keep the word
-					anatype = anatype[0]
-					def s = form.text()
-					form.setTextContent(anatype.text())
-					anatype['@type'] = "#form"
-					anatype.setTextContent(s)
-				} else {
-					dom = null
-				}
-			}
-		}
-	}
-	xp.process(result)
-}
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 3633)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 3634)
@@ -88,11 +88,11 @@
 public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
 
 	private boolean installPreferenceRestored;
-	
+
 	private IOConsoleOutputStream stream;
-	
+
 	private IOConsoleInputStream streamInput;
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
@@ -101,14 +101,14 @@
 	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
 		return new ApplicationWorkbenchWindowAdvisor(configurer);
 	}
-	
+
 	@Override
 	public IAdaptable getDefaultPageInput() {
 		// MD test 02022023
 		//org.eclipse.core.resources.IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
 		return null;
 	}
-	
+
 	/**
 	 * initialization code done after the splash screen.
 	 *
@@ -117,21 +117,21 @@
 	@Override
 	public void initialize(IWorkbenchConfigurer configurer) {
 		org.eclipse.ui.ide.IDE.registerAdapters();
-		
+
 		PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, true);
-		
+
 		InitializeLogger();
-		
+
 		configurer.setSaveAndRestore(true);
 	}
-	
+
 	@Override
 	public void preStartup() {
-		
+
 	}
-	
-	
-	
+
+
+
 	/**
 	 * Set Eclipse Theme depending on the OS
 	 */
@@ -139,24 +139,24 @@
 	private void setDefaultTheme() {
 		Bundle b = FrameworkUtil.getBundle(getClass());
 		BundleContext context = b.getBundleContext();
-		
+
 		ServiceReference serviceRef = context.getServiceReference(IThemeManager.class.getName());
 		@SuppressWarnings("unchecked")
 		IThemeManager themeManager = (IThemeManager) context.getService(serviceRef);
 		IThemeEngine engine = themeManager.getEngineForDisplay(Display.getDefault());
-		
+
 		String theme = "org.txm.rcp.theme.default.linux"; //$NON-NLS-1$
-		
+
 		if (Util.isWindows()) {
 			theme = "org.txm.rcp.theme.default.windows"; //$NON-NLS-1$
 		}
 		else if (Util.isMac()) {
 			theme = "org.txm.rcp.theme.default.mac"; //$NON-NLS-1$
 		}
-		
+
 		engine.setTheme(theme, true);
 	}
-	
+
 	/**
 	 * initialization code done after the splash screen call a job which does the
 	 * post installation the TXMHOME, checks the TreeTagger and finally
@@ -164,19 +164,19 @@
 	 */
 	@Override
 	public void postStartup() {
-		
+
 		try {
 			// create the Toolbox initialization job
 			JobHandler jobhandler = new JobHandler(TXMUIMessages.initializationOfThePlatform, true) {
-				
+
 				@Override
 				protected IStatus run(final IProgressMonitor monitor) {
 					JobsTimer.start();
 					this.runInit(monitor);
 					try {
-						
+
 						monitor.beginTask(TXMUIMessages.startingTxm, 100);
-						
+
 						monitor.setTaskName(TXMUIMessages.loadingTXMInstallPreferences);
 						Log.fine(TXMUIMessages.startJobColonLoadInstallPreferences);
 						if (!checkInstallDirectory(this)) {
@@ -185,7 +185,7 @@
 							return Status.CANCEL_STATUS;
 						}
 						monitor.worked(10);
-						
+
 						monitor.setTaskName(TXMUIMessages.checkingForExistingWorkspaceDirectory);
 						Log.warning(TXMUIMessages.startJobColonCheckTXMHOME);
 						if (!checkTXMHOME(this, monitor)) {
@@ -194,7 +194,7 @@
 							return Status.CANCEL_STATUS;
 						}
 						monitor.worked(30);
-						
+
 						// INITIALIZE TBX AND UI
 						monitor.setTaskName(TXMUIMessages.initializingPlatform);
 						Log.warning(TXMUIMessages.startJobColonInitializeUI);
@@ -202,34 +202,41 @@
 							monitor.done();
 							return Status.CANCEL_STATUS;
 						}
-						
+
 						// CREATE THE CLOSE CONTROL FILE
 						String rootPath = Platform.getInstanceLocation().getURL().toURI().getPath();
 						File lockFile = new File(rootPath, "txm_was_not_closed_correctly.lock");
 						if (lockFile.exists()) { // the close control file was not deleted //$NON-NLS-1$
+							lockFile.delete(); //$NON-NLS-1$
 							
 							File checkupResultFile = new File(rootPath, "startup_diagnostic_"+Toolbox.dateformat.format(new Date())+".txt"); //$NON-NLS-1$ //$NON-NLS-2$
-							this.syncExec(new Runnable() {
-								@Override
-								public void run() {
-									int choice = MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL, Display.getDefault().getActiveShell(),
-											TXMUIMessages.warning, 
-											TXMUIMessages.TXMWasNotCorrectlyStopped+"\n"+NLS.bind(TXMUIMessages.DoYouWantToStartADiagnosticOfYourCorporaEtc, checkupResultFile)
-											, SWT.NONE, new String[] {TXMUIMessages.Cancel, TXMUIMessages.OK, TXMUIMessages.OKOpenTheDiagnosticFile});
-									
-									if (choice != 0) {
-										Toolbox.writeStartupCorporaDiagnostics(checkupResultFile);
+							checkupResultFile.delete();
+							try {
+								Toolbox.writeStartupCorporaDiagnostics(checkupResultFile);
+							} catch(Exception e) {e.printStackTrace();}
+							
+							if (checkupResultFile.exists()) { // ask the user only if errors have been detected 
+								this.syncExec(new Runnable() {
+									@Override
+									public void run() {
+										int choice = MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL, Display.getDefault().getActiveShell(),
+												TXMUIMessages.warning, 
+												TXMUIMessages.TXMWasNotCorrectlyStopped+"\n"+NLS.bind(TXMUIMessages.DoYouWantToStartADiagnosticOfYourCorporaEtc, checkupResultFile)
+												, SWT.NONE, new String[] {TXMUIMessages.Cancel, TXMUIMessages.OK, TXMUIMessages.OKOpenTheDiagnosticFile});
+
+										if (choice != 0) {
+
+										}
+
+										if (choice == 2) {
+											org.txm.rcp.handlers.files.EditFile.openfile(checkupResultFile);
+										}
 									}
-									
-									if (choice == 2) {
-										org.txm.rcp.handlers.files.EditFile.openfile(checkupResultFile);
-									}
-								}
-							});
-							lockFile.delete(); //$NON-NLS-1$
+								});
+							}
 						}
 						lockFile.createNewFile(); //$NON-NLS-1$
-						
+
 						Log.info(TXMUIMessages.info_txmIsReady);
 						monitor.done();
 					}
@@ -240,16 +247,16 @@
 					catch (ThreadDeath td) {
 						System.out.println(TXMUIMessages.TXMInitializationHasBeenCanceledByUserDotPleaseRestartTXM);
 					}
-					
+
 					JobsTimer.stopAndPrint();
 					return Status.OK_STATUS;
 				}
 			};
 			jobhandler.startJob();
-			
+
 			// start update NOT IN A JOB
 			startUpdateLookUpJob(false);
-			
+
 		}
 		catch (Exception e) {
 			Log.severe(TXMCoreMessages.bind(TXMUIMessages.startupFailedPleaseCheckTXMPreferencesInTheFileSupPreferencesMenuOrContactTxmusersMailingListMenuColonHelpSup, e.getMessage()));
@@ -257,11 +264,11 @@
 			Log.printStackTrace(e);
 		}
 	}
-	
+
 	public static void closeEmptyEditors(boolean closeOthersEditors) {
 		Log.fine("Closing empty editors..."); //$NON-NLS-1$
 		String REF = "org.eclipse.ui.internal.emptyEditorTab"; //$NON-NLS-1$
-		
+
 		for (final IWorkbenchPage page : SWTEditorsUtils.getPages()) {
 			ArrayList<IEditorReference> editorRefsList = new ArrayList<>();
 			for (IEditorReference editorref : page.getEditorReferences()) {
@@ -270,10 +277,10 @@
 					editorRefsList.add(editorref);
 				}
 			}
-			
+
 			final IEditorReference[] editorRefs = editorRefsList.toArray(new IEditorReference[editorRefsList.size()]);
 			Display.getDefault().syncExec(new Runnable() {
-				
+
 				@Override
 				public void run() {
 					page.closeEditors(editorRefs, false);
@@ -281,27 +288,27 @@
 			});
 		}
 	}
-	
+
 	public static String getTXMStartMessage() {
-		
+
 		String pretty_version =  getTXMVersionPrettyString();
 		return NLS.bind(TXMUIMessages.startingUpP0, pretty_version);
-		
+
 	}
-	
+
 	public static String getTXMVersion() {
 		Version version = Activator.getDefault().getBundle().getVersion();
 		return version.getMajor() + "." + version.getMinor() + "." + version.getMicro(); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-	
+
 	public static String getTXMVersionPrettyString() {
-				
+
 		Version version = getBuildVersion();
 		String build_date =  getBuildDate(version);
-		
+
 		String txm_date = getUpdateDate();
 		version = Activator.getDefault().getBundle().getVersion();
-		
+
 		if (txm_date.equals(build_date)) {
 			return (NLS.bind(TXMUIMessages.prettyVersionP0P1,
 					version.getMajor() + "." + version.getMinor() + "." + version.getMicro(), build_date)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -311,10 +318,10 @@
 					version.getMajor() + "." + version.getMinor() + "." + version.getMicro(), "install " + build_date + " - update " + txm_date)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 		}
 	}
-	
+
 	public static Version getBuildVersion() {
 		String version = null;
-		
+
 		// try finding build date from the p2 artifacts file in installation directory
 		String path = BundleUtils.getInstallDirectory();
 		if (path != null) {
@@ -349,41 +356,41 @@
 				}
 			}
 		}
-		
+
 		if (version == null) {
 			version = Activator.getDefault().getBundle().getVersion().toString();
 		}
-		
+
 		Version v2 = new Version(version);
 		return v2;
 	}
-	
+
 	public static String getBuildDate(Version version) {
 		return version.getQualifier().replaceAll("(....)(..)(..)(..)(..)", "$1-$2-$3 $4h$5"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-	
+
 	public static String getUpdateDate() {
 		Version version = Activator.getDefault().getBundle().getVersion();
 		return version.getQualifier().replaceAll("(....)(..)(..)(..)(..)", "$1-$2-$3 $4h$5"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-	
+
 	private void setPreferencesConfiguration() {
 		PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
-		
+
 		// Remove RCP Update preference page
 		if (!TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) {
 			Log.fine(TXMUIMessages.removeUnusedEclipseRCPPreferencePage);
 			pm.remove("org.eclipse.equinox.internal.p2.ui.sdk.ProvisioningPreferencePage"); //$NON-NLS-1$
-			
+
 			// Remove the Team menu
 			pm.remove("org.eclipse.team.ui.TeamPreferences"); //$NON-NLS-1$
-			
+
 			// XML
 			// pm.remove("org.eclipse.wst.xml.ui.preferences.xml"); //$NON-NLS-1$
-			
+
 			// Validation
 			// pm.remove("ValidationPreferencePage"); //$NON-NLS-1$
-			
+
 			// Debug
 			// pm.remove("org.eclipse.debug.ui.DebugPreferencePage"); //$NON-NLS-1$
 		}
@@ -400,10 +407,10 @@
 			}
 		}
 	}
-	
+
 	public void startUpdateLookUpJob(boolean updateCalledFromCommandLine) {
 		if (needToRestoreTXMHOME) return; // don't call for update for the first run of TXM
-		
+
 		try {
 			boolean doUpdate = TBXPreferences.getInstance().getBoolean(TBXPreferences.FETCH_UPDATES_AT_STARTUP);
 			if (!doUpdate) return;
@@ -411,7 +418,7 @@
 			// this.syncExec(new Runnable() {
 			// @Override
 			// public void run() {
-			
+
 			try {
 				URL url = new URL("https://gitlab.huma-num.fr/txm/txm-software/-/raw/master/dist/index.html"); //$NON-NLS-1$
 				Log.fine(TXMCoreMessages.bind("Testing if update site is available: {0}...", url)); //$NON-NLS-1$
@@ -424,11 +431,11 @@
 				doUpdate = false;
 				return;
 			}
-			
+
 			Log.info(TXMUIMessages.startingUpdateFetch);
-			
+
 			Display.getDefault().syncExec(new Runnable() {
-				
+
 				@Override
 				public void run() {
 					IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
@@ -456,10 +463,10 @@
 			System.out.println(TXMUIMessages.updateCanceled);
 		}
 	}
-	
+
 	public static boolean testTXMHOMEPreferenceAndDirectory() {
 		String path = Toolbox.getTxmHomePath();
-		
+
 		if (path == null || path.trim().equals("")) { //$NON-NLS-1$
 			Log.warning(TXMCoreMessages.bind(TXMUIMessages.TXMUserDirectoryIsNotSetP0PreferenceIsNotSet, TBXPreferences.USER_TXM_HOME));
 			return true;
@@ -477,17 +484,17 @@
 			Log.warning(TXMCoreMessages.bind(TXMUIMessages.TXMUserDirectoryIsSetToP0ButTXMCantCdInThisDirectory, dir));
 			return true;
 		}
-		
+
 		return false;
 	}
-	
+
 	public static boolean testTXMINSTALLPreferenceAndDirectory() {
 		// TxmPreferences.dump();
 		if (Toolbox.getInstallDirectory() == null) {
 			Log.warning(TXMCoreMessages.bind(TXMUIMessages.TXMInstallDirectoryIsNotSetP0PreferenceIsNotSet, TBXPreferences.INSTALL_DIR));
 			return true;
 		}
-		
+
 		File installdir = new File(Toolbox.getInstallDirectory().trim());
 		if (Toolbox.getInstallDirectory().equals("")) { //$NON-NLS-1$
 			Log.warning(TXMUIMessages.TXMInstallDirectoryIsSetToQuoteQuote);
@@ -507,21 +514,21 @@
 		}
 		return false;
 	}
-	
+
 	/**
 	 * shutdown code.
 	 */
 	@Override
 	public void postShutdown() {
 		callPreStopScript();
-		
+
 		Toolbox.shutdown();
-		
+
 		callStopScript();
-		
+
 		new File("txm_was_not_closed_correctly.lock").delete(); //$NON-NLS-1$
 	}
-	
+
 	/**
 	 * shutdown code.
 	 */
@@ -533,13 +540,13 @@
 		catch (Exception e) {
 			e.printStackTrace();
 		}
-		
+
 		return continueShutDownForPersistedResults();
 	}
-	
+
 	private boolean continueShutDownForPersistedResults() {
 		if (Toolbox.workspace == null) return true; // nothing to do
-		
+
 		StringBuffer messages = new StringBuffer();
 		for (Project project : Toolbox.workspace.getProjects()) {
 			ArrayList<String> bugs = new ArrayList<>();
@@ -552,13 +559,13 @@
 				messages.append("- " + project.getName() + ": " + bugs + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 			}
 		}
-		
+
 		if (messages.length() > 0) {
 			return MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "", NLS.bind(TXMUIMessages.warning_popup_editedResultsWillBelostP0, messages)); //$NON-NLS-1$
 		}
 		return true;
 	}
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId()
@@ -567,14 +574,14 @@
 	public String getInitialWindowPerspectiveId() {
 		return TXMPerspective.ID;
 	}
-	
+
 	/**
 	 * initialize TXM log in console by redirecting stderr and stdout.
 	 */
 	private void InitializeLogger() {
 		IOConsole console = new IOConsole(TXMUIMessages.systemOutput, null);
 		ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
-		
+
 		// Enable or disable the outputs redirection to the RCP console according to the command line argument "-noredirection"
 		boolean outputsRedirection = true;
 		String[] args = Platform.getCommandLineArgs();
@@ -587,18 +594,18 @@
 		if (outputsRedirection) {
 			stream = console.newOutputStream();
 			streamInput = console.getInputStream();
-			
+
 			System.setOut(new PrintStream(stream));
 			System.setErr(new PrintStream(stream));
 			System.setIn(streamInput);
 		}
 		// System.out.println(Messages.ApplicationWorkbenchAdvisor_3);
 	}
-	
+
 	public void setConsoleOutputColor(Color newColor) {
 		if (stream != null) stream.setColor(newColor);
 	}
-	
+
 	/**
 	 * if INSTALLDIR preference is not set or empty, read the install.prefs file and set the
 	 *
@@ -617,14 +624,14 @@
 			boolean needTosetInstallPreference = testTXMINSTALLPreferenceAndDirectory();
 			// check if the install preference file has been loaded
 			if (needTosetInstallPreference) {
-				
+
 				installPreferenceRestored = false; // reset and finally set true if the process ended correctly
-				
+
 				// set the install directory preference
 				String installpath = Platform.getInstallLocation().getURL().getFile(); // the TXM.exe file path
 				File installDirectory = new File(installpath);
 				// installDirectory = installDirectory.getCanonicalFile();
-				
+
 				// TODO: ensure all preferences of install.prefs file are now stored in the default preferences
 				// File preferenceFile = new File(installDirectory, "install.prefs"); //$NON-NLS-1$
 				// if (preferenceFile.exists()) {
@@ -660,14 +667,14 @@
 				// }
 				// }
 				// }
-				
+
 				installPreferenceRestored = true;
-				
+
 				if (installDirectory == null || !installDirectory.exists()) {
 					Log.severe(TXMUIMessages.errorTheProvidedInstallDirectoryDoesNotExistAborting);
 					return false;
 				}
-				
+
 				TBXPreferences.getInstance().put(TBXPreferences.INSTALL_DIR, installDirectory.getAbsolutePath());
 				TBXPreferences.getInstance().flush();
 				return true;
@@ -680,17 +687,17 @@
 		}
 		return true;
 	}
-	
+
 	boolean go = false;
-	
+
 	File backup;
-	
+
 	File oldbackup;
-	
+
 	File errorbackup;
-	
+
 	File corporaDir;
-	
+
 	/**
 	 * if TXMHOME path is not set or wrong
 	 * - set default theme
@@ -701,114 +708,114 @@
 	 *
 	 */
 	private static boolean needToRestoreTXMHOME;
-	
+
 	public static boolean getWasFirstLaunch() {
 		return needToRestoreTXMHOME;
 	}
-	
+
 	File txmhomedir = null;
-	
+
 	File installDirectory = null;
-	
+
 	private Handler severeDialobBoxHandler = new Handler() {
-		
+
 		@Override
 		public void publish(final LogRecord record) {
 			// System.out.println("severeDialobBoxHandler.publish()");
 			boolean showSevereDialobBox = RCPPreferences.getInstance().getBoolean(RCPPreferences.SHOW_SEVERE_DIALOG);
 			if (showSevereDialobBox) {
 				if (record.getLevel() != Level.SEVERE) return;
-				
+
 				final IWorkbench w = PlatformUI.getWorkbench();
 				if (w == null) {
 					//System.out.println("no workbench"); //$NON-NLS-1$
 					return;
 				}
-				
+
 				w.getDisplay().syncExec(new Runnable() {
-					
+
 					@Override
 					public void run() {
-//						try {
-//							IWorkbenchWindow aww = w.getActiveWorkbenchWindow();
-//							if (aww == null) {
-//								System.out.println(TXMUIMessages.noActiveWorkbenchWindow);
-//								return;
-//							}
-//							IWorkbenchPage page = aww.getActivePage();
-//							if (page == null) {
-//								System.out.println(TXMUIMessages.noActivePage);
-//								return;
-//							}
-//							IViewPart view = page.findView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
-//							if (view == null) {
-//								view = page.showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
-//							}
-//						}
-//						catch (Exception e1) {
-//							System.out.println(TXMUIMessages.partInitializationErrorColon + e1);
-//							e1.printStackTrace();
-//							return;
-//						}
+						//						try {
+						//							IWorkbenchWindow aww = w.getActiveWorkbenchWindow();
+						//							if (aww == null) {
+						//								System.out.println(TXMUIMessages.noActiveWorkbenchWindow);
+						//								return;
+						//							}
+						//							IWorkbenchPage page = aww.getActivePage();
+						//							if (page == null) {
+						//								System.out.println(TXMUIMessages.noActivePage);
+						//								return;
+						//							}
+						//							IViewPart view = page.findView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
+						//							if (view == null) {
+						//								view = page.showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
+						//							}
+						//						}
+						//						catch (Exception e1) {
+						//							System.out.println(TXMUIMessages.partInitializationErrorColon + e1);
+						//							e1.printStackTrace();
+						//							return;
+						//						}
 						MessageDialog.openError(w.getDisplay().getActiveShell(), "Error", record.getMessage());
 					}
 				});
-				
-//				IStatus s = new Status(Status.ERROR, Application.PLUGIN_ID, Status.OK, record.getMessage(), null);
-//				StatusManager.getManager().handle(s, StatusManager.LOG);
+
+				//				IStatus s = new Status(Status.ERROR, Application.PLUGIN_ID, Status.OK, record.getMessage(), null);
+				//				StatusManager.getManager().handle(s, StatusManager.LOG);
 			}
 		}
-		
+
 		@Override
 		public void flush() {}
-		
+
 		@Override
 		public void close() throws SecurityException {}
 	};
-	
+
 	/**
 	 * internal variable to know if the txm home directory has been created
 	 */
 	private boolean txmHomeRestored;
-	
+
 	{
 		Log.addHandler(severeDialobBoxHandler);
 		severeDialobBoxHandler.setLevel(Level.SEVERE);
 	}
-	
+
 	private boolean checkTXMHOME(JobHandler jobHandler, IProgressMonitor monitor) {
 		txmhomedir = null;
 		installDirectory = null;
-		
+
 		// check if TXMHOME of the user is set and exists
 		needToRestoreTXMHOME = testTXMHOMEPreferenceAndDirectory();
 		Log.fine("needToRestoreTXMHOME=" + needToRestoreTXMHOME + " installPreferenceRestored=" + installPreferenceRestored); //$NON-NLS-1$ //$NON-NLS-2$
 		if (needToRestoreTXMHOME || installPreferenceRestored) {
-			
+
 			System.out.println(TXMUIMessages.creatingTXMUserWorkingDirectory);
-			
+
 			try {
 				Log.info(NLS.bind(TXMUIMessages.installPathColonP0, Toolbox.getInstallDirectory()));
-				
+
 				//MD test 02022023
 				//txmhomedir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getCanonicalFile();
 				txmhomedir = Platform.getLocation().toFile().getCanonicalFile();
 				txmhomedir.mkdirs(); // creates the directory if needed
-				
+
 				txmhomedir.mkdirs(); // creates the directory if needed
-				
+
 				if (!txmhomedir.exists()) {
 					Log.severe(TXMCoreMessages.bind(TXMUIMessages.errorTheProvidedTXMHOMEDirectoryDoesNotExistsP0Aborting, txmhomedir));
 					return false;
 				}
-				
+
 				// save preference if USER_TXM_HOME has changed
 				TBXPreferences.getInstance().put(TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath());
 				TBXPreferences.getInstance().flush();
 				// TXMPreferences.saveAll();
-				
+
 				Log.info(TXMCoreMessages.bind(TXMUIMessages.TXMUserDirectoryIsSetToP0, txmhomedir));
-				
+
 				txmHomeRestored = true;
 			}
 			catch (Exception e) {
@@ -817,12 +824,12 @@
 				Log.severe(TXMCoreMessages.bind(TXMUIMessages.failedToBackupExistingCorporaColon, e.getLocalizedMessage()));
 				return false;
 			}
-			
+
 		} // end if
-		
+
 		return true;
 	}
-	
+
 	/**
 	 * Install the sample corpora and previous TXM version corpora in TXM corpora directory
 	 * 
@@ -836,12 +843,12 @@
 		// return; // dev mode
 		// }
 		monitor.setTaskName(TXMUIMessages.restoringCorpora);
-		
+
 		RecoverCorporaFromInstalls.restore(true);
-		
+
 		try {
 			Display.getDefault().syncExec(new Runnable() {
-				
+
 				@Override
 				public void run() {
 					OpenWelcomePage.openWelcomePage();
@@ -851,7 +858,7 @@
 		catch (Exception e2) {
 			try {
 				Display.getCurrent().syncExec(new Runnable() {
-					
+
 					@Override
 					public void run() {
 						OpenWelcomePage.openWelcomePage();
@@ -864,10 +871,10 @@
 				} catch (Exception e4) { }
 			}
 		}
-		
+
 		monitor.setTaskName(""); //$NON-NLS-1$
 	}
-	
+
 	/**
 	 * Executes the specified Groovy script file.
 	 * 
@@ -884,38 +891,38 @@
 			Log.printStackTrace(e);
 		}
 	}
-	
-	
+
+
 	/**
 	 * Called just before the Toolbox is initialized
 	 */
 	private void callPreStartScript() {
 		this.callGroovyScript(new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/prestart.groovy")); //$NON-NLS-1$
 	}
-	
+
 	/**
 	 * Called just after Toolbox is initialized
 	 */
 	private void callStartScript() {
 		this.callGroovyScript(new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/start.groovy")); //$NON-NLS-1$
 	}
-	
+
 	/**
 	 * Called just before Toolbox is stop call
 	 */
 	private void callPreStopScript() {
 		this.callGroovyScript(new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/prestop.groovy")); //$NON-NLS-1$
 	}
-	
+
 	/**
 	 * Called just after Toolbox is stop call
 	 */
 	private void callStopScript() {
 		this.callGroovyScript(new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/stop.groovy")); //$NON-NLS-1$
 	}
-	
+
 	ProgressMonitorDialog initializeUIPMD; // store the state of the initializeUI step
-	
+
 	/**
 	 * after TXMHOME AND INSTALLDIR are ok, we can start the Toolbox
 	 * <p>
@@ -932,36 +939,36 @@
 	 * @throws Exception
 	 */
 	private boolean initializeUI(final JobHandler jobHandler) throws Exception {
-		
+
 		// Fix the freeze at splash screen on Mac OS X/Cocoa because of a deadlock between AWT/SWT threads (bug #894)
 		Display.getDefault().syncExec(new Runnable() {
-			
+
 			@Override
 			public void run() {
 				try {
 					System.out.println(getTXMStartMessage());
-					
+
 					// ensure some preferences are set
 					DefaultScope.INSTANCE.getNode("org.eclipse.ui.workbench").putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, false); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$
 					DefaultScope.INSTANCE.getNode("org.eclipse.ui.workbench").flush(); //$NON-NLS-1$
 					BundleDefaultsScope.INSTANCE.getNode("org.eclipse.ui.workbench").putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, false); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$
 					BundleDefaultsScope.INSTANCE.getNode("org.eclipse.ui.workbench").flush(); //$NON-NLS-1$
-					
+
 					WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RUN_IN_BACKGROUND, false);
 					WorkbenchPlugin.getDefault().getPreferenceStore().setDefault(IPreferenceConstants.RUN_IN_BACKGROUND, false);
 					WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.WORKBENCH_SAVE_INTERVAL, 30);
 					WorkbenchPlugin.getDefault().getPreferenceStore().setDefault(IPreferenceConstants.WORKBENCH_SAVE_INTERVAL, 30);
-					
+
 					jobHandler.setTaskName(TXMUIMessages.setDefaultTheme);
 					setDefaultTheme();
-					
+
 					// CLOSE Empty&Error editors
 					jobHandler.setTaskName(TXMUIMessages.closingEmptyEditors);
 					closeEmptyEditors(false);
-					
+
 					// remove some preference pages
 					setPreferencesConfiguration();
-					
+
 					initializeUIPMD = new ProgressMonitorDialog(Display.getDefault().getActiveShell()) {
 						@Override
 						protected void configureShell(final Shell shell) {
@@ -969,20 +976,20 @@
 							shell.setText(getTXMStartMessage());
 						}
 					};
-					
+
 					initializeUIPMD.run(true, true, new IRunnableWithProgress() {
-						
+
 						@Override
 						public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-							
+
 							if (!Toolbox.isInitialized()) {
 								try {
 									monitor.worked(1);
-									
+
 									monitor.setTaskName(TXMUIMessages.callingGroovyPrestartScript);
 									callPreStartScript();
 									monitor.worked(20);
-									
+
 									monitor.setTaskName(TXMUIMessages.initializingToolboxEnginesAndCorpora);
 									if (Toolbox.initialize(TBXPreferences.class, monitor)) {
 										// StatusLine.setMessage(TXMUIMessages.ready);
@@ -990,25 +997,25 @@
 									else {
 										StatusLine.setMessage(TXMUIMessages.startupFailedPleaseCheckTXMPreferencesInTheFileSupPreferencesMenuOrContactTxmusersMailingListMenuColonHelpSup);
 										Log.severe(TXMUIMessages.startupFailedPleaseCheckTXMPreferencesInTheFileSupPreferencesMenuOrContactTxmusersMailingListMenuColonHelpSup);
-										
+
 										monitor.done();
 										return;
 									}
 									monitor.worked(20);
-									
+
 									monitor.setTaskName(TXMUIMessages.callingGroovyStartScript);
 									callStartScript();
 									monitor.worked(20);
-									
+
 									// restore corpora if TXMHOME has been created
 									if (txmHomeRestored) {
 										installCorporaDirectory(monitor);
-										
+
 										Toolbox.workspace.saveParameters(true);
 										ResourcesPlugin.getWorkspace().save(true, null);
 									}
 									monitor.worked(20);
-									
+
 									jobHandler.setTaskName(TXMUIMessages.toolboxReady);
 								}
 								catch (Throwable e) {
@@ -1016,14 +1023,14 @@
 									e.printStackTrace();
 								}
 							}
-							
+
 							monitor.done();
 						}
 					});
-					
+
 					Log.fine(TXMUIMessages.loadingViews);
 					RestartTXM.reloadViews(); // reload views
-					
+
 				}
 				catch (Exception e) {
 					Log.severe(TXMCoreMessages.bind(TXMUIMessages.errorDuringUIInitializationP0, e.getLocalizedMessage()));
@@ -1031,7 +1038,7 @@
 				}
 			}
 		});
-		
+
 		jobHandler.setTaskName(""); //$NON-NLS-1$ s
 		// TxmPreferences.dump();
 		return initializeUIPMD != null && !initializeUIPMD.getProgressMonitor().isCanceled();
