Index: tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GSERunner.java
===================================================================
--- tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GSERunner.java	(revision 1884)
+++ tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GSERunner.java	(revision 1885)
@@ -64,10 +64,7 @@
 //			}
 			return defaultGSE;
 		}
-		
-		if (rootDir == null) {
-			rootDir = new File(Toolbox.getTxmHomePath(), "scripts/groovy/");
-		}
+
 		String[] roots = new String[] { 
 				rootDir.getAbsolutePath()+"/user/", //$NON-NLS-1$
 				rootDir.getAbsolutePath()+"/system/", //$NON-NLS-1$
Index: tmp/org.txm.rcp/icons/logo/TXM_flat_logo.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

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

Index: tmp/org.txm.rcp/rcpapplication.product
===================================================================
--- tmp/org.txm.rcp/rcpapplication.product	(revision 1884)
+++ tmp/org.txm.rcp/rcpapplication.product	(revision 1885)
@@ -318,6 +318,7 @@
       <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
       <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
       <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+      <property name="osgi.instance.area" value="@noDefault" />
    </configurations>
 
    <preferencesInfo>
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/ImportDialog.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/ImportDialog.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/ImportDialog.java	(revision 1885)
@@ -174,12 +174,10 @@
 			Label dirLabel = new Label(mainPanel, SWT.NONE);
 			dirLabel.setText(TXMUIMessages.sourceDirectoryColon);
 			dirLabel.setAlignment(SWT.CENTER);
-			dirLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-					false, false));
+			dirLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
 
 			dirValue = new Text(mainPanel, SWT.SINGLE | SWT.BORDER);
-			dirValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-					true, false));
+			dirValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
 			if (lastopenedbase != null)
 				dirValue.setText(lastopenedbase.getPath());
 
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1885)
@@ -775,7 +775,7 @@
 
 sVGGraphic = Graphique SVG 
 
-sampleCorporaOfCurrentTXMP0 = Corpus d'exemple de la version courante de TXM {0}
+sampleCorporaOfCurrentTXMP0 = Corpus exemples de la version courante de TXM {0}
 
 saveAndRun = Sauver et lancer
 
@@ -893,7 +893,7 @@
 
 tXMiniColon = TXM.ini : 
 
-termsOfService = Veuillez    accepter la licence d'utilisation
+termsOfService = Veuillez accepter la licence d'utilisation
 
 textEditorColonP0EncodingFoundP1 = Editeur de Texte: l'encodage de {0} est {1}
 
@@ -907,7 +907,7 @@
 
 theCorpusAndTheCorpusP0WillBeDeleted = Le corpus {0} va être supprimé.
 
-theErrorIsColon = L'erreur est :  
+theErrorIsColon = L'erreur est : 
 
 theFileP0DoesNotExist = Le fichier {0} est introuvable.
 
@@ -992,4 +992,12 @@
 
 importDone=Import terminé.
 
-updateDone=Mise à jour terminée.
\ No newline at end of file
+updateDone=Mise à jour terminée.
+
+TXMisDistributedUnderLicence=TXM est diffusé sous licence 
+gnuLicenceLink=https://www.gnu.org/licenses/gpl-2.0.fr.html
+gnuLicenceName=GNU General Public License version 2
+iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork=J'accepte les termes de la licence et je m'engage à citer TXM dans mes publications
+seeTheQuoteSectionIn=(voir la section 'Citer le logiciel TXM' de la page d'accueil du site 
+selectWorkingDirectoryP0=Répertoire de travail
+options=Options...
\ No newline at end of file
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java	(revision 1885)
@@ -525,6 +525,18 @@
 	
 	public static String updateDone;
 
+	public static String gnuLicenceLink;
+
+	public static String gnuLicenceName;
+
+	public static String iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork;
+
+	public static String seeTheQuoteSectionIn;
+
+	public static String TXMisDistributedUnderLicence;
+
+	public static String selectWorkingDirectoryP0;
+	
 	static {
 		// initialize resource bundle
 		Utf8NLS.initializeMessages(BUNDLE_NAME, TXMUIMessages.class);
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1885)
@@ -996,4 +996,12 @@
 
 importDone=Import done.
 
-updateDone=Update done.
\ No newline at end of file
+updateDone=Update done.
+
+TXMisDistributedUnderLicence=TXM is released under the 
+gnuLicenceLink=https://www.gnu.org/licenses/gpl-2.0.en.html
+gnuLicenceName=GNU General Public License version 2
+iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork=I accept TXM license terms and I accept to quote TXM in my publications.
+seeTheQuoteSectionIn=(see the "How to Cite the Textometry project" section in the textometrie.org web site: 
+selectWorkingDirectoryP0=Working directory
+options=Options...
\ No newline at end of file
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 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/IImageKeys.java	(revision 1885)
@@ -225,6 +225,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";
 
+	public static final String TXM_FLAT_LOGO = "icons/logo/TXM_flat_logo.png";
+
 	/**
 	 * Gets the image.
 	 *
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/Activator.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/Activator.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/Activator.java	(revision 1885)
@@ -65,15 +65,15 @@
 		super.start(context);
 
 		System.out.println("TXM ACTIVATED. ALL SYSTEMS GO!");
-		try {
-			preventbrokenTXMINI();
-		} catch(Exception e) {
-			System.out.println("Error while fixing TXM.ini file: "+e.getLocalizedMessage());
-		}
+//		try {
+//			preventBrokenTXMINI();
+//		} catch(Exception e) {
+//			System.out.println("Error while fixing TXM.ini file: "+e);
+//		}
 	}
 
 	//TODO: this method is temporary to fix the TXM.ini file -startup and --launcher.library properties
-	private void preventbrokenTXMINI() throws Exception {
+	private void preventBrokenTXMINI() throws Exception {
 		
 		File dataDir = new File(Platform.getInstanceLocation().getURL().getFile());
 		File txmDir = dataDir.getParentFile();
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java	(revision 1885)
@@ -0,0 +1,60 @@
+package org.txm.rcp.swt;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class SelectDirectoryWidget extends GLComposite {
+
+	Text t;
+	String path;
+	
+	public SelectDirectoryWidget(Composite parent, int style, String initialDefault, String label) {
+		super(parent, style, "CGU");
+		this.path = initialDefault;
+		
+		this.getLayout().numColumns = 2;
+		this.getLayout().marginBottom = 2;
+		this.getLayout().horizontalSpacing = 4;
+		if (label != null) {
+			this.getLayout().numColumns = this.getLayout().numColumns + 1;
+			
+			new Label(this, SWT.NONE).setText(label);
+		}
+		
+		t = new Text(this, SWT.BORDER);
+		t.setText(initialDefault);
+		t.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+		Button selectDirectoryButton = new Button(this, SWT.PUSH);
+		selectDirectoryButton.setText("...");
+		selectDirectoryButton.addSelectionListener(new SelectionListener() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				
+				DirectoryDialog dialog = new DirectoryDialog(e.display.getActiveShell());
+				dialog.setMessage("Select working directory");
+				dialog.setText(t.getText());
+				String tpath = dialog.open();
+				if (tpath != null) {
+					t.setText(tpath);
+					path = tpath;
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+	}
+	
+	public String getPath() {
+		return path;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/SelectDirectoryWidget.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/CGUMessageDialog.java	(revision 1885)
@@ -1,7 +1,12 @@
 package org.txm.rcp.swt.dialog;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
@@ -10,60 +15,86 @@
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Cursor;
 import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ExpandBar;
+import org.eclipse.swt.widgets.ExpandItem;
+import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.commands.OpenBrowser;
 import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.SelectDirectoryWidget;
 
 public class CGUMessageDialog extends Dialog {
 
 	boolean checked = false;
 
 	Button checkMessageButton = null;
+	ChooseWorkspaceData launchData;
 
-	protected CGUMessageDialog(Shell shell) {
+	private SelectDirectoryWidget w;
+	 
+	protected CGUMessageDialog(Shell shell, ChooseWorkspaceData launchData) {
 		super(shell);
+		this.launchData = launchData;
 	}
 
 	protected void configureShell(Shell newShell) {
 		super.configureShell(newShell);
-		newShell.setText(TXMUIMessages.termsOfService);
-
+		newShell.setText("Premier lancement de TXM/First launch of TXM");
 	}
 
 	@Override
 	protected Control createDialogArea(Composite parent) {
 		Control c = super.createDialogArea(parent);
 
+		GridLayout parentLayout = (GridLayout) parent.getLayout();
+		parentLayout.marginLeft = 5;
+		parentLayout.marginRight = 5;
 		Display display = Display.getCurrent();
 
 		//new Label(messageComposite, SWT.NONE).setImage(IImageKeys.getImage(IImageKeys.TXM_ICON));
 		Label logo = new Label(parent, SWT.NONE);
-		logo.setImage(IImageKeys.getImage(IImageKeys.TXM_ICON));//new Image(display, "/home/mdecorde/workspace047/org.txm.rcp/icons/logo/TXM_logo_64x64.png"));
+		logo.setImage(IImageKeys.getImage(IImageKeys.TXM_FLAT_LOGO));//new Image(display, "/home/mdecorde/workspace047/org.txm.rcp/icons/logo/TXM_logo_64x64.png"));
 		logo.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
+		
+		new Label(parent, SWT.NONE);
+		
+		Composite licenceGroup = new Composite(parent, SWT.NONE);
+		//licenceGroup.setText("Licence d'utilisation/Licence agreement");
+		licenceGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		GridLayout glayout = new GridLayout(1, true);
+		glayout.verticalSpacing = 0;
+		licenceGroup.setLayout(glayout);
 
-		Composite messageComposite = new Composite(parent, SWT.NONE);
+		Composite messageComposite = new Composite(licenceGroup, SWT.NONE);
 		messageComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
 		messageComposite.setLayout(new RowLayout());
+		
+		new Label(messageComposite, SWT.NONE).setText(TXMUIMessages.TXMisDistributedUnderLicence);
 
-
-		new Label(messageComposite, SWT.NONE).setText("TXM est diffusé sous licence ");
-
-		final String gnuLicenseLink = "https://www.gnu.org/licenses/gpl-2.0.en.html"; //$NON-NLS-1$
+		final String gnuLicenseLink = TXMUIMessages.gnuLicenceLink;
 		Label gnuLicense = new Label(messageComposite, SWT.NONE);
-		gnuLicense.setText("GNU GPL 2");
+		gnuLicense.setText(TXMUIMessages.gnuLicenceName); // GNU GPL 2
 		gnuLicense.setToolTipText(gnuLicenseLink);
 		gnuLicense.addMouseListener(new MouseListener() {
 
 			@Override
 			public void mouseUp(MouseEvent e) { 
-				OpenBrowser.openExternalBrowser(gnuLicenseLink);
+				//OpenBrowser.openExternalBrowser(gnuLicenseLink);
+				try {
+					java.awt.Desktop.getDesktop().browse(new URI(gnuLicenseLink));
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
 			}
 
 			@Override
@@ -78,10 +109,8 @@
 		gnuLicense.setForeground(blue);
 		gnuLicense.setCursor(cursor);
 
-		new Label(parent, SWT.NONE);
-
-		checkMessageButton = new Button(parent, SWT.CHECK);
-		checkMessageButton.setText("J'accepte la licence et je m'engage à citer TXM dans mes travaux de recherche.");
+		checkMessageButton = new Button(licenceGroup, SWT.CHECK);
+		checkMessageButton.setText(TXMUIMessages.iAcceptTheLicenceAndAgreeToQuoteTXMInMyWork);
 		checkMessageButton.addSelectionListener(new SelectionListener() {
 
 			@Override
@@ -93,16 +122,15 @@
 			public void widgetDefaultSelected(SelectionEvent e) { }
 		});
 
-		Composite seeComposite = new Composite(parent, SWT.NONE);
+		Composite seeComposite = new Composite(licenceGroup, SWT.NONE);
 		seeComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
 		seeComposite.setLayout(new RowLayout());
 
-		new Label(seeComposite, SWT.NONE).setText("Voir la section 'Citation de TXM' de la page de ");
-
+		new Label(seeComposite, SWT.NONE).setText(TXMUIMessages.seeTheQuoteSectionIn);
 		
-		final String txmDownloadLink = "http://textometrie.ens-lyon.fr/spip.php?rubrique61"; //$NON-NLS-1$
+		final String txmDownloadLink = "http://www.textometrie.org"; //$NON-NLS-1$
 		Label txmDownload = new Label(seeComposite, SWT.NONE);
-		txmDownload.setText("Téléchargement");
+		txmDownload.setText("http://www.textometrie.org");
 		txmDownload.setToolTipText(txmDownloadLink);
 		txmDownload.setForeground(blue);
 		txmDownload.setCursor(cursor);
@@ -110,7 +138,12 @@
 
 			@Override
 			public void mouseUp(MouseEvent e) {
-				OpenBrowser.openExternalBrowser(txmDownloadLink);
+				//OpenBrowser.openExternalBrowser(txmDownloadLink);
+				try {
+					java.awt.Desktop.getDesktop().browse(new URI(txmDownloadLink));
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
 			}
 
 			@Override
@@ -120,6 +153,31 @@
 			public void mouseDoubleClick(MouseEvent e) { }
 		});
 
+		new Label(seeComposite, SWT.NONE).setText(")"); //$NON-NLS-1$
+		
+		ExpandBar bar = new ExpandBar (parent, SWT.V_SCROLL);
+		GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
+		bar.setLayoutData(gdata);
+		
+		w = new SelectDirectoryWidget(bar, SWT.NONE, launchData.getInitialDefault(), TXMUIMessages.selectWorkingDirectoryP0);
+		//w.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
+		
+		// "Options"
+		ExpandItem item1 = new ExpandItem (bar, SWT.NONE);
+		item1.setText("Options...");
+		item1.setHeight(w.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
+		item1.setControl(w);
+		item1.setExpanded(false);
+		gdata.heightHint = item1.getHeight()*2;
+		gdata.minimumHeight = item1.getHeight();
+		//item1.setExpanded(false);
+//		Group dirGroup = new Group(parent, SWT.NONE);
+//		dirGroup.setText(NLS.bind(TXMUIMessages.selectWorkingDirectoryP0, launchData.getInitialDefault())); 
+//		dirGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+//		dirGroup.setLayout(new GridLayout(1, true));
+//		
+		
+		
 		return c;
 	}
 
@@ -137,6 +195,7 @@
 	@Override
 	protected void buttonPressed(int buttonId) {
 		checked = checkMessageButton.getSelection();
+		launchData.workspaceSelected(w.getPath());
 		super.buttonPressed(buttonId);
 	}
 
@@ -146,22 +205,20 @@
 
 		return checked;
 	}
-	
-	
 
 	public static void main(String[] args) {
-		CGUMessageDialog dialog = new CGUMessageDialog(Display.getDefault().getActiveShell());
-		/**
-		 * CGUMessageDialog dialog = new CGUMessageDialog(Display.getCurrent().getActiveShell(), 
-					TXMUIMessages.termsOfService, 
-					IImageKeys.getImage(IImageKeys.TXM_ICON), 
-					TXMUIMessages.infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt,
-					IImageKeys.getImage(IImageKeys.TXM), 
-					TXMUIMessages.iAcceptTheLicenceAndIUndertakeToCiteTXMForAcknowledgingMyUseOfTXMInMyResearchWorkSeeTheCitationSectionOfTheInfhttpColontextometrieenslyonfrspipphprubrique61SupPage, 
-					dialogButtonLabels, 0) {
-			};
-		 */
-		dialog.open();
+//		CGUMessageDialog dialog = new CGUMessageDialog(Display.getDefault().getActiveShell());
+//		/**
+//		 * CGUMessageDialog dialog = new CGUMessageDialog(Display.getCurrent().getActiveShell(), 
+//					TXMUIMessages.termsOfService, 
+//					IImageKeys.getImage(IImageKeys.TXM_ICON), 
+//					TXMUIMessages.infpSupTXMIsPublishedUnderTheGNUGPL2LicenseAmpltInfaHrefEqualshttpsColonwwwgnuorglicensesgpl20enhtmlSuphttpsColonwwwgnuorglicensesgpl20enhtmlInfaSupAmpgt,
+//					IImageKeys.getImage(IImageKeys.TXM), 
+//					TXMUIMessages.iAcceptTheLicenceAndIUndertakeToCiteTXMForAcknowledgingMyUseOfTXMInMyResearchWorkSeeTheCitationSectionOfTheInfhttpColontextometrieenslyonfrspipphprubrique61SupPage, 
+//					dialogButtonLabels, 0) {
+//			};
+//		 */
+//		dialog.open();
 	}
 
 	//	protected Control createMessageArea(Composite composite) {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java	(revision 1885)
@@ -0,0 +1,128 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.rcp.commands;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
+import org.txm.Toolbox;
+import org.txm.rcp.Application;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.SummaryView;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * restart TXM: restart searchengine, statengine, workspace... 
+ * @author mdecorde
+ * 
+ */
+public class ChangeTXMWorkspace extends AbstractHandler {
+
+	/** The ID. */
+	static public String ID = "org.txm.rcp.commands.RestartTXM"; //$NON-NLS-1$
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		JobHandler jobhandler = new JobHandler("Changing working directory...") { 
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				JobsTimer.start();
+				try {
+
+					monitor.worked(95);
+					syncExec(new Runnable() {
+						@Override
+						public void run() {
+							change();
+						}
+					});
+
+				} catch (Exception e) {
+					System.out.println(NLS.bind(TXMUIMessages.errorWhileRunningScriptColonP0, e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				} finally {
+					monitor.done();
+				}
+				JobsTimer.stopAndPrint();
+				return Status.OK_STATUS;
+			}
+		};
+		jobhandler.startJob();
+		return event;
+	}
+
+	public static boolean change() {
+		
+		ChooseWorkspaceData launchData = new ChooseWorkspaceData("");
+		ChooseWorkspaceDialog dialog =
+				new ChooseWorkspaceDialog(Display.getCurrent().getActiveShell(), launchData, true, true);
+		dialog.setTitle("Select TXM working directory to use. This will restart TXM.");
+		// don't force prompt : setShowDialogValue is set on error
+		dialog.prompt(true);
+
+		// check choosen path
+		String selWS = launchData.getSelection();
+		if (selWS == null)
+			return false;// user cancelled (no restart)
+
+		// Switch workspace :
+		URL url = null;
+		try {
+			url = new URL("file", "", selWS);
+			launchData.writePersistedData();
+			ChooseWorkspaceData.setShowDialogValue(false);
+			PlatformUI.getWorkbench().restart(); // need to restart TXM to apply changes
+		} catch (MalformedURLException e1) {
+			Log.warning("Workspace path could not be found.");
+			return false;
+		}
+		
+		return false;
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ChangeTXMWorkspace.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 1885)
@@ -189,29 +189,6 @@
 		engine.setTheme(theme, true);
 	}
 
-	private void openCGU() {
-		try {
-			if (!TBXPreferences.getInstance().getBoolean(RCPPreferences.CGU)) {
-
-				//System.out.println("Opening CGU...");
-				//Display.getCurrent() works because this code is run during the splash screen
-				//String[] dialogButtonLabels = {TXMCoreMessages.common_ok, TXMCoreMessages.common_cancel};
-				CGUMessageDialog dialog = new CGUMessageDialog(Display.getCurrent().getActiveShell()) {
-				};
-				boolean ret = (dialog.open() == MessageDialog.OK) && dialog.hasCheckBeenPressed();
-				if (ret) {
-					TBXPreferences.getInstance().put(RCPPreferences.CGU, true);
-				} else {
-					System.exit(0);
-				}
-			}
-		} catch(Exception e) {
-			Log.severe("Error: can't open CGU dialog: "+e);
-			Log.printStackTrace(e);
-			System.exit(0);
-		}
-	}
-
 	/**
 	 * initialization code done after the splash screen call a job which does the
 	 * post installation the TXMHOME, checks the TreeTagger and finally
@@ -229,15 +206,6 @@
 					this.runInit(monitor);
 					try {
 
-						// CGU popup
-						this.syncExec(new Runnable() {
-							@Override
-							public void run() {
-								openCGU();
-								printTXMVersion(); // print TXM version in the console
-							}
-						});
-
 						monitor.beginTask("Starting TXM", 100);
 
 						monitor.setTaskName(TXMUIMessages.loadingTXMInstallPreferences);
@@ -719,7 +687,7 @@
 						return false;
 					}
 					String version = v.getMajor()+"."+v.getMinor()+"."+v.getMicro();
-					if ("qualifier".equals(v.getQualifier())) { //$NON-NLS-1$
+					if (org.eclipse.core.runtime.Platform.inDevelopmentMode()) { //$NON-NLS-1$
 						System.out.println("RUNNING TXM FROM ECLIPSE - DEV MODE ACTIVATED");
 						version += "-dev";
 					}
@@ -792,7 +760,6 @@
 		corporaDirs.add(V080);
 		corporaDirs.add(V079);
 		
-		
 		Display.getDefault().syncExec(new Runnable() {
 			@Override
 			public void run() {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java	(revision 1884)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java	(revision 1885)
@@ -28,6 +28,10 @@
 package org.txm.rcp;
 
 import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.attribute.UserPrincipalLookupService;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -35,20 +39,34 @@
 
 import org.eclipse.core.net.proxy.IProxyService;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
 import org.eclipse.equinox.app.IApplication;
 import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.util.Util;
+import org.eclipse.osgi.util.TextProcessor;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.prefs.Preferences;
 import org.txm.Toolbox;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.preferences.RCPPreferences;
+import org.txm.rcp.swt.dialog.CGUMessageDialog;
+import org.txm.utils.BundleUtils;
 import org.txm.utils.logger.Log;
 
-// TODO: Auto-generated Javadoc
 /**
  * This class controls all aspects of the application's execution.
  */
@@ -71,6 +89,40 @@
 	@Override
 	public Object start(IApplicationContext context) throws Exception {
 
+		Display display = PlatformUI.createDisplay();
+
+		//		if (Platform.inDevelopmentMode() || Platform.inDebugMode()) {
+		//			// this can not work in development environment
+		//			// as it need to have a default workspace set to none
+		//			// see product configuration :
+		//			// osgi.instance.area=@noDefault
+		//			// ignored in development
+		//			// -------------------------------------
+		//
+		//		} else {
+		// in Release mode only : platform workspace selection on startup
+		// then restart if needed (on workspace error...)
+		Integer ret = openCGU();
+		if (ret == IApplication.EXIT_RESTART) {
+			System.out.println("** Working directory set by user.");
+			return IApplication.EXIT_RESTART;
+		} else if (ret == IApplication.EXIT_OK) {
+			System.out.println("** Fail to open CGU or set working directory.");
+			return IApplication.EXIT_OK; // an error occurred or user canceled
+		} else {
+			// OK
+		}
+		//		}
+
+		// Die if platform WS not set (user cancel)
+		// ---------------------------
+
+		if (Platform.getInstanceLocation().getURL() == null) {
+			System.out.println("** Working directory not set.");
+			return IApplication.EXIT_OK;
+		}
+
+
 		// load JVM fonts in SWT env
 		if (System.getProperty("os.name").contains("Linux")) { // $NON-NLS-1$ $NON-NLS-2$
 			File javaFontsPath = new File(System.getProperty("java.home")
@@ -105,7 +157,7 @@
 			Toolbox.setPreference(TBXPreferences.LOG_STACKTRACE, true);
 		}
 		if (argsList.contains("-run")) { //$NON-NLS-1$
-			//System.out.println("Running TXM");
+			System.out.println("Running TXM");
 			// FIXME: need to check that all has been well moved in Workspace class or build.properties
 			//		} else if (argsList.contains("-standalone")) { //$NON-NLS-1$
 			//			File userhomeDirectory = new File("workspace").getAbsoluteFile(); // eclipse default workspace directory
@@ -156,16 +208,16 @@
 			return IApplication.EXIT_OK;
 		}
 
-		Display display = PlatformUI.createDisplay();
+
 		//display.addListener(SWT.OpenDocument, openDocProcessor);
 
-		//Lock the RCP workspace, thus there is only one TXM instance running
-		Log.warning(TXMUIMessages.lockRCPWorkspace);
-		if (!Platform.getInstanceLocation().lock()){
-			//Shell shell = display.getActiveShell();
-			System.out.println("TXM is already running. Exiting...");
-			return IApplication.EXIT_OK;
-		}
+		//		//Lock the RCP workspace, thus there is only one TXM instance running
+		//		Log.warning(TXMUIMessages.lockRCPWorkspace);
+		//		if (!Platform.getInstanceLocation().lock()){
+		//			//Shell shell = display.getActiveShell();
+		//			System.out.println("TXM is already running. Exiting...");
+		//			return IApplication.EXIT_OK;
+		//		}
 
 		try {
 			Log.warning(TXMUIMessages.activateProxyService);
@@ -180,12 +232,15 @@
 
 			//run the application mainloop
 			awa = new ApplicationWorkbenchAdvisor();
+			System.out.println("Running TXM workbench.");
 			int returnCode = PlatformUI.createAndRunWorkbench(display, awa);
 
 			if (returnCode == PlatformUI.RETURN_RESTART) {
+				System.out.println("Restarting TXM.");
 				return IApplication.EXIT_RESTART;
 			}
 
+			System.out.println("Exiting TXM.");
 			return IApplication.EXIT_OK;
 		} finally {
 			// System.out.println(Messages.Application_2);
@@ -193,6 +248,180 @@
 		}
 	}
 
+	private Integer openCGU() {
+		try {
+			
+			Version v = BundleUtils.getBundleVersion("org.txm.rcp");//$NON-NLS-1$
+			if (v == null) {
+				System.out.println("Error: no 'org.txm.rcp' version found.");
+				return IApplication.EXIT_OK;
+			}
+			String version = v.getMajor()+"."+v.getMinor()+"."+v.getMicro();
+			if (org.eclipse.core.runtime.Platform.inDevelopmentMode()) { //$NON-NLS-1$
+				System.out.println("RUNNING TXM FROM ECLIPSE - DEV MODE ACTIVATED");
+				version += "-dev";
+			}
+			System.out.println("Version="+version);
+			
+			File txmhomedir = new File(System.getProperty("user.home"), "TXM-"+version); //$NON-NLS-1$ //$NON-NLS-2$
+
+			
+			
+			//System.out.println("CGU="+ConfigurationScope.INSTANCE.getNode(IDEWorkbenchPlugin.IDE_WORKBENCH).getBoolean(RCPPreferences.CGU, false));
+			if (!ConfigurationScope.INSTANCE.getNode(IDEWorkbenchPlugin.IDE_WORKBENCH).getBoolean(RCPPreferences.CGU, false)) {
+				ChooseWorkspaceData launchData = new ChooseWorkspaceData(txmhomedir.getAbsolutePath());
+				System.out.println("Opening CGU dialog...");
+				CGUMessageDialog dialog = new CGUMessageDialog(Display.getCurrent().getActiveShell(), launchData) {};
+				boolean ret = (dialog.open() == MessageDialog.OK) && dialog.hasCheckBeenPressed();
+				if (ret) {
+					//TBXPreferences.getInstance().put(RCPPreferences.CGU, true);
+
+					// check choosen path
+					Integer ret2 = setInstanceLocation(launchData);
+					if (ret2 != -1) {
+						return ret2;
+					}
+
+					// validate Current as default Workspace, save configuration & history
+
+					launchData.writePersistedData();
+					System.out.println("save workspace location: "+launchData.getSelection());
+					ChooseWorkspaceData.setShowDialogValue(false);
+
+					Preferences node = ConfigurationScope.INSTANCE.getNode(IDEWorkbenchPlugin.IDE_WORKBENCH);
+					node.putBoolean(RCPPreferences.CGU, true);
+					node.flush();
+
+					return -1;
+
+				} else {
+					return IApplication.EXIT_OK;
+				}
+			} else {
+				ChooseWorkspaceData launchData = new ChooseWorkspaceData(txmhomedir.getAbsolutePath());
+				String[] recent = launchData.getRecentWorkspaces();
+
+		        // If the selection dialog was not used then the workspace to use is either the
+		        // most recent selection or the initialDefault (if there is no history).
+		        String workspace = null;
+		        if (recent != null && recent.length > 0) {
+					workspace = recent[0];
+				}
+		        if (workspace == null || workspace.length() == 0) {
+					workspace = launchData.getInitialDefault();
+				}
+		        launchData.workspaceSelected(TextProcessor.deprocess(workspace));
+				
+				return setInstanceLocation(launchData);
+			}
+		} catch(Exception e) {
+			System.out.println("Error: can't open CGU dialog: "+e);
+			e.printStackTrace();
+			return IApplication.EXIT_OK;
+		}
+	}
+
+	private Integer setInstanceLocation(ChooseWorkspaceData launchData) {
+		String selWS = launchData.getSelection();
+		if (selWS == null) {
+			System.out.println("** No workspace set in configuration scope.");
+			return IApplication.EXIT_OK;// user cancelled (no restart)
+		}
+
+		// Switch workspace :
+		URL url = null;
+		try {
+			url = new URL("file", "", selWS);
+		} catch (MalformedURLException e1) {
+			showWorkspaceError("Workspace path could not be found.");
+			return IApplication.EXIT_OK;
+		}
+
+		try {
+			if (org.eclipse.core.runtime.Platform.inDevelopmentMode()) {
+				return -1; // can't call Platform.getInstanceLocation().set(...) in dev mode
+			}
+
+			if (!Platform.getInstanceLocation().set(url, true)) {
+				showWorkspaceError("TXM is already running. Exiting...");
+				ChooseWorkspaceData.setShowDialogValue(false);
+				return IApplication.EXIT_OK;
+			} else {
+				return -1; // OK !!
+			}
+		} catch (IllegalStateException e) {
+			showWorkspaceError("Workspace is in an illegal state: "+e);
+			ChooseWorkspaceData.setShowDialogValue(true);
+			return IApplication.EXIT_OK;
+		} catch (IOException e) {
+			showWorkspaceError("Workspace could not be found on disk: "+e);
+			ChooseWorkspaceData.setShowDialogValue(true);
+			return IApplication.EXIT_OK;
+		}
+
+
+	}
+
+	//	/**
+	//	 * Open choose workspace dialog and validate the user's choice. Returns true
+	//	 * if restart needed.
+	//	 */
+	//	private static Integer chooseWorkspaceUrl(Shell shell) {
+	//		ChooseWorkspaceData launchData = new ChooseWorkspaceData("");
+	////		if (!launchData.getShowDialog()) {
+	////			launchData.toggleShowDialog();
+	////		}
+	//		ChooseWorkspaceDialog dialog =
+	//				new ChooseWorkspaceDialog(shell, launchData, true, true);
+	//
+	//		// don't force prompt : setShowDialogValue is set on error
+	//		dialog.prompt(false);
+	//
+	//		// check choosen path
+	//		String selWS = launchData.getSelection();
+	//		if (selWS == null)
+	//			return IApplication.EXIT_OK;// user cancelled (no restart)
+	//
+	//		// Switch workspace :
+	//		URL url = null;
+	//		try {
+	//			url = new URL("file", "", selWS);
+	//		} catch (MalformedURLException e1) {
+	//			showWorkspaceError("Workspace path could not be found.");
+	//			return IApplication.EXIT_OK;
+	//		}
+	//
+	//		try {
+	//			if (!Platform.getInstanceLocation().set(url, true)) {
+	//				showWorkspaceError("TXM is already running. Exiting...");
+	//				ChooseWorkspaceData.setShowDialogValue(false);
+	//				return IApplication.EXIT_OK;
+	//			}
+	//
+	//		} catch (IllegalStateException e) {
+	//			showWorkspaceError("Workspace is in an illegal state: "+e);
+	//			ChooseWorkspaceData.setShowDialogValue(true);
+	//			return IApplication.EXIT_OK;
+	//		} catch (IOException e) {
+	//			showWorkspaceError("Workspace could not be found on disk: "+e);
+	//			ChooseWorkspaceData.setShowDialogValue(true);
+	//			return IApplication.EXIT_OK;
+	//		}
+	//
+	//		// validate Current as default Workspace, save configuration & history
+	//		
+	//		launchData.writePersistedData();
+	//		ChooseWorkspaceData.setShowDialogValue(false);
+	//		return -1;// user cancelled (no restart)
+	//	}
+
+	private static void showWorkspaceError(String message) {
+		MessageBox messageBox = new MessageBox(new Shell(), SWT.DIALOG_TRIM | SWT.ERROR);
+		messageBox.setText("TXM start Error");
+		messageBox.setMessage(message);
+		messageBox.open();
+	}
+
 	public ApplicationWorkbenchAdvisor getApplicationWorkbenchAdvisor() {
 		return awa;
 	}
Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 1884)
+++ tmp/org.txm.rcp/plugin.xml	(revision 1885)
@@ -648,6 +648,10 @@
                   tooltip="%command.tooltip.26">
             </command>
             <command
+                  commandId="org.txm.rcp.commands.ChangeTXMWorkspace"
+                  style="push">
+            </command>
+            <command
                   commandId="org.eclipse.ui.file.exit"
                   label="%command.label.6"
                   style="push"
@@ -2440,6 +2444,12 @@
             id="org.txm.rcp.commands.function.RenameResult"
             name="%command.name.4">
       </command>
+      <command
+            categoryId="org.txm.rcp.category.txm"
+            defaultHandler="org.txm.rcp.commands.ChangeTXMWorkspace"
+            id="org.txm.rcp.commands.ChangeTXMWorkspace"
+            name="Change working directory...">
+      </command>
    </extension>
    <extension
          id="commands"
Index: tmp/org.txm.core/src/java/org/txm/Toolbox.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 1884)
+++ tmp/org.txm.core/src/java/org/txm/Toolbox.java	(revision 1885)
@@ -587,7 +587,6 @@
 			return false;
 		}
 
-		File workspaceFile = new File(txmhomedir, "corpora/.metadata");
 		Version currentVersion = BundleUtils.getBundleVersion("org.txm.core");
 		Log.fine(TXMCoreMessages.bind("Current toolbox version: {0}.", currentVersion));
 		String installedVersionString = getPreference(TBXPreferences.VERSION);
@@ -601,22 +600,7 @@
 
 			boolean doUpdateworkspace = currentVersion.compareTo(installedVersion) > 0;
 
-			// no directory
-			if (!workspaceFile.exists()) {
-
-				Log.severe(NLS.bind(TXMCoreMessages.noWorkspaceFoundCreatingANewOneP0, workspaceFile)); 
-
-				// create or update the workspace & create TXM default.xml workspace file
-				Toolbox.workspace = createOrUpdate(new File(txmhomedir)); //$NON-NLS-1$
-
-				// test
-				if (Toolbox.workspace == null) {
-					Log.severe("Error: workspace not created (is null).");
-					return false;
-				}
-
-				setPreference(TBXPreferences.VERSION, currentVersion.toString());
-			} else if (doUpdateworkspace) { // newer install
+			if (doUpdateworkspace) { // newer install
 				Log.fine("Updating Toolbox workspace...");
 
 				// create or update the workspace & create TXM default.xml workspace file
@@ -632,11 +616,11 @@
 				workspace = Workspace.getInstance();
 			}
 
-			Log.fine(NLS.bind(TXMCoreMessages.loadingWorkspaceFromFileColonP0, workspaceFile)); 
+			Log.fine(NLS.bind(TXMCoreMessages.loadingWorkspaceFromFileColonP0, txmhomedir)); 
 			state = true;
 
 			if (workspace == null) { //$NON-NLS-1$
-				Log.severe(NLS.bind(TXMCoreMessages.errorLoadingWorkspaceFromFileColonP0, workspaceFile)); 
+				Log.severe(NLS.bind(TXMCoreMessages.errorLoadingWorkspaceFromFileColonP0, txmhomedir)); 
 				state = false;
 				//System.out.println(TXMCoreMessages.FAILED);
 				return false;
@@ -660,7 +644,7 @@
 				}
 			}
 		} catch (Exception e) {
-			Log.severe(NLS.bind(TXMCoreMessages.errorDuringWorkspaceInitializationColonP0, workspaceFile)); 
+			Log.severe(NLS.bind(TXMCoreMessages.errorDuringWorkspaceInitializationColonP0, txmhomedir)); 
 			Log.severe(NLS.bind(TXMCoreMessages.errorColonP0, Log.toString(e)));
 			Log.printStackTrace(e);
 			state = false;
@@ -720,10 +704,6 @@
 	 * @return the workspace
 	 */
 	public static Workspace createOrUpdate(File txmhomedir) {
-		//TODO replace this old directory&file with the ".project" Eclipse project configuration file
-		File workspaceDirectory = new File(txmhomedir, "corpora");
-		//		File xmlfile = new File(workspaceDirectory, "default.xml");
-
 		try {
 			txmhomedir.mkdirs();
 
@@ -736,7 +716,7 @@
 			String createfolders[] = {
 					"corpora", "clipboard", //$NON-NLS-1$ //$NON-NLS-2$
 					"css", "xsl", "schema", "scripts"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			String deletefolders[] = {"clipboard"}; //$NON-NLS-1$ //$NON-NLS-2$
+			String deletefolders[] = {"clipboard"}; //$NON-NLS-1$
 
 			for (String folder : deletefolders) {
 				DeleteDir.deleteDirectory(new File(txmhomedir, folder));
@@ -761,7 +741,7 @@
 
 			File redistDirectory = new File(installDirectory, "redist");
 			if (!redistDirectory.exists()) {
-				Log.severe("Warning: Workspace cannot found redist directory: "+redistDirectory.getAbsolutePath());
+				Log.warning("Warning: Workspace cannot found redist directory: "+redistDirectory.getAbsolutePath());
 			} else {
 				FileCopy.copyFiles(redistDirectory, txmhomedir);
 			}
@@ -771,7 +751,7 @@
 			//			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", txmhomedir);
 			//			BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", txmhomedir);
 
-			Workspace workspace = Workspace.getInstance();
+			workspace = Workspace.getInstance();
 
 			return workspace;
 		} catch (Exception e) {
Index: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 1884)
+++ tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 1885)
@@ -33,15 +33,19 @@
 import java.io.OutputStreamWriter;
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.osgi.util.NLS;
 import org.osgi.framework.Bundle;
@@ -69,6 +73,9 @@
 
 	private static final String NAME = "name";
 	
+	IWorkspace rcpWorkspace;
+	IWorkspaceRoot root;
+	IProject corporaProject;
 //	/** The xmlfile. */
 //	File xmlDefinitionFile;
 //
@@ -126,9 +133,21 @@
 	private Workspace() {
 		super("ROOT");
 		
-		IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
+		rcpWorkspace = ResourcesPlugin.getWorkspace();
+		root = rcpWorkspace.getRoot();
+		corporaProject = root.getProject("corpora");
+		
+		if (!corporaProject.exists()) {
+			try {
+				corporaProject.create(null);
+			} catch (CoreException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
 		this.internalPersistable = true;
-		this.userName = rcpWorkspace.getRoot().getName(); // corpora
+		this.userName = corporaProject.getName(); // corpora
 		//		this.setPath("/"+pName); 
 //		this.xmlDefinitionFile = xmlfile;
 	}
@@ -213,9 +232,7 @@
 		File PARAMS = new File(binCorpusDir, ".settings"); //$NON-NLS-1$
 		File PROJECT = new File(binCorpusDir, ".project"); //$NON-NLS-1$
 		binCorpusDir = new File(this.getLocation(), binCorpusDir.getName()); // this is to ensure the project is in the workspace files
-		
-		
-		
+
 		if (binCorpusDir.exists() && HTMLs.exists() && DATAs.exists()
 				&& REGISTRY.exists() && PARAMS.exists() && PROJECT.exists())// && correspfile.exists())
 		{// minimal base data
@@ -383,13 +400,24 @@
 		Log.fine("Toolbox.initialize(): reloading projects...");
 		
 		IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
+		IProject corporaDirectory = rcpWorkspace.getRoot().getProject("corpora");
+		
+		if (!corporaDirectory.exists()) {
+			Log.severe("Can't load corpora projects: 'corpora' not found in workspace.");
+			return;
+		}
 		IProject projects[] = rcpWorkspace.getRoot().getProjects();
 		
 		Log.fine("Toolbox.initialize(): " + projects.length + " project(s) found in workspace.");
 		LogMonitor monitor = new LogMonitor("Workspace projects initialization.");
+		
 		for (IProject project : projects) {
+			
 			try {
 				project.open(monitor);
+				String[] natures = project.getDescription().getNatureIds();
+				if (Arrays.binarySearch(natures, Project.TXMCORPUSNATURE) < 0) continue;
+				
 				Project.loadProjectFromProjectScope(project);
 			} catch (CoreException e) {
 				// TODO Auto-generated catch block
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1884)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1885)
@@ -40,6 +40,7 @@
 
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ProjectScope;
@@ -76,6 +77,8 @@
  */
 public class Project extends TXMResult {
 
+	public static final String TXMCORPUSNATURE = "org.txm.core.CorpusNature";
+
 	//private ArrayList<String> pEditionNames = new ArrayList<String>();
 	private IProject rcpProject;
 
@@ -351,10 +354,16 @@
 	}
 
 	private void createRCPProject() throws CoreException {
-		rcpProject.create(monitor);
+		
+		IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(rcpProject.getName());
+		IFolder folder = Workspace.getInstance().corporaProject.getFolder(rcpProject.getName());
+		
+		description.setLocation(folder.getLocation());
+		description.setNatureIds(new String[] {TXMCORPUSNATURE});
+		
+		rcpProject.create(description, monitor);
 		rcpProject.open(monitor);
-		rcpProject.getDescription().setNatureIds(new String[] {"org.txm.core.CorpusNature"});
-
+		
 		IFolder srcFolder = rcpProject.getFolder("src");
 		if (pSrcDirectory != null && !pSrcDirectory.getName().isEmpty()) {
 			IPath path = new Path(pSrcDirectory.getAbsolutePath());
@@ -818,7 +827,7 @@
 	 */
 	public File getProjectDirectory() {
 		if (this.rcpProject == null || this.rcpProject.getLocation() == null) {
-			return new File(Toolbox.workspace.getLocation(), this.userName);
+			return new File(Toolbox.workspace.getLocation(), "corpora/"+this.userName);
 		}
 		return this.rcpProject.getLocation().toFile();
 	}
@@ -1264,7 +1273,7 @@
 					continue;
 				}
 
-				Log.fine("Toolbox.initialize(): creating project " + rcpProject.getName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
+				Log.fine("Toolbox.initialize(): creating TXM corpus project " + rcpProject.getName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
 				Class<?> cl = bundle.loadClass(className);
 				Constructor<?> cons = cl.getConstructor(String.class);
 				TXMResult result = (TXMResult) cons.newInstance(parametersNodePath);
