Index: tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java
===================================================================
--- tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java	(revision 668)
+++ tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java	(revision 669)
@@ -76,8 +76,8 @@
 import org.txm.rcp.editors.TXMEditor;
 import org.txm.rcp.editors.TXMMultiPageEditor;
 import org.txm.rcp.editors.TXMResultEditorInput;
-import org.txm.rcp.editors.Tablable;
-import org.txm.rcp.editors.input.AbstractTablable;
+import org.txm.rcp.editors.ITablableEditorInput;
+import org.txm.rcp.editors.input.AbstractTablableEditorInput;
 import org.txm.statsengine.core.StatException;
 import org.txm.utils.logger.Log;
 
@@ -365,7 +365,7 @@
 		editors.add(new SingularValuesEditor());
 
 		// Editor input
-		Tablable table = new AbstractTablable() {
+		ITablableEditorInput table = new AbstractTablableEditorInput() {
 			@Override
 			public String[] getColumnTitles() {
 				return new String[] {
@@ -430,7 +430,7 @@
 		editors.add(new ColsRowsInfosEditor());
 
 		// Editor input
-		Tablable table = new AbstractTablable() {
+		ITablableEditorInput table = new AbstractTablableEditorInput() {
 
 			List<String> coltypes;
 			@Override
@@ -512,7 +512,7 @@
 		editors.add(new ColsRowsInfosEditor());
 
 		// Editor input
-		Tablable table = new AbstractTablable() {
+		ITablableEditorInput table = new AbstractTablableEditorInput() {
 
 			List<String> colnames = new ArrayList<String>();
 			List<String> coltypes = new ArrayList<String>();
Index: tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/SingularValuesEditor.java
===================================================================
--- tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/SingularValuesEditor.java	(revision 668)
+++ tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/SingularValuesEditor.java	(revision 669)
@@ -50,7 +50,7 @@
 import org.eclipse.ui.part.EditorPart;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.StatusLine;
-import org.txm.rcp.editors.Tablable;
+import org.txm.rcp.editors.ITablableEditorInput;
 import org.txm.rcp.editors.TableKeyListener;
 import org.txm.rcp.editors.TableSorter;
 // TODO: Auto-generated Javadoc
@@ -71,7 +71,7 @@
 	private IEditorInput iEditorInput;
 
 	/** The table input. */
-	private Tablable tableInput;
+	private ITablableEditorInput tableInput;
 
 	/** The columns. */
 	List<TableViewerColumn> columns = new ArrayList<TableViewerColumn>();
@@ -131,10 +131,10 @@
 	public void createPartControl(Composite parent) {
 		parent.setLayout(new FillLayout());
 
-		if (!(iEditorInput instanceof Tablable)) {
+		if (!(iEditorInput instanceof ITablableEditorInput)) {
 			throw new IllegalArgumentException(RCPMessages.SingularValuesEditor_0);
 		}
-		tableInput = (Tablable) iEditorInput;
+		tableInput = (ITablableEditorInput) iEditorInput;
 
 		viewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL
 				| SWT.MULTI | SWT.FULL_SELECTION);
Index: tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java
===================================================================
--- tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java	(revision 668)
+++ tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/ColsRowsInfosEditor.java	(revision 669)
@@ -47,7 +47,7 @@
 import org.eclipse.ui.part.EditorPart;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.StatusLine;
-import org.txm.rcp.editors.Tablable;
+import org.txm.rcp.editors.ITablableEditorInput;
 import org.txm.rcp.editors.TableKeyListener;
 import org.txm.rcp.editors.TableSorter;
 // TODO: Auto-generated Javadoc
@@ -68,7 +68,7 @@
 	private IEditorInput iEditorInput;
 	
 	/** The table input. */
-	private Tablable tableInput;
+	private ITablableEditorInput tableInput;
 
 	/** The table sorter. */
 	private TableSorter tableSorter;
@@ -125,10 +125,10 @@
 	public void createPartControl(Composite parent) {
 		parent.setLayout(new FillLayout());
 
-		if (!(iEditorInput instanceof Tablable)) {
+		if (!(iEditorInput instanceof ITablableEditorInput)) {
 			throw new IllegalArgumentException(RCPMessages.ColsRowsInfosEditor_0);
 		}
-		tableInput = (Tablable) iEditorInput;
+		tableInput = (ITablableEditorInput) iEditorInput;
 		viewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL
 				| SWT.MULTI | SWT.FULL_SELECTION);
 		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
Index: tmp/org.txm.statsengine.r.rcp/src/org/txm/rcp/commands/R/OpenEmptyEditor.java
===================================================================
--- tmp/org.txm.statsengine.r.rcp/src/org/txm/rcp/commands/R/OpenEmptyEditor.java	(revision 668)
+++ tmp/org.txm.statsengine.r.rcp/src/org/txm/rcp/commands/R/OpenEmptyEditor.java	(revision 669)
@@ -37,7 +37,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.EditFile;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.preferences.RCPPreferences;
 import org.txm.utils.logger.Log;
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java
===================================================================
--- tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java	(revision 668)
+++ tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java	(revision 669)
@@ -71,8 +71,8 @@
 import org.txm.progression.core.functions.Progression;
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.EditFile;
 import org.txm.rcp.commands.R.CopySelection;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.referencer.core.functions.Referencer;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
Index: tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ExportLexicalTable.java
===================================================================
--- tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ExportLexicalTable.java	(revision 668)
+++ tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ExportLexicalTable.java	(revision 669)
@@ -38,7 +38,7 @@
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.lexicaltable.rcp.editors.LexicalTableEditor;
-import org.txm.rcp.commands.EditFile;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.swt.dialog.LastOpened;
 
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditorInput.java
===================================================================
--- tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditorInput.java	(revision 668)
+++ tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditorInput.java	(revision 669)
@@ -41,8 +41,8 @@
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.rcp.editors.TXMResultEditorInput;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.Tablable;
-import org.txm.rcp.editors.input.AbstractTablable;
+import org.txm.rcp.editors.ITablableEditorInput;
+import org.txm.rcp.editors.input.AbstractTablableEditorInput;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.statsengine.core.StatException;
 // TODO: Auto-generated Javadoc
@@ -90,7 +90,7 @@
 
 		}
 
-		Tablable asTable = new AbstractTablable() {
+		ITablableEditorInput asTable = new AbstractTablableEditorInput() {
 
 			@Override
 			public String[] getColumnTitles() {
Index: tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/TableEditor.java
===================================================================
--- tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/TableEditor.java	(revision 668)
+++ tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/TableEditor.java	(revision 669)
@@ -43,7 +43,7 @@
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.part.EditorPart;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.Tablable;
+import org.txm.rcp.editors.ITablableEditorInput;
 import org.txm.rcp.editors.TableKeyListener;
 import org.txm.rcp.editors.TableSorter;
 // TODO: Auto-generated Javadoc
@@ -131,11 +131,11 @@
 		table.setHeaderVisible(true);
 		table.setLinesVisible(true);
 
-		if (!(iEditorInput instanceof Tablable)) {
+		if (!(iEditorInput instanceof ITablableEditorInput)) {
 			throw new IllegalArgumentException(RCPMessages.TableEditor_0);
 		}
 
-		Tablable tableInput = (Tablable) iEditorInput;
+		ITablableEditorInput tableInput = (ITablableEditorInput) iEditorInput;
 
 		String[] titles = tableInput.getColumnTitles();
 
Index: tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImports.java
===================================================================
--- tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImports.java	(revision 668)
+++ tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImports.java	(revision 669)
@@ -46,7 +46,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.JobsTimer;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.utils.zip.Zip;
Index: tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImportLangs.java
===================================================================
--- tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImportLangs.java	(revision 668)
+++ tmp/org.txm.core.tests/src/org/txm/rcp/commands/tests/TestImportLangs.java	(revision 669)
@@ -24,7 +24,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.JobsTimer;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.utils.io.IOUtils;
 import org.xml.sax.SAXException;
Index: tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/___SpecificitiesResultEditorInput.java
===================================================================
--- tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/___SpecificitiesResultEditorInput.java	(revision 668)
+++ tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/___SpecificitiesResultEditorInput.java	(revision 669)
@@ -46,8 +46,8 @@
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.editors.TXMResultEditorInput;
-import org.txm.rcp.editors.Tablable;
-import org.txm.rcp.editors.input.AbstractTablable;
+import org.txm.rcp.editors.ITablableEditorInput;
+import org.txm.rcp.editors.input.AbstractTablableEditorInput;
 import org.txm.rcp.editors.input.IProvidingMultiPageEditorInput;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Partition;
@@ -127,7 +127,7 @@
 
 		inputs = new ArrayList<IEditorInput>();
 
-		Tablable asTable = new AbstractTablable() {
+		ITablableEditorInput asTable = new AbstractTablableEditorInput() {
 
 			@Override
 			public String[] getColumnTitles() {
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 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java	(revision 669)
@@ -91,12 +91,12 @@
 import org.txm.importer.Convert5To6;
 import org.txm.objects.Base;
 import org.txm.objects.Workspace;
-import org.txm.rcp.commands.ExecuteGroovyScript;
 import org.txm.rcp.commands.OpenBrowser;
 import org.txm.rcp.commands.OpenWelcomePage;
 import org.txm.rcp.commands.RestartTXM;
-import org.txm.rcp.commands.base.DeleteObject;
 import org.txm.rcp.commands.workspace.LoadBinaryCorpus;
+import org.txm.rcp.handlers.results.DeleteObject;
+import org.txm.rcp.handlers.scripts.ExecuteGroovyScript;
 import org.txm.rcp.p2.plugins.TXMUpdateHandler;
 import org.txm.rcp.perspective.TXMPerspective;
 import org.txm.rcp.preferences.RCPPreferences;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/BasesView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/BasesView.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/BasesView.java	(revision 669)
@@ -62,10 +62,10 @@
 import org.txm.objects.Workspace;
 import org.txm.rcp.Application;
 import org.txm.rcp.IImageKeys;
-import org.txm.rcp.commands.EditFile;
 import org.txm.rcp.commands.OpenBrowser;
-import org.txm.rcp.commands.base.DeleteObject;
 import org.txm.rcp.editors.TXMBrowser;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.handlers.results.DeleteObject;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/QueriesView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/QueriesView.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/QueriesView.java	(revision 669)
@@ -69,8 +69,8 @@
 import org.txm.objects.TxmObject;
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.EditFile;
-import org.txm.rcp.commands.base.DeleteObject;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.handlers.results.DeleteObject;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 669)
@@ -61,13 +61,13 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.TXMWindows;
-import org.txm.rcp.commands.CopyFile;
-import org.txm.rcp.commands.CreateMacro;
-import org.txm.rcp.commands.CutFile;
-import org.txm.rcp.commands.DeleteFile;
-import org.txm.rcp.commands.ExecuteGroovyMacro;
-import org.txm.rcp.commands.PasteFile;
-import org.txm.rcp.commands.RenameFile;
+import org.txm.rcp.handlers.files.CopyFile;
+import org.txm.rcp.handlers.files.CutFile;
+import org.txm.rcp.handlers.files.DeleteFile;
+import org.txm.rcp.handlers.files.PasteFile;
+import org.txm.rcp.handlers.files.RenameFile;
+import org.txm.rcp.handlers.scripts.CreateMacro;
+import org.txm.rcp.handlers.scripts.ExecuteGroovyMacro;
 // TODO: Auto-generated Javadoc
 /**
  * Simple file explorer @ author mdecorde.
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java	(revision 669)
@@ -57,14 +57,14 @@
 import org.txm.Toolbox;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.CopyFile;
-import org.txm.rcp.commands.CutFile;
-import org.txm.rcp.commands.DeleteFile;
-import org.txm.rcp.commands.EditFile;
 import org.txm.rcp.commands.OpenBrowser;
 import org.txm.rcp.commands.OpenGraph;
-import org.txm.rcp.commands.PasteFile;
-import org.txm.rcp.commands.RenameFile;
+import org.txm.rcp.handlers.files.CopyFile;
+import org.txm.rcp.handlers.files.CutFile;
+import org.txm.rcp.handlers.files.DeleteFile;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.handlers.files.PasteFile;
+import org.txm.rcp.handlers.files.RenameFile;
 // TODO: Auto-generated Javadoc
 /**
  * Simple file explorer @ author mdecorde.
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 669)
@@ -73,9 +73,9 @@
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.TXMWindows;
-import org.txm.rcp.commands.base.DeleteObject;
 import org.txm.rcp.editors.TXMEditor;
 import org.txm.rcp.editors.TXMResultEditorInput;
+import org.txm.rcp.handlers.results.DeleteObject;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.utils.logger.Log;
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 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/ImportDialog.java	(revision 669)
@@ -54,7 +54,7 @@
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.TxmPreferences;
-import org.txm.rcp.commands.EditFile;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.swt.dialog.TXMMessageBox;
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/ComputeTXMResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/ComputeTXMResult.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/ComputeTXMResult.java	(revision 669)
@@ -1,25 +0,0 @@
-package org.txm.rcp.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.editors.TXMEditor;
-
-public class ComputeTXMResult extends AbstractHandler {
-
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		IWorkbenchPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
-		if (!(part instanceof TXMEditor)) {
-			System.out.println("Active editor is not a TXMEditor. Aborting.");
-			return null;
-		}
-
-		TXMEditor editor = (TXMEditor) part;
-		editor.compute(false);
-
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/CloneTXMResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/CloneTXMResult.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/CloneTXMResult.java	(revision 669)
@@ -1,70 +0,0 @@
-// 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.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.results.TXMResult;
-import org.txm.rcp.views.corpora.CorporaView;
-
-/**
- * Clone the selected TXM result node.
- * 
- * @author sjacquot
- * 
- */
-public class CloneTXMResult extends AbstractHandler {
-
-
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		System.out.println("CloneTXMResult.execute(): clone tests.");
-		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
-		System.out.println("CloneTXMResult.execute() selection class: " + selection);
-		if(selection.getFirstElement() instanceof TXMResult)	{
-			TXMResult srcNode =  ((TXMResult) selection.getFirstElement());
-			TXMResult clone = (TXMResult) srcNode.clone();
-			
-			// FIXME: hierarchy tests
-			//srcNode.addChild(clone);
-		}
-		
-		CorporaView.refresh();
-
-		return null;
-	}
-	
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResult.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResult.java	(revision 669)
@@ -0,0 +1,175 @@
+// 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.handlers.export;
+
+import java.io.File;
+import java.io.IOException;
+
+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.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+// TODO: Auto-generated Javadoc
+/**
+ * export a result of a result by calling the function toTxt(File f) then show
+ * the result in the text editor @ author mdecorde.
+ */
+public class ExportResult extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.function.ExportResult"; //$NON-NLS-1$
+	/** The selection. */
+	private IStructuredSelection selection;
+
+	/** The lastopenedfile. */
+	//private static String lastopenedfile;
+
+	/**
+	 * Export a TXM result in a CSV file.
+	 *
+	 * @param event the event
+	 * @return the object
+	 * @throws ExecutionException the execution exception
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		final Object s = selection.getFirstElement();
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+
+		//String txmhome = Toolbox.getTXMHOMEPATH();
+		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+
+		String extensions[] = {"*.csv"}; //$NON-NLS-1$
+		if (s instanceof TXMResult) {
+			extensions = ((TXMResult)s).getExportTXTExtensions(); //$NON-NLS-1$
+		}
+		dialog.setFilterExtensions(extensions);
+
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+		}
+
+		if (dialog.open() != null) {
+			StatusLine.setMessage(RCPMessages.ExportResult_0);
+			String filepath = dialog.getFilterPath()
+					+ "/" + dialog.getFileName(); //$NON-NLS-1$
+			if (!(filepath.endsWith(extensions[0].substring(1))))
+				filepath += extensions[0].substring(1);
+
+			final File outfile = new File(filepath);
+			LastOpened.set(ID, outfile.getParent(), outfile.getName());
+			try {
+				outfile.createNewFile();
+			} catch (IOException e1) {
+				System.err.println(NLS.bind(RCPMessages.ExportResult_3, outfile, e1));
+			}
+			if (!outfile.canWrite()) {
+				System.out.println(NLS.bind(RCPMessages.ExportResult_5, outfile));
+				return null;
+			}
+			if (!outfile.isFile()) {
+				System.out.println("Error: " + outfile + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
+				return null;
+			}
+
+			final String encoding = TXMPreferences.getString(TBXPreferences.EXPORT_ENCODING, TBXPreferences.PREFERENCES_NODE);
+			String _colseparator = TXMPreferences.getString(TBXPreferences.EXPORT_COLSEPARATOR, TBXPreferences.PREFERENCES_NODE);
+			final String colseparator = _colseparator;
+			String _txtseparator = TXMPreferences.getString(TBXPreferences.EXPORT_TXTSEPARATOR, TBXPreferences.PREFERENCES_NODE);
+			final String txtseparator = _txtseparator;
+
+			JobHandler jobhandler = new JobHandler(RCPMessages.ExportResult_0) {
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						this.runInit(monitor);
+						monitor.beginTask(RCPMessages.ExportResult_1, 100);
+
+						if (s instanceof TXMResult) {
+							((TXMResult)s).setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
+							((TXMResult)s).toTxt(outfile, encoding, colseparator, txtseparator);
+						} else {
+							System.out.println("Exported object is not a TXMResult result");
+							return Status.CANCEL_STATUS;
+						}
+
+						if (outfile.exists()) {
+							// Open internal editor in the UI thread
+							if(TXMPreferences.getBoolean(TBXPreferences.EXPORT_SHOW, TBXPreferences.PREFERENCES_NODE))	{
+								this.syncExec(new Runnable() {
+									@Override
+									public void run() {
+										EditFile.openfile(outfile.getAbsolutePath());
+									}
+								});
+							}
+
+							System.out.println(NLS.bind("", outfile.getAbsolutePath())); //$NON-NLS-1$
+						} else {
+							System.out.println(NLS.bind(RCPMessages.ExportResult_6, outfile.getAbsolutePath()));
+						}
+					} catch (ThreadDeath td) {
+						if (s instanceof TXMResult)
+							((TXMResult)s).clean();
+						return Status.CANCEL_STATUS;
+					} catch (Exception e) {
+						System.out.println(NLS.bind(RCPMessages.ExportResult_6, s, e));
+						org.txm.rcp.utils.Logger.printStackTrace(e);
+						return Status.CANCEL_STATUS;
+					} finally {
+						if (s instanceof TXMResult)
+							((TXMResult)s).setCurrentMonitor(null);
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+
+			jobhandler.startJob();
+		}
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportSVG.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportSVG.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportSVG.java	(revision 669)
@@ -0,0 +1,185 @@
+// 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.handlers.export;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.utils.io.FileCopy;
+
+/**
+ * save the SVG file selected @ author mdecorde.
+ */
+@Deprecated
+public class ExportSVG extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.function.ExportSVG"; //$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 {
+		// FIXME : implement charts engine after we defined if here we need to export the chart or the view
+//		try {
+//			// After that call directly "ExportChart" or "ExportChartEditorView"
+//			System.out.println(Messages.ExportSVG_0);
+//			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+//
+//			String txmhome = Toolbox.getTXMHOMEPATH();
+//
+//			// get editor
+//			IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+//					.getActivePage().getActivePart();
+//
+//			String prefDevice = TxmPreferences.getString(ExportPreferencePage.RDEVICE, "SVG"); //$NON-NLS-1$
+//			RDevice device = RDevice.valueOf(prefDevice.toUpperCase());
+//			System.out.println(NLS.bind(Messages.ExportSVG_2, device));
+//
+//			new File(txmhome, "results").mkdir(); //$NON-NLS-1$
+//			File svgSourceFile = new File(txmhome, "results/temp"+device.getExt()); //$NON-NLS-1$
+//			
+//			if (page instanceof SVGGraphicEditor) {
+//				SVGGraphicEditor te = (SVGGraphicEditor) page;
+//				svgSourceFile = te.getSVGFile();
+//				device = RDevice.SVG;
+//			} else if (page instanceof CorporaView) {
+//				CorporaView view = (CorporaView) page;
+//				StructuredSelection sel = (StructuredSelection) view.getTreeViewer().getSelection();
+//				Object obj = sel.getFirstElement();
+//				//System.out.println("sel: "+obj);
+//				if (obj instanceof CAH) {
+//					ChartsEngine.getChartsEngine(RChartsEngine.class).getChartCreator(CAH.class).createChartFile(obj, svgSourceFile, CAHPreferences.PREFERENCES_NODE);
+////						((CAH)obj).toSVG(svgSourceFile, device);
+//				}
+//				else if (obj instanceof Progression) {
+//					ChartsEngine.getChartsEngine(RChartsEngine.class).getChartCreator(Progression.class).createChartFile(obj, svgSourceFile, ProgressionPreferences.PREFERENCES_NODE);
+////						((Progression)obj).toSvg(svgSourceFile, device);
+//				}
+//			}
+//
+//			if (svgSourceFile != null && svgSourceFile.exists()) {
+//				String ext = null;
+//				if (svgSourceFile.getName().lastIndexOf(".") > 0) { //$NON-NLS-1$
+//					ext = svgSourceFile.getName();
+//					ext = ext.substring(ext.lastIndexOf("."), ext.length()); //$NON-NLS-1$
+//				}
+//				FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+//				String[] exts = {"*"+device.getExt()}; //$NON-NLS-1$
+//				dialog.setFilterExtensions(exts);
+//				
+//				if (LastOpened.getFile(ID) != null) {
+//					dialog.setFilterPath(LastOpened.getFolder(ID));
+//					//dialog.setFileName(LastOpened.getFile(ID));
+//				} else {
+//					dialog.setFilterPath(txmhome);
+//				}
+//
+//				File outfile;
+//
+//				if (dialog.open() != null) {
+//					String filename =  dialog.getFileName(); //$NON-NLS-1$
+//					if (!filename.endsWith(device.getExt())) 
+//						filename = filename+device.getExt();
+//					outfile = new File(dialog.getFilterPath(), filename);
+//					LastOpened.set(ID, outfile);
+//				} else
+//					return null;
+//
+//				try {
+//					JobsTimer.start();
+//					StatusLine.setMessage(""); //$NON-NLS-1$
+//					FileCopy.copy(svgSourceFile, outfile);
+//					if (outfile.exists()) {
+//						System.out.println(NLS.bind(Messages.ExportSVG_1, outfile, device.getName())); 
+//					} else {
+//						System.out.println(NLS.bind(Messages.ExportSVG_3 + outfile, device.getExt()));
+//					}
+//
+//				} catch (IOException e) {
+//					System.err.println("Export failed: " + svgSourceFile //$NON-NLS-1$
+//							+ "" + outfile + ": " + e); //$NON-NLS-1$ //$NON-NLS-2$ 
+//				}
+//			}
+//		} catch(Exception e) {
+//			System.out.println(e.getLocalizedMessage());
+//			org.txm.rcp.utils.Logger.printStackTrace(e);
+//		}
+		return null;
+	}
+
+	/**
+	 * Export.
+	 *
+	 * @param infile the infile
+	 */
+	public static void export(File infile) {
+		// Shell shell =
+		// HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		String txmhome = Toolbox.getTXMHOMEPATH();
+		FileDialog dialog = new FileDialog(new Shell(), SWT.SAVE);
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+			dialog.setFileName(LastOpened.getFile(ID));
+		} else {
+			dialog.setFilterPath(txmhome);
+		}
+
+		File outfile;
+
+		if (dialog.open() != null) {
+			outfile = new File(dialog.getFilterPath(), dialog.getFileName());
+			LastOpened.set(ID, outfile);
+		} else
+			return;
+
+		try {
+			FileCopy.copy(infile, outfile);
+		} catch (IOException e) {
+			System.out.println("Error: " + infile //$NON-NLS-1$
+					+ "" + outfile + ": " + e); //$NON-NLS-1$ //$NON-NLS-2$ 
+		}
+
+		if (outfile.exists()) {
+			System.out.println(NLS.bind(RCPMessages.ExportSVG_1, outfile, ""));  //$NON-NLS-1$
+		} else {
+			System.out.println(NLS.bind(RCPMessages.ExportSVG_3 + outfile, "")); //$NON-NLS-1$
+		}
+	}
+
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java	(revision 669)
@@ -0,0 +1,25 @@
+package org.txm.rcp.handlers.results;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.editors.TXMEditor;
+
+public class ComputeTXMResult extends AbstractHandler {
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IWorkbenchPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
+		if (!(part instanceof TXMEditor)) {
+			System.out.println("Active editor is not a TXMEditor. Aborting.");
+			return null;
+		}
+
+		TXMEditor editor = (TXMEditor) part;
+		editor.compute(false);
+
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/CloneTXMResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/CloneTXMResult.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/CloneTXMResult.java	(revision 669)
@@ -0,0 +1,70 @@
+// 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.handlers.results;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.views.corpora.CorporaView;
+
+/**
+ * Clone the selected TXM result node.
+ * 
+ * @author sjacquot
+ * 
+ */
+public class CloneTXMResult extends AbstractHandler {
+
+
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		System.out.println("CloneTXMResult.execute(): clone tests.");
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		System.out.println("CloneTXMResult.execute() selection class: " + selection);
+		if(selection.getFirstElement() instanceof TXMResult)	{
+			TXMResult srcNode =  ((TXMResult) selection.getFirstElement());
+			TXMResult clone = (TXMResult) srcNode.clone();
+			
+			// FIXME: hierarchy tests
+			//srcNode.addChild(clone);
+		}
+		
+		CorporaView.refresh();
+
+		return null;
+	}
+	
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java	(revision 669)
@@ -0,0 +1,287 @@
+// 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.handlers.results;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+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.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.internal.Workbench;
+import org.txm.EngineType;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.TxmObject;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.preferences.RCPPreferences;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.logger.Log;
+//import org.txm.functions.queryindex.QueryIndex;
+// TODO: Auto-generated Javadoc
+/**
+ * Delete the selection: TXMObjects and results code for the results must be
+ * added manually here @ author mdecorde.
+ */
+public class DeleteObject extends AbstractHandler {
+
+	private static boolean shouldRestartToolbox = false;
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		final IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		
+		if (!askContinueToDelete(selection)) return null;
+		
+		JobHandler job = new JobHandler("Deleting", true) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				delete(selection);
+				return Status.OK_STATUS;
+			}
+		};
+		job.schedule();
+		try {
+			job.join();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			return Status.CANCEL_STATUS;
+		}
+		return job.getResultObject();
+	}
+
+	private static boolean continueToDelete = true;
+	public static synchronized boolean askContinueToDelete(final IStructuredSelection selection) {
+		continueToDelete = true;
+		
+		boolean dontShowAlert = !TXMPreferences.getBoolean(RCPPreferences.USER_ALERT_DELETE, RCPPreferences.PREFERENCES_NODE);
+		
+		if (dontShowAlert) {
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_QUESTION
+							| SWT.YES | SWT.NO);
+					messageBox.setMessage(NLS.bind(RCPMessages.DeleteObject_0, selection.toList()));
+					int response = messageBox.open();
+					if (response != SWT.YES) {
+						StatusLine.setMessage(""); //$NON-NLS-1$
+						continueToDelete = false;
+					}
+				}
+			});
+		}
+		return continueToDelete;
+	}
+	
+	/**
+	 * Delete.
+	 *
+	 * @param sel the selection of object to delete
+	 */
+	public static HashSet<Object> delete(ISelection sel) {
+		IStructuredSelection selection = (IStructuredSelection) sel;
+		if (selection.size() == 0) return new HashSet<Object>();
+		
+		List<Object> objects = new ArrayList<Object>(selection.toList());
+		return delete(objects);
+	}
+	
+
+	/**
+	 * Delete.
+	 * 
+	 * TODO: select the parent object of the deleted object
+	 *
+	 * @param objects the objects to delete
+	 * @return 
+	 */
+	public synchronized static HashSet<Object> delete(final List<Object> objects) {
+		StatusLine.setMessage(NLS.bind(RCPMessages.DeleteObject_5, objects));
+		
+		final HashSet<Object> allObjectDeleted = new HashSet<Object>();
+		shouldRestartToolbox = false;
+		while (objects.size() > 0) {
+			Object o = objects.get(0);
+			try {
+				List<Object> deleted = delete(o);
+				allObjectDeleted.addAll(deleted);
+				if (deleted.size() == 0) {
+					StatusLine.setMessage(RCPMessages.DeleteObject_3+" : "+o);
+					return new HashSet<Object>();
+				}
+				// remove results already deleted
+				objects.removeAll(deleted);
+			} catch(Exception e) {
+				Log.info(NLS.bind(RCPMessages.DeleteObject_4, o, e)); 
+				StatusLine.error(NLS.bind(RCPMessages.DeleteObject_4, o, e)); 
+				org.txm.rcp.utils.Logger.printStackTrace(e);
+				return new HashSet<Object>();
+			}
+		}
+		
+		if (allObjectDeleted.size() > 0) {
+			
+			if (shouldRestartToolbox) {
+				org.txm.Toolbox.restartWorkspace();
+				Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
+				
+				System.err.println(RCPMessages.AddBase_10);
+				StatusLine.setMessage(RCPMessages.AddBase_10);
+			}
+			
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					try {
+//						RestartTXM.reloadViews();
+						
+						//close corresponding editors
+						for(Object obj : allObjectDeleted) {
+							closeEditorOfSelection(obj);
+						}
+					} catch(Exception e) { }
+				}
+			});
+		}
+
+		StatusLine.setMessage(""); //$NON-NLS-1$
+		return allObjectDeleted;
+	}
+
+	/**
+	 * Delete.
+	 *
+	 * @param o the o
+	 * @return the list
+	 */
+	// FIXME: when TXMResult will be implemented, remove all unused code
+	public static List<Object> delete(Object o) {
+		ArrayList<Object> deleted = new ArrayList<Object>();
+		if (o instanceof TxmObject) {
+			Log.info(NLS.bind(RCPMessages.DeleteObject_10, ((TxmObject) o).getName()));
+
+			try {
+				if (o instanceof Corpus) {
+					Corpus c = (Corpus)o;
+					if (o instanceof MainCorpus) {
+						shouldRestartToolbox = true;
+					}
+					deleted.addAll(c.clearResults());
+					deleted.addAll(c.getSubcorpora());
+					deleted.addAll(c.getPartitions());
+
+					if (!((TxmObject) o).delete()) {
+						Log.info(RCPMessages.DeleteObject_3);
+						return new ArrayList<Object>(0);
+					}
+				} else if (o instanceof Partition) {
+					Partition p = (Partition)o;
+					for (int i = 0 ; i < p.getResults().size() ; i++) {
+						deleted.addAll(delete(p.getResults().get(i)));
+						i--;
+					}
+					if (!((TxmObject) o).delete()) {
+						Log.info(RCPMessages.DeleteObject_3);
+						return new ArrayList<Object>(0);
+					}
+				}
+			} catch (Exception e) {
+				org.txm.rcp.utils.Logger.printStackTrace(e);
+			}
+		}
+		// FIXME: when TXMResult will be implemented, only this code must be left
+		else if (o instanceof TXMResult) {
+			((TXMResult) o).delete();
+			System.out.println(NLS.bind(RCPMessages.DeleteObject_10, ((TXMResult) o).getName()));
+		}
+
+
+		deleted.add(o);
+		
+		return deleted;
+	}
+
+	/**
+	 * Close the editors which uses an Object.
+	 *
+	 * @param o the object used by an editor
+	 */
+	public static void closeEditorOfSelection(Object o)
+	{
+		for (IWorkbenchPage page : getPages()) {
+			for (IEditorReference editorref : page.getEditorReferences()) {
+				IEditorPart editor = editorref.getEditor(false);
+
+				if(editor instanceof TXMEditor)	{
+					if (o == ((TXMEditor)editor).getResult())	{
+						editor.getEditorSite().getPage().closeEditor(editor, true);
+					}
+				}
+				
+			}
+		}
+	}
+
+	/**
+	 * Gets the pages.
+	 *
+	 * @return the pages
+	 */
+	public static IWorkbenchPage[] getPages()
+	{
+		for (IWorkbenchWindow win : Workbench.getInstance().getWorkbenchWindows()) {
+			return win.getPages();
+		}
+		return new IWorkbenchPage[0];
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/PasteFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/PasteFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/PasteFile.java	(revision 669)
@@ -0,0 +1,134 @@
+// 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.handlers.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.utils.IOClipboard;
+import org.txm.rcp.views.fileexplorer.Explorer;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+// TODO: Auto-generated Javadoc
+/**
+ * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
+ */
+public class PasteFile extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection instanceof IStructuredSelection) {
+			Object o = ((IStructuredSelection)selection).getFirstElement();
+
+			if (o instanceof File) {
+				paste((File)o);
+			}
+		}
+		return null;
+	}
+	
+	public static void paste(File folder) {
+
+		if (folder.isFile()) folder = folder.getParentFile();
+		if (folder.isDirectory() && folder.canWrite()) {
+			if (CopyFile.toCopy != null) {
+				File source = CopyFile.toCopy;
+				if (source.isDirectory()) return; // don't copy directory
+				
+				File dest = new File(folder, source.getName());
+				while (dest.exists()) {
+					dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
+				}
+				try {
+					if (!org.txm.utils.io.FileCopy.copy(source, dest))
+						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
+				} catch (IOException e) {
+					System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
+				}
+			} else if (CutFile.toCut != null) {
+				File source = CutFile.toCut;
+				if (source.isDirectory()) return; // don't move directory
+				File dest = new File(folder, source.getName());
+				while (dest.exists()) {
+					dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
+				}
+				try {
+					if (!org.txm.utils.io.FileCopy.copy(source, dest))
+						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
+					if (!source.delete()) 
+						System.out.println(RCPMessages.PasteFile_3+source);
+					CutFile.toCut = null;
+				} catch (IOException e) {
+					System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
+				}
+			} else {
+				// check clipboard content
+				String[] paths = IOClipboard.readFiles();
+				if (paths == null) return;
+				System.out.println("Coping files: "+StringUtils.join(Arrays.asList(paths), ", "));
+				for (String path : paths) {
+					File source = new File(path);
+					File dest = new File(folder, source.getName());
+					while (dest.exists()) {
+						dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
+					}
+					
+					try {
+						if (source.isDirectory()) {
+							org.txm.utils.io.FileCopy.copyFiles(source, dest);
+						} else {
+							if (!org.txm.utils.io.FileCopy.copy(source, dest))
+								System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
+						}
+						
+					} catch (IOException e) {
+						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
+					}
+				}
+			}
+			CopyFile.toCopy = null;
+			CutFile.toCut = null;
+			Explorer.refresh();
+			MacroExplorer.refresh();
+		}
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditSelectedFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditSelectedFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditSelectedFile.java	(revision 669)
@@ -0,0 +1,126 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.Toolbox;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.utils.logger.Log;
+
+/**
+ * Open a file in the TxtEditor
+ * 
+ * @author mdecorde.
+ */
+public class EditSelectedFile extends AbstractHandler {
+
+	public static final String ID = EditSelectedFile.class.getCanonicalName(); //$NON-NLS-1$
+	/** The lastopenedfile. */
+	public static String lastopenedfile;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		File file = null;
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection != null & selection instanceof IStructuredSelection) {
+			IStructuredSelection strucSelection = (IStructuredSelection) selection;
+			for (Object o : strucSelection.toList())
+				if (o != null && o instanceof File) {
+					file = (File)o;
+					break;
+				}
+		}
+
+		if (file == null) {
+			System.out.println("Selection has no file. Aborting.");
+			return null;
+		} else {
+			if (file.isDirectory()) {
+				System.out.println("Selected file is a directory. Aborting.");
+				return null;
+			} else {
+				openfile(file.getAbsolutePath());
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Open a file in TXM TxtEditor.
+	 *
+	 * @param filepath the filepath
+	 */
+	static public void openfile(File file) {
+		if (file.isDirectory())
+			return;
+		try {
+			IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(file.toURI());
+
+			FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
+			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+			IWorkbenchPage page = window.getActivePage();
+
+			IEditorPart a = page.openEditor(editorInput, TxtEditor.ID, true);
+			TxtEditor editor = (TxtEditor) a;
+		} catch (Exception e) {
+			Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Openfile.
+	 *
+	 * @param filepath the filepath
+	 */
+	static public void openfile(String filepath) {
+		openfile(new File(filepath));
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFolder.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFolder.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFolder.java	(revision 669)
@@ -0,0 +1,110 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.views.fileexplorer.Explorer;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: create a directory depending on the selection
+ */
+public class CreateFolder extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.CreateFolder"; //$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 {
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+
+		//get scripts dir
+		//FIXME: the default value should be defined in the preferences initializer
+		String dir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, null, TBXPreferences.PREFERENCES_NODE, System.getProperty("user.home")); //$NON-NLS-1$
+
+		//if selection is a file, get its path
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		boolean useSavedValue = true;
+		if (selection instanceof IStructuredSelection) {
+			IStructuredSelection sel = (IStructuredSelection) selection;
+			Object obj = sel.getFirstElement();
+
+			if (obj instanceof File) {
+				File current = ((File)obj);
+				if (current.isDirectory())
+					dir = current.getAbsolutePath();
+				else
+					dir = current.getParent();
+				useSavedValue = false;
+			}
+		}
+		//ask new file name
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+				.getShell();
+		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+
+		if (LastOpened.getFile(ID) != null && useSavedValue) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+			dialog.setFileName(LastOpened.getFile(ID));
+		} else {
+			dialog.setFilterPath(dir);
+		}
+		String path = dialog.open();
+		if (path == null) return null;
+		//create the new file
+		File newfile = new File(path);
+		LastOpened.set(ID, newfile.getParent(), newfile.getName());
+		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
+			if (newfile.mkdir())
+				System.out.println(NLS.bind(RCPMessages.CreateFolder_1, newfile.getAbsolutePath()));
+
+		}
+		Explorer.refresh();
+		MacroExplorer.refresh();
+
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java	(revision 669)
@@ -0,0 +1,125 @@
+// 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.handlers.files;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.views.fileexplorer.Explorer;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+import org.txm.utils.DeleteDir;
+// TODO: Auto-generated Javadoc
+/**
+ * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
+ */
+public class DeleteFile extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection instanceof IStructuredSelection) {
+			Object o = ((IStructuredSelection)selection).getFirstElement();
+
+			if (o instanceof File) {
+				File file = (File)o;
+				delete(file);
+			}
+		}
+		return null;
+	}
+
+	public static void delete(File file) {
+		//ask new file name
+
+		Shell shell = new Shell();
+		MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO);
+		dialog.setMessage(RCPMessages.DeleteFile_0+file+" ? ");  //$NON-NLS-1$
+
+		int buttonID = dialog.open();
+		switch(buttonID) {
+		case SWT.YES:
+			if (file.isFile()) {
+				if (!file.delete()) System.out.println(RCPMessages.DeleteFile_2+file);
+			} else if (file.isDirectory()) {
+				if (!DeleteDir.deleteDirectory(file)) System.out.println(RCPMessages.DeleteFile_2+file);
+			}
+			Explorer.refresh();
+			MacroExplorer.refresh();
+		case SWT.NO:
+			// exits here ...
+			break;
+		case SWT.CANCEL:
+			// does nothing ...
+		}
+	}
+
+	public static void delete(List files) {
+		Shell shell = new Shell();
+		MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO);
+		dialog.setMessage(RCPMessages.DeleteFile_0+files+" ? ");  //$NON-NLS-1$
+		
+		int buttonID = dialog.open();
+		switch(buttonID) {
+		case SWT.YES:
+			for (Object o : files) {
+				if (o instanceof File) {
+					File file = (File) o;
+					if (file.exists())
+					if (file.isFile()) {
+						if (!file.delete()) System.out.println(RCPMessages.DeleteFile_2+file);
+					} else if (file.isDirectory()) {
+						if (!DeleteDir.deleteDirectory(file)) System.out.println(RCPMessages.DeleteFile_2+file);
+					}
+				}
+			}
+			Explorer.refresh();
+			MacroExplorer.refresh();
+		case SWT.NO:
+			// exits here ...
+			break;
+		case SWT.CANCEL:
+			// does nothing ...
+		}
+		
+		
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CreateFile.java	(revision 669)
@@ -0,0 +1,123 @@
+// 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.handlers.files;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.views.fileexplorer.Explorer;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: create a file depending on the selection
+ */
+public class CreateFile extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.CreateFile"; //$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 {
+
+		//get scripts dir
+		String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
+
+		boolean useSavedValue = true; // if a file/folder is selected, dont use the saved value
+		
+		//if selection is a file, get its path
+		IWorkbenchWindow activeW = HandlerUtil.getActiveWorkbenchWindow(event);
+		if (activeW != null) {
+			IWorkbenchPage activeP = activeW.getActivePage();
+			if (activeP != null) {
+				ISelection selection = activeP.getSelection();
+				if (selection != null && selection instanceof IStructuredSelection) {
+					IStructuredSelection sel = (IStructuredSelection) selection;
+					Object obj = sel.getFirstElement();
+					if (obj instanceof File) {
+						File current = ((File)obj);
+						if (current.isDirectory()) {
+							scriptCurrentDir = current.getAbsolutePath();
+						} else {
+							scriptCurrentDir = current.getParent();
+						}
+						useSavedValue = false;
+					}
+					
+				}
+			}
+		}
+
+		//ask new file name
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+		if (LastOpened.getFile(ID) != null && useSavedValue) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+			dialog.setFileName(LastOpened.getFile(ID));
+		} else {
+			dialog.setFilterPath(scriptCurrentDir);
+		}
+		String path = dialog.open();
+
+		if (path == null) return null;
+
+		//create the new file
+		File newfile = new File(path);
+		LastOpened.set(ID, newfile.getParent(), newfile.getName());
+		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
+			try {
+				if (newfile.createNewFile()) {
+					System.out.println(NLS.bind(RCPMessages.CreateFile_1, newfile.getAbsolutePath()));
+					//OpenFile.openfile(newfile);
+				}
+			} catch (IOException e) {
+				System.out.println(e.getLocalizedMessage());
+			}
+		}
+		EditFile.openfile(newfile);
+		Explorer.refresh();
+		MacroExplorer.refresh();
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/EditFile.java	(revision 669)
@@ -0,0 +1,115 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.utils.logger.Log;
+
+/**
+ * Open a file in the TxtEditor
+ * 
+ * @author mdecorde.
+ */
+public class EditFile extends AbstractHandler {
+
+	public static final String ID = EditFile.class.getCanonicalName(); //$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 {
+
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		String txmhome = Toolbox.getTXMHOMEPATH();
+
+		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+			dialog.setFileName(LastOpened.getFile(ID));
+		} else {
+			dialog.setFilterPath(txmhome);
+		}
+		if (dialog.open() == null) return null;
+		String filepath = dialog.getFilterPath() + "/" + dialog.getFileName(); //$NON-NLS-1$
+		LastOpened.set(ID, dialog.getFilterPath(), dialog.getFileName());
+		openfile(filepath);
+
+		return null;
+	}
+
+	/**
+	 * Open a file in TXM TxtEditor.
+	 *
+	 * @param filepath the filepath
+	 */
+	static public void openfile(File file) {
+		if (file.isDirectory())
+			return;
+		try {
+			IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(file.toURI());
+
+			FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
+			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+			IWorkbenchPage page = window.getActivePage();
+
+			IEditorPart a = page.openEditor(editorInput, TxtEditor.ID, true);
+			TxtEditor editor = (TxtEditor) a;
+		} catch (Exception e) {
+			Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Openfile.
+	 *
+	 * @param filepath the filepath
+	 */
+	static public void openfile(String filepath) {
+		openfile(new File(filepath));
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DownloadFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DownloadFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DownloadFile.java	(revision 669)
@@ -0,0 +1,84 @@
+package org.txm.rcp.handlers.files;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.rcp.utils.DownloadJobHandler;
+import org.txm.utils.logger.Log;
+
+public class DownloadFile  extends AbstractHandler {
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public static boolean download(URL url, File outputDirectory) {
+		String filename = url.getFile();
+		File outfile = new File(outputDirectory, filename);
+		Boolean done = false;
+
+		BufferedOutputStream writeFile = null;
+		HttpURLConnection connection = null;
+		InputStream input = null;
+		try {
+			connection = (HttpURLConnection)url.openConnection();  
+			connection.connect();  
+
+			// Check if the request is handled successfully  
+			if (connection.getResponseCode() / 100 == 2) { 
+
+				// size in bytes  
+				final int contentLength = connection.getContentLength(); 
+
+				if (contentLength == -1) {
+					System.out.println("Could not get file size");
+				} else {
+					done = false;
+
+					DownloadJobHandler job = new DownloadJobHandler("Download "+url, outfile, contentLength, done);
+					job.schedule();					
+
+					writeFile = new BufferedOutputStream(new FileOutputStream(outfile));
+					input = connection.getInputStream();
+					byte[] buffer = new byte[1024];
+					int read;
+					while ((read = input.read(buffer)) > 0)
+						writeFile.write(buffer, 0, read);
+
+					done = true;
+					job.done();
+				}
+			}
+		} catch (IOException e) {
+			Log.printStackTrace(e);
+			return false;
+		} finally {
+			if (writeFile != null)
+				try {
+					writeFile.close();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			if (input != null)
+				try {
+					input.close();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			if (connection != null) connection.disconnect();
+		}
+		return true;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/RenameFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/RenameFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/RenameFile.java	(revision 669)
@@ -0,0 +1,84 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.views.fileexplorer.Explorer;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+// TODO: Auto-generated Javadoc
+/**
+ * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
+ */
+public class RenameFile extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection instanceof IStructuredSelection) {
+			Object o = ((IStructuredSelection)selection).getFirstElement();
+
+			if (o instanceof File) {
+				File file = (File)o;
+				rename(file);
+			}
+		}
+		return null;
+	}
+
+	public static void rename(File file) {
+		String newname = file.getName();
+		InputDialog dlg = new InputDialog(new Shell(),
+				RCPMessages.RenameFile_0, RCPMessages.RenameFile_0+newname, newname, null);
+		if (dlg.open() == Window.OK) {
+			newname = dlg.getValue();
+			System.out.println(RCPMessages.RenameFile_2+newname);
+			if (newname.equals(file.getName())) return; // nothing to do
+			if (newname == null || newname.trim().length() == 0) return; // error
+			
+			if (!file.renameTo(new File(file.getParentFile(), newname)))
+				System.out.println(RCPMessages.RenameFile_3+file+RCPMessages.ApplicationWorkbenchAdvisor_37+newname);
+			Explorer.refresh();
+			MacroExplorer.refresh();
+		}
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CopyFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CopyFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CopyFile.java	(revision 669)
@@ -0,0 +1,69 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+/**
+ * Handler: copy the selected file. 
+ * 
+ * @author mdecorde
+ */
+public class CopyFile extends AbstractHandler {
+
+	public static File toCopy;
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection instanceof IStructuredSelection) {
+			Object o = ((IStructuredSelection)selection).getFirstElement();
+
+			if (o instanceof File) {
+				File file = (File)o;
+				copy(file);
+			}
+		}
+		return null;
+	}
+	
+	public static void copy(File file) {
+		toCopy = file;
+		CutFile.toCut = null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CutFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CutFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/CutFile.java	(revision 669)
@@ -0,0 +1,70 @@
+// 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.handlers.files;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.utils.IOClipboard;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: cuts the selected file 
+ */
+public class CutFile extends AbstractHandler {
+
+	public static File toCut;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (selection instanceof IStructuredSelection) {
+			Object o = ((IStructuredSelection)selection).getFirstElement();
+
+			if (o instanceof File) {
+				File file = (File)o;
+				cut(file);
+			}
+		}
+		return null;
+	}
+	
+	public static void cut(File file) {
+		toCut = file;
+		CopyFile.toCopy = null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScriptFromFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScriptFromFile.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScriptFromFile.java	(revision 669)
@@ -0,0 +1,83 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.swt.dialog.LastOpened;
+/**
+ *  Ask the user to select a Groovy script using a File dialog and execute it
+ */
+public class ExecuteGroovyScriptFromFile extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.ExecuteGroovyScriptFromFile"; //$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 {
+
+		// the file to execute
+		String result; //$NON-NLS-1$
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+
+		String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
+
+		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+			dialog.setFileName(LastOpened.getFile(ID));
+		} else {
+			dialog.setFilterPath(scriptCurrentDir);
+		}
+
+		dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
+		dialog.setFilterPath(scriptCurrentDir);
+		result = dialog.open();
+		if (result == null) return null;
+		
+		LastOpened.set(ID, new File(result));
+		ExecuteGroovyScript.executeScript(result, page, selection);
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteLastGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteLastGroovyScript.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteLastGroovyScript.java	(revision 669)
@@ -0,0 +1,100 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.rcp.RCPMessages;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: execute a Macro (Groovy script that opens an UI for parameters)
+ */
+public class ExecuteLastGroovyScript extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.ExecuteMacro"; //$NON-NLS-1$
+	public static File lastScript;
+	public static boolean macro = false;
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		
+		execute(page, selection);
+		
+		return null;
+	}
+	
+	public static void setLastScript(File s, boolean b) {
+		lastScript = s;
+		macro = b;
+	}
+	
+	/**
+	 * Execute last Groovy script
+	 * 
+	 * @param page
+	 * @param selection
+	 */
+	public static void execute(IWorkbenchPart page, ISelection selection) {
+		if (lastScript == null) return; // no last script
+		if (macro)
+			System.out.println(RCPMessages.ExecuteLastGroovyScript_0+lastScript);
+		else 
+			System.out.println(RCPMessages.ExecuteLastGroovyScript_1+lastScript);
+		
+		//IPreferencesService service = Platform.getPreferencesService();
+		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+		File currentRootDir;
+		if (macro) {
+			currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
+		} else {
+			currentRootDir = new File(scriptRootDir, "user"); //$NON-NLS-1$
+		}
+		
+		if (!currentRootDir.exists()) {
+			System.out.println(RCPMessages.ExecuteLastGroovyScript_3+currentRootDir);
+			return;
+		}
+		
+		ExecuteGroovyScript.executeScript(currentRootDir, lastScript.getAbsolutePath(), page, selection, false);
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java	(revision 669)
@@ -0,0 +1,337 @@
+// 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.handlers.scripts;
+
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.logging.Level;
+
+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.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.EngineType;
+import org.txm.Toolbox;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.importer.ImportKeys;
+import org.txm.objects.Base;
+import org.txm.objects.BaseParameters;
+import org.txm.rcp.Application;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.commands.OpenImportForm;
+import org.txm.rcp.commands.RestartTXM;
+import org.txm.rcp.commands.workspace.LoadBinaryCorpus;
+import org.txm.rcp.utils.GSERunner;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.CQPEngine;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.tokenizer.TokenizerClasses;
+import org.txm.utils.BundleUtils;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.ExecTimer;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Execute an import module (Groovy script).
+ * Binds parameters to the script :
+ * paramsBinding: parameter file
+ * monitor= the job	
+ * debug=true|false
+ * readyToLoad=tested after the script. If true then the process went OK. 
+ *
+ * @author mdecorde
+ */
+public class ExecuteImportScript extends AbstractHandler {
+
+	/** The lastopenedbase. */
+	public static File lastopenedbase;
+	protected static GroovyScriptEngine gse;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		String filename = null, filepath = null;
+		if (event.getParameters().containsKey("org.txm.rcp.commands.commandParameter3")) {
+			filename = event.getParameter("org.txm.rcp.commands.commandParameter3"); //$NON-NLS-1$
+			filepath = "scripts/import/" + filename; //$NON-NLS-1$
+		} else {
+			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+			FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+			dialog.setFilterPath(Toolbox.getTXMHOMEPATH()+"/scripts/import");
+			filepath = dialog.open();
+		}
+		
+		if (filepath == null) return null;
+		
+		OpenImportForm.openfile(filepath);
+		return null;
+	}
+
+
+	public static JobHandler executeScript(String scriptFilePath,
+			File paramFile) {
+		BaseParameters params = null;
+		try {
+			params = new BaseParameters(paramFile);
+		} catch (Exception e1) {
+			org.txm.rcp.utils.Logger.printStackTrace(e1);
+			System.out.println("Error while reading import parameters from: "+paramFile);
+			return null;
+		}
+		return executeScript(scriptFilePath, params);
+	}
+
+	/**
+	 * 
+	 * @param scriptFilePath 
+	 * @param params
+	 * @return
+	 */
+	public static JobHandler executeScript(final String scriptFilePath, BaseParameters params) {
+
+		final File script = new File(scriptFilePath);
+		getImportScriptFromToolboxPlugin(script); // if the file is missing or older than the Toolbox jar script
+
+		// We could not found the script in the Toolbox plugin files
+		if (!script.exists()) {
+			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1, scriptFilePath));
+			return null;
+		}
+
+		Display.getDefault().syncExec(new Runnable() {
+			public void run() {	StatusLine.setMessage(RCPMessages.ExecuteScriptImport_0); }
+		});
+
+		final String txmhome = Toolbox.getTXMHOMEPATH();
+		final File corporadir = new File(txmhome,"corpora"); //$NON-NLS-1$
+		corporadir.mkdir(); // the binary corpus are stored here
+		if (!corporadir.exists()) {
+			System.out.println(RCPMessages.ExecuteScriptImport_2+corporadir);
+			Log.severe(RCPMessages.ExecuteScriptImport_2+corporadir);
+			return null;
+		}
+
+		// groovy configuration
+		IPreferencesService service = Platform.getPreferencesService();
+		final String scriptRootDir = service.getString(Application.PLUGIN_ID,
+				TBXPreferences.USER_TXM_HOME+"/scripts",
+				"", null);
+		
+//		ClassLoader parent = ExecuteImportScript.class.getClassLoader();
+//		final GroovyClassLoader loader = new GroovyClassLoader(parent);
+//		final String[] roots = new String[] { 
+//				scriptRootDir,
+//				scriptRootDir+"/user/", //$NON-NLS-1$
+//				scriptRootDir+"/macro/", //$NON-NLS-1$
+//				script.getParent(),
+//				};
+		
+		params.load(); // reload params
+
+		// the binary directory which is going to be created
+
+		final File basedir = new File(corporadir, params.name);
+		final File tempBinDirectory = new File(basedir.getAbsolutePath()+"_temp"); //$NON-NLS-1$
+		final File errorBinDirectory = new File(basedir.getAbsolutePath()+"_error"); //$NON-NLS-1$
+		if (tempBinDirectory.exists()) DeleteDir.deleteDirectory(tempBinDirectory);
+		if (errorBinDirectory.exists()) DeleteDir.deleteDirectory(errorBinDirectory);
+
+		boolean updatingCorpus = "true".equals(params.getKeyValueParameters().get(ImportKeys.UPDATECORPUS));
+		if (!updatingCorpus) { 
+			if (basedir.exists()) {
+				Shell shell = new Shell(); // ask user if he's sure
+				boolean b = MessageDialog.openConfirm(shell, RCPMessages.AddBase_19, NLS.bind(RCPMessages.AddBase_20, basedir.getName().toUpperCase()));
+				if (b) {
+					// shutdown TBX (and cwb) to free index files
+					Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
+					//DeleteDir.deleteDirectory(basedir);
+					basedir.renameTo(tempBinDirectory);
+				} else {
+					return null;
+				}
+			}
+			if (basedir.exists()) {
+				System.out.println(RCPMessages.bind(RCPMessages.ExecuteScriptImport_3, basedir));
+				return null;
+			}
+		}
+		
+		if (CQPEngine.isInitialized()) Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
+		final BaseParameters p = params;
+		JobHandler jobhandler = new JobHandler(RCPMessages.RunGroovyScript_0
+				+ script.getAbsolutePath()) { //$NON-NLS-1$
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				Base base = null;
+				try {
+					//this.setCurrentMonitor(monitor);
+					monitor.beginTask(RCPMessages.RunGroovyScript_10 + p.rootDir, 100); //$NON-NLS-1$
+
+					//org.txm.Toolbox.shutdownSearchEngine();
+					monitor.worked(5);
+
+					//				if (ExecuteImportScript.gse == null)
+					ExecuteImportScript.gse = ExecuteGroovyScript.buildGSE(scriptRootDir, script);
+					
+
+					Binding binding = new Binding();
+					binding.setProperty("paramsBinding", p); //$NON-NLS-1$
+					binding.setProperty("monitor", this); //$NON-NLS-1$
+
+					boolean logLevel = Log.getLevel().intValue() < Level.WARNING.intValue();			
+					binding.setProperty("debug", logLevel); //$NON-NLS-1$
+					binding.setProperty("readyToLoad", Boolean.FALSE); //$NON-NLS-1$
+
+					Element corpusElem = p.corpora.get(p.getCorpusName());
+					Element tokenizerElement = p.getTokenizerElement(corpusElem);
+					TokenizerClasses.reset();
+					if (!TokenizerClasses.loadFromNode(tokenizerElement)) {
+						System.out.println(RCPMessages.ExecuteScriptImport_5);
+						monitor.done();
+						if (basedir.exists()) basedir.renameTo(errorBinDirectory);
+						if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
+						return Status.CANCEL_STATUS;
+					}
+
+					ExecTimer.start();
+					Log.info(RCPMessages.RunGroovyScript_0 + script.getAbsolutePath()); //$NON-NLS-1$
+					gse.run(script.getName(), binding); // run the groovy import script
+					System.out.println("\n"+RCPMessages.ExecuteScriptImport_7+ExecTimer.stop()); //$NON-NLS-1$
+					monitor.worked(90);
+					
+					TokenizerClasses.reset();
+
+					Object ready = binding.getVariable("readyToLoad"); //$NON-NLS-1$
+					if (ready != null && ready instanceof Boolean) {
+						Boolean readyToLoad = (Boolean)ready;
+						//System.out.println("TRY TO LOAD THE BINARY CORPUS CREATED: "+basedir);
+						if (readyToLoad) {
+							base = LoadBinaryCorpus.loadBinaryCorpus(basedir);
+							if (base == null) {
+								System.out.println(RCPMessages.ExecuteScriptImport_8);
+								if (basedir.exists()) basedir.renameTo(errorBinDirectory);
+								if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
+								return Status.CANCEL_STATUS;
+							}
+							this.acquireSemaphore();
+							Log.info("Save workspace"); //$NON-NLS-1$
+							Toolbox.workspace.save();
+							
+							Log.info("Restart Toolbox search engine"); //$NON-NLS-1$
+							Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
+							final Base base2 = base;
+							syncExec(new Runnable() {
+								@Override
+								public void run() {
+									RestartTXM.reloadViews();
+									CorporaView.select(base2.getChildren(MainCorpus.class));
+									System.out.println(RCPMessages.AddBase_10);
+									StatusLine.setMessage(RCPMessages.AddBase_10);
+								}
+							});
+							this.releaseSemaphore();
+
+							DeleteDir.deleteDirectory(tempBinDirectory);
+						} else {
+							System.out.println(RCPMessages.ExecuteScriptImport_6);
+							if (basedir.exists()) basedir.renameTo(errorBinDirectory);
+							if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
+						}
+					}
+				} catch (ThreadDeath td) {
+					return Status.CANCEL_STATUS;
+				} catch (Exception e) {
+					System.out.println(NLS.bind(RCPMessages.RunGroovyScript_8, e));
+					org.txm.rcp.utils.Logger.printStackTrace(e);
+				} finally {
+					if (!CQPEngine.isInitialized()) { // the import failed
+						monitor.setTaskName("Restarting Toolbox search engine"); //$NON-NLS-1$
+						Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
+						
+						syncExec(new Runnable() {
+							@Override
+							public void run() {
+								RestartTXM.reloadViews();
+							}
+						});
+					}
+					
+					monitor.done();
+				}
+				System.gc();
+				return Status.OK_STATUS;
+			}
+		};
+		jobhandler.startJob(true);
+		return jobhandler;
+	}
+	
+	/**
+	 * Allow to retrieve an import script from the Toolbox plugin.
+	 * 
+	 * If TXM is run from Eclipse, then the file is copyied, else it is extracted from TXM installation directory
+	 * 
+	 * @param script the import script Loader to retrieve
+	 * @return
+	 */
+	public static boolean getImportScriptFromToolboxPlugin(File script) {
+		Log.info("Retriving "+script+" from Toolbox plugin if script.date < toolbox_script.date");
+		
+		// retrieve the script relative path "quickLoader" -> "quick"
+		String scriptPackage = script.getName();
+		int idx = scriptPackage.indexOf("Loader");
+		scriptPackage = "org/txm/importer/" + scriptPackage.substring(0, idx);
+		
+		return BundleUtils.replaceFilesIfNewer("org.txm.core", "src/groovy", scriptPackage, 
+				script.getName(), script);
+	}
+}
+

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/CreateMacro.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/CreateMacro.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/CreateMacro.java	(revision 669)
@@ -0,0 +1,206 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.views.fileexplorer.MacroExplorer;
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.io.IOUtils;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: creates a macro template
+ */
+public class CreateMacro extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.CreateMacro"; //$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 {
+
+		//get scripts dir
+		String scriptRootDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
+		File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
+
+		//if selection is a file, get its path
+		String dir = null;
+		IWorkbenchWindow activeW = HandlerUtil.getActiveWorkbenchWindow(event);
+		if (activeW != null) {
+			IWorkbenchPage activeP = activeW.getActivePage();
+			if (activeP != null) {
+				ISelection selection = activeP.getSelection();
+				if (selection != null && selection instanceof IStructuredSelection) {
+					IStructuredSelection sel = (IStructuredSelection) selection;
+					Object obj = sel.getFirstElement();
+					if (obj instanceof File) {
+						File current = ((File)obj);
+						if (current.isDirectory()) {
+							dir = current.getAbsolutePath();
+						} else {
+							dir = current.getParent();
+						}
+					}
+				}
+			}
+		}
+
+		if (dir == null) {
+			dir = currentRootDir.getAbsolutePath();
+		}
+		
+		//ask new file name
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		InputDialog dialog = new InputDialog(shell, RCPMessages.CreateMacro_0, RCPMessages.CreateMacro_1, "", null); //$NON-NLS-1$
+		
+		dialog.open();
+		String name = dialog.getValue();
+		
+		return createMacro(dir, name);
+	}
+	
+	public static boolean createMacro(String dir, String name) {
+		if (name == null) return false;
+		if (dir == null) return false;
+		
+		int idx = dir.indexOf("scripts/macro/org/txm/macro/");
+		String packagePath = "org.txm.macro";
+		if (idx > 0) {
+			String sub = dir.substring(idx + "scripts/macro/org/txm/macro/".length(), dir.length()).replaceAll("/", ".").replaceAll("\\\\", ".");
+			if (sub.trim().length() > 0) {
+				packagePath += "."+sub;
+			}
+		}
+		name = name.replaceAll("\\p{Punct}", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		name = AsciiUtils.convertNonAscii(name);
+		name = name.substring(0, 1).toUpperCase()+name.substring(1);
+		StringBuffer tmp = new StringBuffer();
+		for (int i = 0 ; i < name.length() ; i++) {
+			if (name.charAt(i) == ' ') {
+				i++;
+				if (i <name.length() )
+					tmp.append((""+name.charAt(i)).toUpperCase()); //$NON-NLS-1$
+			} else {
+				tmp.append(name.charAt(i));
+			}
+		}
+		name = tmp.toString();
+		if (name == null) return false;
+
+		//create the new file
+		File newfile = new File(dir, name+"Macro.groovy"); //$NON-NLS-1$
+		LastOpened.set(ID, newfile.getParent(), newfile.getName());
+		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
+			try {
+				if (newfile.createNewFile()) {
+					System.out.println(NLS.bind(RCPMessages.CreateFile_1, newfile.getAbsolutePath()));
+					
+					PrintWriter writer = IOUtils.getWriter(newfile, "UTF-8"); //$NON-NLS-1$
+					writer.println("// STANDARD DECLARATIONS"); //$NON-NLS-1$
+					writer.println("package "+packagePath); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("import org.kohsuke.args4j.*"); //$NON-NLS-1$
+					writer.println("import groovy.transform.Field"); //$NON-NLS-1$
+					writer.println("import org.txm.rcp.swt.widget.parameters.*"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("// BEGINNING OF PARAMETERS"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("// Declare each parameter here"); //$NON-NLS-1$
+					writer.println("// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"query\", usage=\"an example query\", widget=\"Query\", required=true, def='[pos=\"V.*\"]')"); //$NON-NLS-1$
+					writer.println("//def query"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"inputFile\", usage=\"an example file\", widget=\"FileOpen\", required=true, def=\"C:/Temp/foo.txt\")"); //$NON-NLS-1$
+					writer.println("//def inputFile"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"outputFile\", usage=\"an example file\", widget=\"FileSave\", required=true, def=\"C:/Temp/foo.txt\")"); //$NON-NLS-1$
+					writer.println("//def outputFile"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"folder\", usage=\"an example folder\", widget=\"Folder\", required=false, def=\"C:/Temp\")"); //$NON-NLS-1$
+					writer.println("//def folder"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"date\", usage=\"an example date\", widget=\"Date\", required=false, def=\"1984-09-01\")"); //$NON-NLS-1$
+					writer.println("//def date"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"integer\", usage=\"an example integer\", widget=\"Integer\", required=false, def=\"42\")"); //$NON-NLS-1$
+					writer.println("//def integer"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"floatValue\", usage=\"an example float\", widget=\"Float\", required=false, def=\"42.42\")"); //$NON-NLS-1$
+					writer.println("//def floatValue"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"string\", usage=\"an example string\", widget=\"String\", required=false, def=\"hello world!\")"); //$NON-NLS-1$
+					writer.println("//def string"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"longString\", usage=\"an example longString\", widget=\"Text\", required=false, def=\"hello world!\")"); //$NON-NLS-1$
+					writer.println("//def longString"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("//@Field @Option(name=\"bool\", usage=\"an example boolean\", widget=\"Boolean\", required=false, def=\"true\")"); //$NON-NLS-1$
+					writer.println("//def bool"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("// Open the parameters input dialog box"); //$NON-NLS-1$
+					writer.println("if (!ParametersDialog.open(this)) return;"); //$NON-NLS-1$
+					writer.println(""); //$NON-NLS-1$
+					writer.println("// END OF PARAMETERS"); //$NON-NLS-1$ 
+					writer.println(""); //$NON-NLS-1$
+					writer.println("println \"corpora selection: \"+corpusViewSelection"); //$NON-NLS-1$
+					writer.close();
+					
+					EditFile.openfile(newfile);
+					//Explorer.refresh();
+					MacroExplorer.refresh();
+				}
+			} catch (IOException e) {
+				System.out.println(e.getLocalizedMessage());
+				return false;
+			}
+		}
+		
+		
+		return true;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteScript.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteScript.java	(revision 669)
@@ -0,0 +1,194 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.preferences.RCPPreferences;
+import org.txm.rcp.swt.dialog.LastOpened;
+// TODO: Auto-generated Javadoc
+/**
+ * Execute a script. It uses the file extension to execute it as Groovy or R
+ * 
+ * Later : use shabang
+ */
+public class ExecuteScript extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.ExecuteScript"; //$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 {
+
+		// the file to execute
+		String result = ""; //$NON-NLS-1$
+		boolean executionFromEditor = false;
+		TxtEditor txteditor = null;
+		
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (page != null && page instanceof TxtEditor) {
+			txteditor = (TxtEditor) page;
+			selection = HandlerUtil.getActiveWorkbenchWindow(event)
+					.getActivePage().getSelection();
+			FileStoreEditorInput input = (FileStoreEditorInput) txteditor
+					.getEditorInput();
+
+			File f = new File(input.getURI().getPath());
+			result = f.getAbsolutePath();
+			executionFromEditor = true;
+		} else if (selection != null
+				& selection instanceof IStructuredSelection) {
+			File file = null;
+			IStructuredSelection strucSelection = (IStructuredSelection) selection;
+			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
+					.hasNext();) {
+				file = (File) iterator.next();
+				result = file.getAbsolutePath();
+				break;
+			}
+		}
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+				.getShell();
+		// no file found, ask user
+		if (result == "") //$NON-NLS-1$
+		{
+			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+			if (LastOpened.getFile(ID) != null) {
+				dialog.setFilterPath(LastOpened.getFolder(ID));
+				dialog.setFileName(LastOpened.getFile(ID));
+			}
+			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
+
+			String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
+
+			dialog.setFilterPath(scriptCurrentDir);
+			result = dialog.open();
+			if (result == null) return null;
+			LastOpened.set(ID, new File(result));
+		}
+
+		if (executionFromEditor && txteditor != null) { // save file if needed 
+			if (txteditor.isSaveOnCloseNeeded()) { // check if file need to be saved
+				boolean doit = TXMPreferences.getBoolean(RCPPreferences.SAVE_BEFORE_EXECUTION, RCPPreferences.PREFERENCES_NODE);
+				//System.out.println("Save file? "+doit);
+				if (!doit) { // ask user
+					MessageDialog dialog = new MessageDialog(shell, RCPMessages.ExecuteScript_0+result, null,
+							RCPMessages.ExecuteScript_1, MessageDialog.QUESTION, new String[] {RCPMessages.ExecuteScript_2, RCPMessages.ExecuteScript_4,
+							RCPMessages.ExecuteScript_5}, 0) {
+						Button checkDefault;
+						 @Override
+						  protected Control createDialogArea(Composite parent) {
+						    Composite container = (Composite) super.createDialogArea(parent);
+						    checkDefault = new Button(container, SWT.CHECK);
+						    checkDefault.setText(RCPMessages.ExecuteScript_6);
+						    boolean b = TXMPreferences.getBoolean(RCPPreferences.SAVE_BEFORE_EXECUTION, RCPPreferences.PREFERENCES_NODE);
+						    checkDefault.setSelection(b);
+						    
+						    checkDefault.addSelectionListener(new SelectionListener() {
+								
+								@Override
+								public void widgetSelected(SelectionEvent e) {
+									boolean b = checkDefault.getSelection();
+									TXMPreferences.put(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION, b);
+								}
+								
+								@Override
+								public void widgetDefaultSelected(SelectionEvent e) { }
+							});
+						    return container;
+						  }
+					};
+					int c = dialog.open();
+					if (c == 1) {
+						System.out.println(RCPMessages.ExecuteScript_7);
+						return null;
+					} else if (c == 2) {
+						//System.out.println("Don't save and run.");
+						doit = false;
+					} else if (c == 0)  {
+						//System.out.println("Save and run.");
+						doit = true;
+					}
+				}
+
+				if (doit) {
+					//System.out.println("Saving file...");
+					txteditor.doSave(null);
+				}
+			}
+		}
+
+		executeScript(result, page, selection);
+		return null;
+	}
+
+	/**
+	 * Execute script.
+	 *
+	 * @param scriptpath the scriptfile
+	 */
+	public void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection) {
+		if (scriptpath == null) return;
+		File script = new File(scriptpath);
+		if (!script.exists()) return;
+
+		if (script.getName().endsWith(".groovy")) { //$NON-NLS-1$
+			ExecuteGroovyScript.executeScript(scriptpath, page, selection);
+		} else if (script.getName().endsWith(".R")) { //$NON-NLS-1$
+			System.out.println("ExecuteScript with R not implemented");
+			//ExecuteRScript.executeScript(scriptpath);
+		} else {
+			System.out.println(RCPMessages.ExecuteScript_3+script.getName());
+		}
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteText.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteText.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteText.java	(revision 669)
@@ -0,0 +1,95 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.editors.TxtEditor;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: execute a selection of code from the TxtEditor. It uses the file extension to execute it as Groovy or R.
+ * 
+ * 
+ * @author mdecorde.
+ */
+public class ExecuteText extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getSelection();
+		if(!(selection instanceof TextSelection)) return null;
+		
+		TextSelection t = (TextSelection) selection;
+		String result = t.getText();
+
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
+		if (!(page instanceof TxtEditor)) return null;
+		TxtEditor te = (TxtEditor) page;
+		FileStoreEditorInput input = (FileStoreEditorInput) te.getEditorInput();
+
+		File f = new File(input.getURI().getPath());
+		String scriptfile = f.getAbsolutePath();
+
+		return executeText(result, scriptfile);
+	}
+
+	/**
+	 * Execute text.
+	 *
+	 * @param text the text
+	 * @param scriptfile the scriptfile
+	 * @return the object
+	 */
+	public static Object executeText(final String text, final String scriptfile) {
+		File script = new File(scriptfile);
+		if (script.getName().endsWith(".groovy")) { //$NON-NLS-1$
+			ExecuteGroovyText.executeText(text, scriptfile);
+		} else if (script.getName().endsWith(".R")) { //$NON-NLS-1$
+			System.out.println("Execute R text selection not implemented");
+			//ExecuteRText.executeText(text);
+		} else {
+			System.out.println(RCPMessages.ExecuteScript_3+script.getName());
+		}
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyMacro.java	(revision 669)
@@ -0,0 +1,125 @@
+// 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.handlers.scripts;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.swt.dialog.LastOpened;
+// TODO: Auto-generated Javadoc
+/**
+ * Handler: execute a Macro (Groovy script that opens an UI for parameters)
+ */
+public class ExecuteGroovyMacro extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.ExecuteMacro"; //$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 {
+
+		String filenameParameter = event
+				.getParameter("org.txm.rcp.command.parameter.file"); //$NON-NLS-1$
+		
+		
+		// the file to execute
+		String result = ""; //$NON-NLS-1$
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (page != null && page instanceof TxtEditor) {
+			TxtEditor te = (TxtEditor) page;
+			selection = HandlerUtil.getActiveWorkbenchWindow(event)
+					.getActivePage().getSelection();
+			FileStoreEditorInput input = (FileStoreEditorInput) te
+					.getEditorInput();
+
+			File f = new File(input.getURI().getPath());
+			result = f.getAbsolutePath();
+		} else if (filenameParameter != null) {
+			result = filenameParameter;
+		} else if (selection != null
+				& selection instanceof IStructuredSelection) {
+			File file = null;
+			IStructuredSelection strucSelection = (IStructuredSelection) selection;
+			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
+					.hasNext();) {
+				file = (File) iterator.next();
+				result = file.getAbsolutePath();
+				break;
+			}
+		}
+
+		if (result == "") { //$NON-NLS-1$
+			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+					.getShell();
+			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+			if (LastOpened.getFile(ID) != null) {
+				dialog.setFilterPath(LastOpened.getFolder(ID));
+				dialog.setFileName(LastOpened.getFile(ID));
+			}
+			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
+
+			IPreferencesService service = Platform.getPreferencesService();
+			String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+
+			dialog.setFilterPath(scriptRootDir);
+			result = dialog.open();
+			if (result == null) return null;
+			LastOpened.set(ID, new File(result));
+		}
+
+		execute(result, page, selection);
+		return null;
+	}
+	
+	public static void execute(String scriptpath, IWorkbenchPart page, ISelection selection) {
+		IPreferencesService service = Platform.getPreferencesService();
+		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+		File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
+		
+		ExecuteGroovyScript.executeScript(currentRootDir, scriptpath, page, selection, false);
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 669)
@@ -0,0 +1,414 @@
+// 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.handlers.scripts;
+
+import groovy.lang.Binding;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.internal.runtime.InternalPlatform;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.TXMClassLoader;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.swt.widget.parameters.UIParameterException;
+import org.txm.rcp.utils.GSERunner;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.utils.logger.Log;
+// TODO: Auto-generated Javadoc
+/**
+ * Execute a Groovy script
+ * 
+ * @author mdecorde
+ */
+public class ExecuteGroovyScript extends AbstractHandler {
+
+	private static final String ID = "org.txm.rcp.commands.ExecuteGroovyScript"; //$NON-NLS-1$
+	private static GSERunner gse;
+	private static String previousScriptRootDir;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		String filenameParameter = event
+				.getParameter("org.txm.rcp.command.parameter.file"); //$NON-NLS-1$
+		
+		// the file to execute
+		String result = ""; //$NON-NLS-1$
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+
+		ISelection sel =  HandlerUtil.getCurrentSelection(event); 
+
+		if (page != null && page instanceof TxtEditor) {
+			TxtEditor te = (TxtEditor) page;
+			FileStoreEditorInput input = (FileStoreEditorInput) te
+					.getEditorInput();
+
+			File f = new File(input.getURI().getPath());
+			result = f.getAbsolutePath();
+		} else if (filenameParameter != null) {
+			result = filenameParameter;
+		} else if (sel != null
+				& sel instanceof IStructuredSelection) {
+			File file = null;
+			IStructuredSelection strucSelection = (IStructuredSelection) sel;
+			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
+					.hasNext();) {
+				file = (File) iterator.next();
+				result = file.getAbsolutePath();
+				break;
+			}
+		}
+
+		if ("".equals(result)) { //$NON-NLS-1$
+			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+					.getShell();
+			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+			if (LastOpened.getFile(ID) != null) {
+				dialog.setFilterPath(LastOpened.getFolder(ID));
+				dialog.setFileName(LastOpened.getFile(ID));
+			}
+			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
+
+			IPreferencesService service = Platform.getPreferencesService();
+			String scriptCurrentDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+
+			dialog.setFilterPath(scriptCurrentDir);
+			result = dialog.open();
+			if (result == null) return null;
+			LastOpened.set(ID, new File(result));
+		}
+		executeScript(result, page, sel);
+
+		return null;
+	}
+
+	/**
+	 * 
+	 * @param currentRootDir
+	 * @param scriptpath
+	 * @param page current active page, might be null
+	 * @param sel current selection, might be null
+	 */
+	public static void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection, boolean modal) {
+		IPreferencesService service = Platform.getPreferencesService();
+		//		String scriptRootDir = service.getString(Application.PLUGIN_ID,
+		//				ScriptPreferencePage.SCRIPT_ROOT_DIR,
+		//				ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null);
+		//		
+		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+		File currentRootDir = new File(scriptRootDir, "user"); //$NON-NLS-1$
+
+		executeScript(currentRootDir, scriptpath, page, selection, modal);
+	}
+
+	/**
+	 * 
+	 * @param currentRootDir
+	 * @param scriptpath
+	 * @param page current active page, might be null
+	 * @param sel current selection, might be null
+	 */
+	public static void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection) {
+		executeScript(scriptpath, page, selection, false);
+	}
+
+	/**
+	 * 
+	 * @param currentRootDir
+	 * @param scriptpath
+	 * @param page current active page, might be null
+	 * @param sel current selection, might be null
+	 */
+	public static void executeScript(final File currentRootDir, String scriptpath, final  IWorkbenchPart page, final ISelection sel, final boolean modal) {
+		// check script
+		final File scriptfile = new File(scriptpath);
+		if (!scriptfile.exists()) {
+			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1, scriptpath));
+			return;
+		}
+		ExecuteLastGroovyScript.setLastScript(scriptfile, currentRootDir.getName().equals("macro")); // register last groovy script //$NON-NLS-1$
+
+		// get current selection of the corpora view
+		final Object corpusViewSelection = CorporaView.getSelection();
+		final Object corpusViewSelections = CorporaView.getSelections();
+
+		final Object selection;
+		final List selections;
+		if (sel != null && sel instanceof IStructuredSelection) {
+			selection = ((IStructuredSelection)sel).getFirstElement();
+			selections = ((IStructuredSelection)sel).toList();
+		} else {
+			selection = sel;
+			selections = null;
+		}
+
+		String tmp = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
+		if (previousScriptRootDir == null || !tmp.equals(previousScriptRootDir)) {
+			previousScriptRootDir = tmp;
+			gse = null;
+			//System.out.println("SCRIPT ROOT DIR CHANGED tmp="+tmp);
+		}
+
+		String dir = currentRootDir.getAbsolutePath();
+		String path = scriptfile.getAbsolutePath();
+		if (!path.startsWith(dir)) {
+			System.out.println(RCPMessages.bind(RCPMessages.ExecuteGroovyScriptFromFile_2, dir));
+			return;
+		}
+		final String relativepath = path.substring(dir.length()+1);
+
+		if (gse == null) {
+			gse = buildGSE(previousScriptRootDir, scriptfile);
+			if (gse == null) {
+				System.out.println("Could not create the Groovy script engine. Aborting.");
+				return;
+			}
+		}
+
+		JobHandler jobhandler = new JobHandler(NLS.bind(RCPMessages.ExecuteRScript_1,scriptfile.getName())) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				//this.setCurrentMonitor(monitor);
+				monitor.beginTask(NLS.bind(RCPMessages.ExecuteRScript_1, scriptfile.getName()), 100);
+
+				try {
+					Binding binding = new Binding();
+					binding.setVariable("editor", page); //$NON-NLS-1$
+					binding.setVariable("selection", selection); //$NON-NLS-1$
+					binding.setVariable("selections", selections); //$NON-NLS-1$
+					binding.setVariable("corpusViewSelection", corpusViewSelection); //$NON-NLS-1$
+					binding.setVariable("corpusViewSelections", corpusViewSelections); //$NON-NLS-1$
+					binding.setProperty("monitor", this); //$NON-NLS-1$
+					binding.setProperty("gse", gse);
+					
+					System.out.println(NLS.bind(RCPMessages.ExecuteRScript_1, scriptfile.getName()));
+					long time = System.currentTimeMillis();
+					gse.run(relativepath, binding);
+					
+					System.out.println(RCPMessages.ExecuteRScript_2+(System.currentTimeMillis()-time)+RCPMessages.ExecuteGroovyScript_0);
+				} catch (ThreadDeath td) {
+					return Status.CANCEL_STATUS;
+				} catch (UIParameterException e) {
+					if (e.isError()) {
+						System.out.println(RCPMessages.ExecuteGroovyScript_1);
+					} else {
+						System.out.println(RCPMessages.ExecuteGroovyScript_2);
+					}
+				} catch (Exception e) {
+					System.out.println(RCPMessages.ExecuteGroovyScript_9+e);
+					org.txm.rcp.utils.Logger.printStackTrace(e);
+				} finally {
+					monitor.done();			
+				}
+				return Status.OK_STATUS;
+			}
+		};
+
+		jobhandler.startJob(modal);
+		//        //gse.loadScriptByName("scripts/B.groovy");
+		//		gse.run("A.groovy", new Binding());
+
+		//		ClassLoader parent = getClass().getClassLoader();
+		//		GroovyClassLoader loader = new GroovyClassLoader(parent);
+		//
+		//		List<File> classPath = new ArrayList<File>();
+		//		classPath.add(new File(scriptRootDir));
+		/*classPath.add(new File(scriptfile));
+		classPath.add(new File(scriptfile).getParentFile().getParentFile());
+		classPath.add(new File("")); //$NON-NLS-1$*/
+		// System.out.println(classPath);
+		//System.out.println("Build groovy scripts - Start");
+		//org.txm.Build.run();
+		//System.out.println("Build groovy scripts - Done");
+
+		//		Class groovyClass = null;
+		//		for (File f : classPath)
+		//			loader.addClasspath(f.getAbsolutePath());
+		//		loader.setShouldRecompile(true);
+		//
+		//		try {
+		//			groovyClass = loader.parseClass(new File(scriptfile));
+		//		} catch (CompilationFailedException e) {
+		//			org.txm.rcp.utils.Logger.printStackTrace(e);
+		//		} catch (IOException e) {
+		//			org.txm.rcp.utils.Logger.printStackTrace(e);
+		//		}
+		//
+		//		// let's call some method on an instance
+		//		GroovyObject groovyObject = null;
+		//		try {
+		//			groovyObject = (GroovyObject) groovyClass.newInstance();
+		//		} catch (InstantiationException e) {
+		//			org.txm.rcp.utils.Logger.printStackTrace(e);
+		//		} catch (IllegalAccessException e) {
+		//			org.txm.rcp.utils.Logger.printStackTrace(e);
+		//		}
+		//
+		//		Object[] args = {};
+		//		try {
+		//			groovyObject.invokeMethod("run", args); //$NON-NLS-1$
+		//		} catch (Exception e) {
+		//			System.err.println(e);
+		//			org.txm.rcp.utils.Logger.printStackTrace(e);
+		//		}
+
+		/*
+		 * try { File script = new File(scriptfile); // GroovyImportScriptRunner
+		 * g = new GroovyImportScriptRunner(new File(""),new ArrayList<File>());
+		 * 
+		 * GroovyClassLoader classLoader = new
+		 * GroovyClassLoader(this.getClass().getClassLoader());
+		 * classLoader.addURL(script.getParentFile().toURI().toURL());
+		 * 
+		 * GroovyScriptEngine gse = new
+		 * GroovyScriptEngine(script.getParent(),classLoader);
+		 * gse.run(script.getAbsolutePath(), new Binding());
+		 * System.out.println("END : execute script RCP "); } catch (Exception
+		 * e) { // TODO Auto-generated catch block org.txm.rcp.utils.Logger.printStackTrace(e); }
+		 * 
+		 * /* if (scriptfile == "") return; final File script = new
+		 * File(scriptfile);
+		 * 
+		 * String[] roots = new String[] {script.getParent()};
+		 * System.out.println("SCRIPTROOTDIR "+script.getParent());
+		 * System.out.println("SCRIPT "+script); GroovyScriptEngine gse; try {
+		 * gse = new GroovyScriptEngine(roots); for(File f :
+		 * script.getParentFile().listFiles())
+		 * gse.loadScriptByName(f.getName()); Binding binding = new Binding();
+		 * 
+		 * System.out.println("start execution"); gse.run(script.getName(),
+		 * binding); System.out.println("end execution"); } catch (Exception e)
+		 * {org.txm.rcp.utils.Logger.printStackTrace(e);}
+		 */
+	}
+	
+public static GSERunner buildGSE(String scriptRootDir, File script) {
+		
+		GSERunner gse;
+		
+		String[] roots = new String[] { 
+				scriptRootDir+"/user/", //$NON-NLS-1$
+				scriptRootDir+"/macro/", //$NON-NLS-1$
+				scriptRootDir+"/import/", //$NON-NLS-1$
+				script.getParent(),
+		}; 
+
+		HashMap<String, Bundle> bundleWithActivators = new HashMap<String, Bundle>();
+		HashSet<ClassLoader> loaders = new HashSet<ClassLoader>();
+		BundleContext bundleContext = InternalPlatform.getDefault().getBundleContext();
+		for (Bundle b : bundleContext.getBundles()) {
+			String acName = b.getHeaders().get("Bundle-Activator");
+			//System.out.println(b.getSymbolicName()+":"+b.getHeaders());
+			if (acName != null) {
+				if (!bundleWithActivators.containsKey(b.getSymbolicName())) {
+					bundleWithActivators.put(b.getSymbolicName(),b);
+				} else {
+					Bundle b2 = bundleWithActivators.get(b.getSymbolicName());
+					if (b2.getVersion().compareTo(b.getVersion()) < 0) {
+						bundleWithActivators.put(b.getSymbolicName(),b);
+					}
+				}
+			}
+		}
+		
+		for (Bundle b : bundleWithActivators.values()) {
+			try {
+				String acName = b.getHeaders().get("Bundle-Activator");
+				Class<?> ac = b.loadClass(acName);
+				loaders.add(ac.getClassLoader());
+			} catch (ClassNotFoundException e) {
+				e.printStackTrace();
+			}
+		}
+		Log.info("Initialized TXMClassLoader with "+loaders.size()+ " bundles.");
+		TXMClassLoader scl = new TXMClassLoader(loaders);
+
+		try {
+			gse = new GSERunner(roots, scl);
+		} catch (IOException e) {
+			e.printStackTrace();
+			return null;
+		}
+
+		File jardir = new File(scriptRootDir,"lib"); //$NON-NLS-1$
+		if (jardir.exists() && jardir.isDirectory()) {
+			for (File f: jardir.listFiles(new FilenameFilter() {
+				@Override
+				public boolean accept(File dir, String name) {
+					return name.endsWith(".jar"); //$NON-NLS-1$
+				}
+			}))
+			{
+				try {
+					gse.getGroovyClassLoader().addURL(f.toURI().toURL());
+				} catch (MalformedURLException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}	
+		gse.getGroovyClassLoader().addClasspath(scriptRootDir); // for the .class files if any
+		
+		return gse;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyText.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyText.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyText.java	(revision 669)
@@ -0,0 +1,177 @@
+// 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.handlers.scripts;
+
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.groovy.control.CompilationFailedException;
+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.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.rcp.Application;
+import org.txm.rcp.RCPMessages;
+import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+
+// TODO: Auto-generated Javadoc
+/**
+ * execute a selection of Groovy code from the TxtEditor 
+ * 
+ * @author mdecorde.
+ */
+public class ExecuteGroovyText extends AbstractHandler {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
+	 * .ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getSelection();
+		if (!(selection instanceof TextSelection))
+			return null;
+		TextSelection t = (TextSelection) selection;
+		String result = t.getText();
+
+		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+		TxtEditor te = (TxtEditor) page;
+		FileStoreEditorInput input = (FileStoreEditorInput) te.getEditorInput();
+
+		File f = new File(input.getURI().getPath());
+		String scriptfile = f.getAbsolutePath();
+
+		executeText(result, scriptfile);
+		return null;
+	}
+
+	/**
+	 * Execute text.
+	 * 
+	 * @param text
+	 *            the text
+	 * @param scriptfile
+	 *            the scriptfile
+	 * @return the object
+	 */
+	public static Object executeText(final String text, final String scriptfile) {
+		if (!new File(scriptfile).exists()) {
+			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1,
+					scriptfile));
+			return null;
+		}
+		final String scriptRootDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
+
+		// get current selection of the corpora view
+				final Object corpusViewSelection = CorporaView.getSelection();
+				final Object corpusViewSelections = CorporaView.getSelections();
+				final Object selection = null;
+				final List selections = null;
+				
+		JobHandler jobhandler = new JobHandler("run") { //$NON-NLS-1$
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				// this.setCurrentMonitor(monitor);
+				this.runInit(monitor);
+
+				try {
+					List<File> classPath = new ArrayList<File>();
+					classPath.add(new File(scriptRootDir));
+					classPath.add(new File(scriptfile));
+					classPath.add(new File(scriptfile).getParentFile());
+					classPath.add(new File(".")); //$NON-NLS-1$
+					// System.out.println(classPath);
+					
+					Binding binding = new Binding();
+					//binding.setVariable("editor", page); //$NON-NLS-1$
+					binding.setVariable("selection", selection); //$NON-NLS-1$
+					binding.setVariable("selections", selections); //$NON-NLS-1$
+					binding.setVariable("corpusViewSelection", corpusViewSelection); //$NON-NLS-1$
+					binding.setVariable("corpusViewSelections", corpusViewSelections); //$NON-NLS-1$
+					binding.setProperty("monitor", this); //$NON-NLS-1$
+					//binding.setProperty("gse", gse);
+					GroovyShell shell = new GroovyShell(this.getClass()
+							.getClassLoader(), binding);
+
+					for (File file : classPath) {
+						try {
+							shell.getClassLoader().addURL(file.toURI().toURL());
+							shell.getClassLoader().addClasspath(
+									file.getAbsolutePath());
+						} catch (MalformedURLException e) {
+							org.txm.rcp.utils.Logger.printStackTrace(e);
+							return null;
+						}
+					}
+
+					// try {
+					System.out.println("Executing text selection..."); //$NON-NLS-1$
+					long time = System.currentTimeMillis();
+					shell.evaluate(text);
+					System.out
+							.println("Done: " + (System.currentTimeMillis() - time) + RCPMessages.ExecuteRScript_3); //$NON-NLS-1$
+				} catch (ThreadDeath td) { 
+					return Status.CANCEL_STATUS;
+				} catch (CompilationFailedException e) {
+					System.err.println(e);
+				} catch (Exception e) {
+					org.txm.rcp.utils.Logger.printStackTrace(e);
+				}
+				return Status.OK_STATUS;
+			}
+		};
+
+		jobhandler.startJob();
+		return null;
+	}
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/FileExplorerPreferencePage.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/FileExplorerPreferencePage.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/FileExplorerPreferencePage.java	(revision 669)
@@ -27,17 +27,10 @@
 //
 package org.txm.rcp.preferences;
 
-import java.io.IOException;
-
 import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
 import org.eclipse.ui.preferences.ScopedPreferenceStore;
 import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.Application;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.views.fileexplorer.Explorer;
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/Tablable.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/Tablable.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/Tablable.java	(revision 669)
@@ -1,79 +0,0 @@
-// 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.editors;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.ui.IEditorInput;
-
-// TODO: Auto-generated Javadoc
-/**
- * An {@link IEditorInput} implementing this interface may be displayed as a
- * table by the {@link TableEditor}.
- * 
- * @author sloiseau
- * 
- */
-public interface Tablable extends IEditorInput {
-
-	/**
-	 * Gets the content provider.
-	 *
-	 * @return the content provider
-	 */
-	public IStructuredContentProvider getContentProvider();
-
-	/**
-	 * Gets the label provider.
-	 *
-	 * @return the label provider
-	 */
-	public LabelProvider getLabelProvider();
-
-	/**
-	 * Gets the input.
-	 *
-	 * @return the input
-	 */
-	public Object getInput();
-
-	/**
-	 * Gets the column titles.
-	 *
-	 * @return the column titles
-	 */
-	public String[] getColumnTitles();
-
-	/**
-	 * Gets the column types.
-	 *
-	 * @return the column types
-	 */
-	public String[] getColumnTypes();
-
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/ITablableEditorInput.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/ITablableEditorInput.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/ITablableEditorInput.java	(revision 669)
@@ -0,0 +1,79 @@
+// 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.editors;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.ui.IEditorInput;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An {@link IEditorInput} implementing this interface may be displayed as a
+ * table by the {@link TableEditor}.
+ * 
+ * @author sloiseau
+ * 
+ */
+public interface ITablableEditorInput extends IEditorInput {
+
+	/**
+	 * Gets the content provider.
+	 *
+	 * @return the content provider
+	 */
+	public IStructuredContentProvider getContentProvider();
+
+	/**
+	 * Gets the label provider.
+	 *
+	 * @return the label provider
+	 */
+	public LabelProvider getLabelProvider();
+
+	/**
+	 * Gets the input.
+	 *
+	 * @return the input
+	 */
+	public Object getInput();
+
+	/**
+	 * Gets the column titles.
+	 *
+	 * @return the column titles
+	 */
+	public String[] getColumnTitles();
+
+	/**
+	 * Gets the column types.
+	 *
+	 * @return the column types
+	 */
+	public String[] getColumnTypes();
+
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/adaptableDataStructure/TablableVector.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/adaptableDataStructure/TablableVector.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/adaptableDataStructure/TablableVector.java	(revision 669)
@@ -32,12 +32,12 @@
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.ui.IPersistableElement;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.Tablable;
+import org.txm.rcp.editors.ITablableEditorInput;
 // TODO: Auto-generated Javadoc
 /**
  * The Class TablableVector.
  */
-public class TablableVector implements Tablable {
+public class TablableVector implements ITablableEditorInput {
 
 	/** The column titles. */
 	String[] columnTitles;
@@ -62,7 +62,7 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getColumnTitles()
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getColumnTitles()
 	 */
 	@Override
 	public String[] getColumnTitles() {
@@ -70,7 +70,7 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getContentProvider()
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getContentProvider()
 	 */
 	@Override
 	public IStructuredContentProvider getContentProvider() {
@@ -79,7 +79,7 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getInput()
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getInput()
 	 */
 	@Override
 	public Object getInput() {
@@ -88,7 +88,7 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getLabelProvider()
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getLabelProvider()
 	 */
 	@Override
 	public LabelProvider getLabelProvider() {
@@ -151,7 +151,7 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getColumnTypes()
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getColumnTypes()
 	 */
 	@Override
 	public String[] getColumnTypes() {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportFormEditor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportFormEditor.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportFormEditor.java	(revision 669)
@@ -46,8 +46,8 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.core.results.TXMResult;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.ExecuteImportScript;
 import org.txm.rcp.editors.input.ImportFormEditorInput;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.searchengine.cqp.corpus.Corpus;
 
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/FrontXSLSection.java	(revision 669)
@@ -28,8 +28,8 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.EditFile;
 import org.txm.rcp.editors.TableKeyListener;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.swt.dialog.MultipleValueDialog;
 import org.txm.rcp.swt.provider.ElementColumnLabelProvider;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 669)
@@ -62,7 +62,6 @@
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.ExecuteImportScript;
 import org.txm.rcp.editors.imports.sections.EditionSection;
 import org.txm.rcp.editors.imports.sections.EncodingSection;
 import org.txm.rcp.editors.imports.sections.FontSection;
@@ -74,6 +73,7 @@
 import org.txm.rcp.editors.imports.sections.TextualPlansSection;
 import org.txm.rcp.editors.imports.sections.TokenizerSection;
 import org.txm.rcp.editors.imports.sections.UISection;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.utils.AsciiUtils;
 import org.txm.utils.logger.Log;
 import org.w3c.dom.Element;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablable.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablable.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablable.java	(revision 669)
@@ -1,74 +0,0 @@
-// 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.editors.input;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.txm.rcp.editors.Tablable;
-
-// TODO: Auto-generated Javadoc
-/**
- * Define a tab displaying a graphics in a multi-tab editor.
- * 
- * @author sloiseau
- * 
- */
-public abstract class AbstractTablable extends AbstractEditorInput implements
-		Tablable {
-
-	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getColumnTitles()
-	 */
-	@Override
-	abstract public String[] getColumnTitles();
-
-	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getColumnTypes()
-	 */
-	@Override
-	abstract public String[] getColumnTypes();
-
-	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getContentProvider()
-	 */
-	@Override
-	abstract public IStructuredContentProvider getContentProvider();
-
-	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getInput()
-	 */
-	@Override
-	abstract public Object getInput();
-
-	/* (non-Javadoc)
-	 * @see org.txm.rcp.editors.Tablable#getLabelProvider()
-	 */
-	@Override
-	abstract public LabelProvider getLabelProvider();
-
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablableEditorInput.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablableEditorInput.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractTablableEditorInput.java	(revision 669)
@@ -0,0 +1,73 @@
+// 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.editors.input;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.txm.rcp.editors.ITablableEditorInput;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Define a tab displaying a graphics in a multi-tab editor.
+ * 
+ * @author sloiseau
+ * 
+ */
+public abstract class AbstractTablableEditorInput extends AbstractEditorInput implements ITablableEditorInput {
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getColumnTitles()
+	 */
+	@Override
+	abstract public String[] getColumnTitles();
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getColumnTypes()
+	 */
+	@Override
+	abstract public String[] getColumnTypes();
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getContentProvider()
+	 */
+	@Override
+	abstract public IStructuredContentProvider getContentProvider();
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getInput()
+	 */
+	@Override
+	abstract public Object getInput();
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.editors.ITablableEditorInput#getLabelProvider()
+	 */
+	@Override
+	abstract public LabelProvider getLabelProvider();
+
+}

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractEditorInput.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractEditorInput.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/input/AbstractEditorInput.java	(revision 669)
@@ -35,7 +35,7 @@
 /**
  * This is a root implementation for other abstract implementation of tab type (.
  *
- * {@link AbstractSVGGraphicable}, {@link AbstractTablable}, etc.).
+ * {@link AbstractSVGGraphicable}, {@link AbstractTablableEditorInput}, etc.).
  * @author sloiseau
  */
 @SuppressWarnings("rawtypes") //$NON-NLS-1$
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyMacro.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyMacro.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyMacro.java	(revision 669)
@@ -1,125 +0,0 @@
-// 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.io.File;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.swt.dialog.LastOpened;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: execute a Macro (Groovy script that opens an UI for parameters)
- */
-public class ExecuteGroovyMacro extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.ExecuteMacro"; //$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 {
-
-		String filenameParameter = event
-				.getParameter("org.txm.rcp.command.parameter.file"); //$NON-NLS-1$
-		
-		
-		// the file to execute
-		String result = ""; //$NON-NLS-1$
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (page != null && page instanceof TxtEditor) {
-			TxtEditor te = (TxtEditor) page;
-			selection = HandlerUtil.getActiveWorkbenchWindow(event)
-					.getActivePage().getSelection();
-			FileStoreEditorInput input = (FileStoreEditorInput) te
-					.getEditorInput();
-
-			File f = new File(input.getURI().getPath());
-			result = f.getAbsolutePath();
-		} else if (filenameParameter != null) {
-			result = filenameParameter;
-		} else if (selection != null
-				& selection instanceof IStructuredSelection) {
-			File file = null;
-			IStructuredSelection strucSelection = (IStructuredSelection) selection;
-			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
-					.hasNext();) {
-				file = (File) iterator.next();
-				result = file.getAbsolutePath();
-				break;
-			}
-		}
-
-		if (result == "") { //$NON-NLS-1$
-			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
-					.getShell();
-			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-			if (LastOpened.getFile(ID) != null) {
-				dialog.setFilterPath(LastOpened.getFolder(ID));
-				dialog.setFileName(LastOpened.getFile(ID));
-			}
-			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
-
-			IPreferencesService service = Platform.getPreferencesService();
-			String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-
-			dialog.setFilterPath(scriptRootDir);
-			result = dialog.open();
-			if (result == null) return null;
-			LastOpened.set(ID, new File(result));
-		}
-
-		execute(result, page, selection);
-		return null;
-	}
-	
-	public static void execute(String scriptpath, IWorkbenchPart page, ISelection selection) {
-		IPreferencesService service = Platform.getPreferencesService();
-		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-		File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
-		
-		ExecuteGroovyScript.executeScript(currentRootDir, scriptpath, page, selection, false);
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFolder.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFolder.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFolder.java	(revision 669)
@@ -1,110 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.views.fileexplorer.Explorer;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: create a directory depending on the selection
- */
-public class CreateFolder extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.CreateFolder"; //$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 {
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-
-		//get scripts dir
-		//FIXME: the default value should be defined in the preferences initializer
-		String dir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, null, TBXPreferences.PREFERENCES_NODE, System.getProperty("user.home")); //$NON-NLS-1$
-
-		//if selection is a file, get its path
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		boolean useSavedValue = true;
-		if (selection instanceof IStructuredSelection) {
-			IStructuredSelection sel = (IStructuredSelection) selection;
-			Object obj = sel.getFirstElement();
-
-			if (obj instanceof File) {
-				File current = ((File)obj);
-				if (current.isDirectory())
-					dir = current.getAbsolutePath();
-				else
-					dir = current.getParent();
-				useSavedValue = false;
-			}
-		}
-		//ask new file name
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
-				.getShell();
-		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-
-		if (LastOpened.getFile(ID) != null && useSavedValue) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-			dialog.setFileName(LastOpened.getFile(ID));
-		} else {
-			dialog.setFilterPath(dir);
-		}
-		String path = dialog.open();
-		if (path == null) return null;
-		//create the new file
-		File newfile = new File(path);
-		LastOpened.set(ID, newfile.getParent(), newfile.getName());
-		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
-			if (newfile.mkdir())
-				System.out.println(NLS.bind(RCPMessages.CreateFolder_1, newfile.getAbsolutePath()));
-
-		}
-		Explorer.refresh();
-		MacroExplorer.refresh();
-
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFile.java	(revision 669)
@@ -1,123 +0,0 @@
-// 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.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.views.fileexplorer.Explorer;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: create a file depending on the selection
- */
-public class CreateFile extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.CreateFile"; //$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 {
-
-		//get scripts dir
-		String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
-
-		boolean useSavedValue = true; // if a file/folder is selected, dont use the saved value
-		
-		//if selection is a file, get its path
-		IWorkbenchWindow activeW = HandlerUtil.getActiveWorkbenchWindow(event);
-		if (activeW != null) {
-			IWorkbenchPage activeP = activeW.getActivePage();
-			if (activeP != null) {
-				ISelection selection = activeP.getSelection();
-				if (selection != null && selection instanceof IStructuredSelection) {
-					IStructuredSelection sel = (IStructuredSelection) selection;
-					Object obj = sel.getFirstElement();
-					if (obj instanceof File) {
-						File current = ((File)obj);
-						if (current.isDirectory()) {
-							scriptCurrentDir = current.getAbsolutePath();
-						} else {
-							scriptCurrentDir = current.getParent();
-						}
-						useSavedValue = false;
-					}
-					
-				}
-			}
-		}
-
-		//ask new file name
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-		if (LastOpened.getFile(ID) != null && useSavedValue) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-			dialog.setFileName(LastOpened.getFile(ID));
-		} else {
-			dialog.setFilterPath(scriptCurrentDir);
-		}
-		String path = dialog.open();
-
-		if (path == null) return null;
-
-		//create the new file
-		File newfile = new File(path);
-		LastOpened.set(ID, newfile.getParent(), newfile.getName());
-		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
-			try {
-				if (newfile.createNewFile()) {
-					System.out.println(NLS.bind(RCPMessages.CreateFile_1, newfile.getAbsolutePath()));
-					//OpenFile.openfile(newfile);
-				}
-			} catch (IOException e) {
-				System.out.println(e.getLocalizedMessage());
-			}
-		}
-		EditFile.openfile(newfile);
-		Explorer.refresh();
-		MacroExplorer.refresh();
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CopyFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CopyFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CopyFile.java	(revision 669)
@@ -1,69 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-/**
- * Handler: copy the selected file. 
- * 
- * @author mdecorde
- */
-public class CopyFile extends AbstractHandler {
-
-	public static File toCopy;
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection instanceof IStructuredSelection) {
-			Object o = ((IStructuredSelection)selection).getFirstElement();
-
-			if (o instanceof File) {
-				File file = (File)o;
-				copy(file);
-			}
-		}
-		return null;
-	}
-	
-	public static void copy(File file) {
-		toCopy = file;
-		CutFile.toCut = null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/PasteFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/PasteFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/PasteFile.java	(revision 669)
@@ -1,134 +0,0 @@
-// 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.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.utils.IOClipboard;
-import org.txm.rcp.views.fileexplorer.Explorer;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-// TODO: Auto-generated Javadoc
-/**
- * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
- */
-public class PasteFile extends AbstractHandler {
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection instanceof IStructuredSelection) {
-			Object o = ((IStructuredSelection)selection).getFirstElement();
-
-			if (o instanceof File) {
-				paste((File)o);
-			}
-		}
-		return null;
-	}
-	
-	public static void paste(File folder) {
-
-		if (folder.isFile()) folder = folder.getParentFile();
-		if (folder.isDirectory() && folder.canWrite()) {
-			if (CopyFile.toCopy != null) {
-				File source = CopyFile.toCopy;
-				if (source.isDirectory()) return; // don't copy directory
-				
-				File dest = new File(folder, source.getName());
-				while (dest.exists()) {
-					dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
-				}
-				try {
-					if (!org.txm.utils.io.FileCopy.copy(source, dest))
-						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
-				} catch (IOException e) {
-					System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
-				}
-			} else if (CutFile.toCut != null) {
-				File source = CutFile.toCut;
-				if (source.isDirectory()) return; // don't move directory
-				File dest = new File(folder, source.getName());
-				while (dest.exists()) {
-					dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
-				}
-				try {
-					if (!org.txm.utils.io.FileCopy.copy(source, dest))
-						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
-					if (!source.delete()) 
-						System.out.println(RCPMessages.PasteFile_3+source);
-					CutFile.toCut = null;
-				} catch (IOException e) {
-					System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
-				}
-			} else {
-				// check clipboard content
-				String[] paths = IOClipboard.readFiles();
-				if (paths == null) return;
-				System.out.println("Coping files: "+StringUtils.join(Arrays.asList(paths), ", "));
-				for (String path : paths) {
-					File source = new File(path);
-					File dest = new File(folder, source.getName());
-					while (dest.exists()) {
-						dest = new File(folder, "copy_"+dest.getName()); //$NON-NLS-1$
-					}
-					
-					try {
-						if (source.isDirectory()) {
-							org.txm.utils.io.FileCopy.copyFiles(source, dest);
-						} else {
-							if (!org.txm.utils.io.FileCopy.copy(source, dest))
-								System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest);
-						}
-						
-					} catch (IOException e) {
-						System.out.println(RCPMessages.PasteFile_1+source+RCPMessages.ApplicationWorkbenchAdvisor_37+dest+RCPMessages.PasteFile_4+e);
-					}
-				}
-			}
-			CopyFile.toCopy = null;
-			CutFile.toCut = null;
-			Explorer.refresh();
-			MacroExplorer.refresh();
-		}
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteLastGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteLastGroovyScript.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteLastGroovyScript.java	(revision 669)
@@ -1,100 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.rcp.RCPMessages;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: execute a Macro (Groovy script that opens an UI for parameters)
- */
-public class ExecuteLastGroovyScript extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.ExecuteMacro"; //$NON-NLS-1$
-	public static File lastScript;
-	public static boolean macro = false;
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		
-		execute(page, selection);
-		
-		return null;
-	}
-	
-	public static void setLastScript(File s, boolean b) {
-		lastScript = s;
-		macro = b;
-	}
-	
-	/**
-	 * Execute last Groovy script
-	 * 
-	 * @param page
-	 * @param selection
-	 */
-	public static void execute(IWorkbenchPart page, ISelection selection) {
-		if (lastScript == null) return; // no last script
-		if (macro)
-			System.out.println(RCPMessages.ExecuteLastGroovyScript_0+lastScript);
-		else 
-			System.out.println(RCPMessages.ExecuteLastGroovyScript_1+lastScript);
-		
-		//IPreferencesService service = Platform.getPreferencesService();
-		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-		File currentRootDir;
-		if (macro) {
-			currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
-		} else {
-			currentRootDir = new File(scriptRootDir, "user"); //$NON-NLS-1$
-		}
-		
-		if (!currentRootDir.exists()) {
-			System.out.println(RCPMessages.ExecuteLastGroovyScript_3+currentRootDir);
-			return;
-		}
-		
-		ExecuteGroovyScript.executeScript(currentRootDir, lastScript.getAbsolutePath(), page, selection, false);
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScriptFromFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScriptFromFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScriptFromFile.java	(revision 669)
@@ -1,83 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.swt.dialog.LastOpened;
-/**
- *  Ask the user to select a Groovy script using a File dialog and execute it
- */
-public class ExecuteGroovyScriptFromFile extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.ExecuteGroovyScriptFromFile"; //$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 {
-
-		// the file to execute
-		String result; //$NON-NLS-1$
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-
-		String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
-
-		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-
-		if (LastOpened.getFile(ID) != null) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-			dialog.setFileName(LastOpened.getFile(ID));
-		} else {
-			dialog.setFilterPath(scriptCurrentDir);
-		}
-
-		dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
-		dialog.setFilterPath(scriptCurrentDir);
-		result = dialog.open();
-		if (result == null) return null;
-		
-		LastOpened.set(ID, new File(result));
-		ExecuteGroovyScript.executeScript(result, page, selection);
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteImportScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteImportScript.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteImportScript.java	(revision 669)
@@ -1,335 +0,0 @@
-// 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 groovy.lang.Binding;
-import groovy.util.GroovyScriptEngine;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.logging.Level;
-
-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.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.EngineType;
-import org.txm.Toolbox;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.importer.ImportKeys;
-import org.txm.objects.Base;
-import org.txm.objects.BaseParameters;
-import org.txm.rcp.Application;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.StatusLine;
-import org.txm.rcp.commands.workspace.LoadBinaryCorpus;
-import org.txm.rcp.utils.GSERunner;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.CQPEngine;
-import org.txm.searchengine.cqp.corpus.Corpus;
-import org.txm.searchengine.cqp.corpus.MainCorpus;
-import org.txm.tokenizer.TokenizerClasses;
-import org.txm.utils.BundleUtils;
-import org.txm.utils.DeleteDir;
-import org.txm.utils.ExecTimer;
-import org.txm.utils.logger.Log;
-import org.w3c.dom.Element;
-
-// TODO: Auto-generated Javadoc
-/**
- * Execute an import module (Groovy script).
- * Binds parameters to the script :
- * paramsBinding: parameter file
- * monitor= the job	
- * debug=true|false
- * readyToLoad=tested after the script. If true then the process went OK. 
- *
- * @author mdecorde
- */
-public class ExecuteImportScript extends AbstractHandler {
-
-	/** The lastopenedbase. */
-	public static File lastopenedbase;
-	protected static GroovyScriptEngine gse;
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		String filename = null, filepath = null;
-		if (event.getParameters().containsKey("org.txm.rcp.commands.commandParameter3")) {
-			filename = event.getParameter("org.txm.rcp.commands.commandParameter3"); //$NON-NLS-1$
-			filepath = "scripts/import/" + filename; //$NON-NLS-1$
-		} else {
-			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-			FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-			dialog.setFilterPath(Toolbox.getTXMHOMEPATH()+"/scripts/import");
-			filepath = dialog.open();
-		}
-		
-		if (filepath == null) return null;
-		
-		OpenImportForm.openfile(filepath);
-		return null;
-	}
-
-
-	public static JobHandler executeScript(String scriptFilePath,
-			File paramFile) {
-		BaseParameters params = null;
-		try {
-			params = new BaseParameters(paramFile);
-		} catch (Exception e1) {
-			org.txm.rcp.utils.Logger.printStackTrace(e1);
-			System.out.println("Error while reading import parameters from: "+paramFile);
-			return null;
-		}
-		return executeScript(scriptFilePath, params);
-	}
-
-	/**
-	 * 
-	 * @param scriptFilePath 
-	 * @param params
-	 * @return
-	 */
-	public static JobHandler executeScript(final String scriptFilePath, BaseParameters params) {
-
-		final File script = new File(scriptFilePath);
-		getImportScriptFromToolboxPlugin(script); // if the file is missing or older than the Toolbox jar script
-
-		// We could not found the script in the Toolbox plugin files
-		if (!script.exists()) {
-			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1, scriptFilePath));
-			return null;
-		}
-
-		Display.getDefault().syncExec(new Runnable() {
-			public void run() {	StatusLine.setMessage(RCPMessages.ExecuteScriptImport_0); }
-		});
-
-		final String txmhome = Toolbox.getTXMHOMEPATH();
-		final File corporadir = new File(txmhome,"corpora"); //$NON-NLS-1$
-		corporadir.mkdir(); // the binary corpus are stored here
-		if (!corporadir.exists()) {
-			System.out.println(RCPMessages.ExecuteScriptImport_2+corporadir);
-			Log.severe(RCPMessages.ExecuteScriptImport_2+corporadir);
-			return null;
-		}
-
-		// groovy configuration
-		IPreferencesService service = Platform.getPreferencesService();
-		final String scriptRootDir = service.getString(Application.PLUGIN_ID,
-				TBXPreferences.USER_TXM_HOME+"/scripts",
-				"", null);
-		
-//		ClassLoader parent = ExecuteImportScript.class.getClassLoader();
-//		final GroovyClassLoader loader = new GroovyClassLoader(parent);
-//		final String[] roots = new String[] { 
-//				scriptRootDir,
-//				scriptRootDir+"/user/", //$NON-NLS-1$
-//				scriptRootDir+"/macro/", //$NON-NLS-1$
-//				script.getParent(),
-//				};
-		
-		params.load(); // reload params
-
-		// the binary directory which is going to be created
-
-		final File basedir = new File(corporadir, params.name);
-		final File tempBinDirectory = new File(basedir.getAbsolutePath()+"_temp"); //$NON-NLS-1$
-		final File errorBinDirectory = new File(basedir.getAbsolutePath()+"_error"); //$NON-NLS-1$
-		if (tempBinDirectory.exists()) DeleteDir.deleteDirectory(tempBinDirectory);
-		if (errorBinDirectory.exists()) DeleteDir.deleteDirectory(errorBinDirectory);
-
-		boolean updatingCorpus = "true".equals(params.getKeyValueParameters().get(ImportKeys.UPDATECORPUS));
-		if (!updatingCorpus) { 
-			if (basedir.exists()) {
-				Shell shell = new Shell(); // ask user if he's sure
-				boolean b = MessageDialog.openConfirm(shell, RCPMessages.AddBase_19, NLS.bind(RCPMessages.AddBase_20, basedir.getName().toUpperCase()));
-				if (b) {
-					// shutdown TBX (and cwb) to free index files
-					Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
-					//DeleteDir.deleteDirectory(basedir);
-					basedir.renameTo(tempBinDirectory);
-				} else {
-					return null;
-				}
-			}
-			if (basedir.exists()) {
-				System.out.println(RCPMessages.bind(RCPMessages.ExecuteScriptImport_3, basedir));
-				return null;
-			}
-		}
-		
-		if (CQPEngine.isInitialized()) Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
-		final BaseParameters p = params;
-		JobHandler jobhandler = new JobHandler(RCPMessages.RunGroovyScript_0
-				+ script.getAbsolutePath()) { //$NON-NLS-1$
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				this.runInit(monitor);
-				Base base = null;
-				try {
-					//this.setCurrentMonitor(monitor);
-					monitor.beginTask(RCPMessages.RunGroovyScript_10 + p.rootDir, 100); //$NON-NLS-1$
-
-					//org.txm.Toolbox.shutdownSearchEngine();
-					monitor.worked(5);
-
-					//				if (ExecuteImportScript.gse == null)
-					ExecuteImportScript.gse = ExecuteGroovyScript.buildGSE(scriptRootDir, script);
-					
-
-					Binding binding = new Binding();
-					binding.setProperty("paramsBinding", p); //$NON-NLS-1$
-					binding.setProperty("monitor", this); //$NON-NLS-1$
-
-					boolean logLevel = Log.getLevel().intValue() < Level.WARNING.intValue();			
-					binding.setProperty("debug", logLevel); //$NON-NLS-1$
-					binding.setProperty("readyToLoad", Boolean.FALSE); //$NON-NLS-1$
-
-					Element corpusElem = p.corpora.get(p.getCorpusName());
-					Element tokenizerElement = p.getTokenizerElement(corpusElem);
-					TokenizerClasses.reset();
-					if (!TokenizerClasses.loadFromNode(tokenizerElement)) {
-						System.out.println(RCPMessages.ExecuteScriptImport_5);
-						monitor.done();
-						if (basedir.exists()) basedir.renameTo(errorBinDirectory);
-						if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
-						return Status.CANCEL_STATUS;
-					}
-
-					ExecTimer.start();
-					Log.info(RCPMessages.RunGroovyScript_0 + script.getAbsolutePath()); //$NON-NLS-1$
-					gse.run(script.getName(), binding); // run the groovy import script
-					System.out.println("\n"+RCPMessages.ExecuteScriptImport_7+ExecTimer.stop()); //$NON-NLS-1$
-					monitor.worked(90);
-					
-					TokenizerClasses.reset();
-
-					Object ready = binding.getVariable("readyToLoad"); //$NON-NLS-1$
-					if (ready != null && ready instanceof Boolean) {
-						Boolean readyToLoad = (Boolean)ready;
-						//System.out.println("TRY TO LOAD THE BINARY CORPUS CREATED: "+basedir);
-						if (readyToLoad) {
-							base = LoadBinaryCorpus.loadBinaryCorpus(basedir);
-							if (base == null) {
-								System.out.println(RCPMessages.ExecuteScriptImport_8);
-								if (basedir.exists()) basedir.renameTo(errorBinDirectory);
-								if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
-								return Status.CANCEL_STATUS;
-							}
-							this.acquireSemaphore();
-							Log.info("Save workspace"); //$NON-NLS-1$
-							Toolbox.workspace.save();
-							
-							Log.info("Restart Toolbox search engine"); //$NON-NLS-1$
-							Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
-							final Base base2 = base;
-							syncExec(new Runnable() {
-								@Override
-								public void run() {
-									RestartTXM.reloadViews();
-									CorporaView.select(base2.getChildren(MainCorpus.class));
-									System.out.println(RCPMessages.AddBase_10);
-									StatusLine.setMessage(RCPMessages.AddBase_10);
-								}
-							});
-							this.releaseSemaphore();
-
-							DeleteDir.deleteDirectory(tempBinDirectory);
-						} else {
-							System.out.println(RCPMessages.ExecuteScriptImport_6);
-							if (basedir.exists()) basedir.renameTo(errorBinDirectory);
-							if (tempBinDirectory.exists()) tempBinDirectory.renameTo(basedir);
-						}
-					}
-				} catch (ThreadDeath td) {
-					return Status.CANCEL_STATUS;
-				} catch (Exception e) {
-					System.out.println(NLS.bind(RCPMessages.RunGroovyScript_8, e));
-					org.txm.rcp.utils.Logger.printStackTrace(e);
-				} finally {
-					if (!CQPEngine.isInitialized()) { // the import failed
-						monitor.setTaskName("Restarting Toolbox search engine"); //$NON-NLS-1$
-						Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
-						
-						syncExec(new Runnable() {
-							@Override
-							public void run() {
-								RestartTXM.reloadViews();
-							}
-						});
-					}
-					
-					monitor.done();
-				}
-				System.gc();
-				return Status.OK_STATUS;
-			}
-		};
-		jobhandler.startJob(true);
-		return jobhandler;
-	}
-	
-	/**
-	 * Allow to retrieve an import script from the Toolbox plugin.
-	 * 
-	 * If TXM is run from Eclipse, then the file is copyied, else it is extracted from TXM installation directory
-	 * 
-	 * @param script the import script Loader to retrieve
-	 * @return
-	 */
-	public static boolean getImportScriptFromToolboxPlugin(File script) {
-		Log.info("Retriving "+script+" from Toolbox plugin if script.date < toolbox_script.date");
-		
-		// retrieve the script relative path "quickLoader" -> "quick"
-		String scriptPackage = script.getName();
-		int idx = scriptPackage.indexOf("Loader");
-		scriptPackage = "org/txm/importer/" + scriptPackage.substring(0, idx);
-		
-		return BundleUtils.replaceFilesIfNewer("org.txm.core", "src/groovy", scriptPackage, 
-				script.getName(), script);
-	}
-}
-
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteScript.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteScript.java	(revision 669)
@@ -1,194 +0,0 @@
-// 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.io.File;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.preferences.RCPPreferences;
-import org.txm.rcp.swt.dialog.LastOpened;
-// TODO: Auto-generated Javadoc
-/**
- * Execute a script. It uses the file extension to execute it as Groovy or R
- * 
- * Later : use shabang
- */
-public class ExecuteScript extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.ExecuteScript"; //$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 {
-
-		// the file to execute
-		String result = ""; //$NON-NLS-1$
-		boolean executionFromEditor = false;
-		TxtEditor txteditor = null;
-		
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (page != null && page instanceof TxtEditor) {
-			txteditor = (TxtEditor) page;
-			selection = HandlerUtil.getActiveWorkbenchWindow(event)
-					.getActivePage().getSelection();
-			FileStoreEditorInput input = (FileStoreEditorInput) txteditor
-					.getEditorInput();
-
-			File f = new File(input.getURI().getPath());
-			result = f.getAbsolutePath();
-			executionFromEditor = true;
-		} else if (selection != null
-				& selection instanceof IStructuredSelection) {
-			File file = null;
-			IStructuredSelection strucSelection = (IStructuredSelection) selection;
-			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
-					.hasNext();) {
-				file = (File) iterator.next();
-				result = file.getAbsolutePath();
-				break;
-			}
-		}
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
-				.getShell();
-		// no file found, ask user
-		if (result == "") //$NON-NLS-1$
-		{
-			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-			if (LastOpened.getFile(ID) != null) {
-				dialog.setFilterPath(LastOpened.getFolder(ID));
-				dialog.setFileName(LastOpened.getFile(ID));
-			}
-			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
-
-			String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
-
-			dialog.setFilterPath(scriptCurrentDir);
-			result = dialog.open();
-			if (result == null) return null;
-			LastOpened.set(ID, new File(result));
-		}
-
-		if (executionFromEditor && txteditor != null) { // save file if needed 
-			if (txteditor.isSaveOnCloseNeeded()) { // check if file need to be saved
-				boolean doit = TXMPreferences.getBoolean(RCPPreferences.SAVE_BEFORE_EXECUTION, RCPPreferences.PREFERENCES_NODE);
-				//System.out.println("Save file? "+doit);
-				if (!doit) { // ask user
-					MessageDialog dialog = new MessageDialog(shell, RCPMessages.ExecuteScript_0+result, null,
-							RCPMessages.ExecuteScript_1, MessageDialog.QUESTION, new String[] {RCPMessages.ExecuteScript_2, RCPMessages.ExecuteScript_4,
-							RCPMessages.ExecuteScript_5}, 0) {
-						Button checkDefault;
-						 @Override
-						  protected Control createDialogArea(Composite parent) {
-						    Composite container = (Composite) super.createDialogArea(parent);
-						    checkDefault = new Button(container, SWT.CHECK);
-						    checkDefault.setText(RCPMessages.ExecuteScript_6);
-						    boolean b = TXMPreferences.getBoolean(RCPPreferences.SAVE_BEFORE_EXECUTION, RCPPreferences.PREFERENCES_NODE);
-						    checkDefault.setSelection(b);
-						    
-						    checkDefault.addSelectionListener(new SelectionListener() {
-								
-								@Override
-								public void widgetSelected(SelectionEvent e) {
-									boolean b = checkDefault.getSelection();
-									TXMPreferences.put(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION, b);
-								}
-								
-								@Override
-								public void widgetDefaultSelected(SelectionEvent e) { }
-							});
-						    return container;
-						  }
-					};
-					int c = dialog.open();
-					if (c == 1) {
-						System.out.println(RCPMessages.ExecuteScript_7);
-						return null;
-					} else if (c == 2) {
-						//System.out.println("Don't save and run.");
-						doit = false;
-					} else if (c == 0)  {
-						//System.out.println("Save and run.");
-						doit = true;
-					}
-				}
-
-				if (doit) {
-					//System.out.println("Saving file...");
-					txteditor.doSave(null);
-				}
-			}
-		}
-
-		executeScript(result, page, selection);
-		return null;
-	}
-
-	/**
-	 * Execute script.
-	 *
-	 * @param scriptpath the scriptfile
-	 */
-	public void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection) {
-		if (scriptpath == null) return;
-		File script = new File(scriptpath);
-		if (!script.exists()) return;
-
-		if (script.getName().endsWith(".groovy")) { //$NON-NLS-1$
-			ExecuteGroovyScript.executeScript(scriptpath, page, selection);
-		} else if (script.getName().endsWith(".R")) { //$NON-NLS-1$
-			System.out.println("ExecuteScript with R not implemented");
-			//ExecuteRScript.executeScript(scriptpath);
-		} else {
-			System.out.println(RCPMessages.ExecuteScript_3+script.getName());
-		}
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CutFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CutFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CutFile.java	(revision 669)
@@ -1,70 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.utils.IOClipboard;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: cuts the selected file 
- */
-public class CutFile extends AbstractHandler {
-
-	public static File toCut;
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection instanceof IStructuredSelection) {
-			Object o = ((IStructuredSelection)selection).getFirstElement();
-
-			if (o instanceof File) {
-				File file = (File)o;
-				cut(file);
-			}
-		}
-		return null;
-	}
-	
-	public static void cut(File file) {
-		toCut = file;
-		CopyFile.toCopy = null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScript.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScript.java	(revision 669)
@@ -1,414 +0,0 @@
-// 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 groovy.lang.Binding;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.TXMClassLoader;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.swt.widget.parameters.UIParameterException;
-import org.txm.rcp.utils.GSERunner;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.utils.logger.Log;
-// TODO: Auto-generated Javadoc
-/**
- * Execute a Groovy script
- * 
- * @author mdecorde
- */
-public class ExecuteGroovyScript extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.ExecuteGroovyScript"; //$NON-NLS-1$
-	private static GSERunner gse;
-	private static String previousScriptRootDir;
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		String filenameParameter = event
-				.getParameter("org.txm.rcp.command.parameter.file"); //$NON-NLS-1$
-		
-		// the file to execute
-		String result = ""; //$NON-NLS-1$
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-
-		ISelection sel =  HandlerUtil.getCurrentSelection(event); 
-
-		if (page != null && page instanceof TxtEditor) {
-			TxtEditor te = (TxtEditor) page;
-			FileStoreEditorInput input = (FileStoreEditorInput) te
-					.getEditorInput();
-
-			File f = new File(input.getURI().getPath());
-			result = f.getAbsolutePath();
-		} else if (filenameParameter != null) {
-			result = filenameParameter;
-		} else if (sel != null
-				& sel instanceof IStructuredSelection) {
-			File file = null;
-			IStructuredSelection strucSelection = (IStructuredSelection) sel;
-			for (Iterator<Object> iterator = strucSelection.iterator(); iterator
-					.hasNext();) {
-				file = (File) iterator.next();
-				result = file.getAbsolutePath();
-				break;
-			}
-		}
-
-		if ("".equals(result)) { //$NON-NLS-1$
-			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
-					.getShell();
-			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-			if (LastOpened.getFile(ID) != null) {
-				dialog.setFilterPath(LastOpened.getFolder(ID));
-				dialog.setFileName(LastOpened.getFile(ID));
-			}
-			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
-
-			IPreferencesService service = Platform.getPreferencesService();
-			String scriptCurrentDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-
-			dialog.setFilterPath(scriptCurrentDir);
-			result = dialog.open();
-			if (result == null) return null;
-			LastOpened.set(ID, new File(result));
-		}
-		executeScript(result, page, sel);
-
-		return null;
-	}
-
-	/**
-	 * 
-	 * @param currentRootDir
-	 * @param scriptpath
-	 * @param page current active page, might be null
-	 * @param sel current selection, might be null
-	 */
-	public static void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection, boolean modal) {
-		IPreferencesService service = Platform.getPreferencesService();
-		//		String scriptRootDir = service.getString(Application.PLUGIN_ID,
-		//				ScriptPreferencePage.SCRIPT_ROOT_DIR,
-		//				ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null);
-		//		
-		String scriptRootDir = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-		File currentRootDir = new File(scriptRootDir, "user"); //$NON-NLS-1$
-
-		executeScript(currentRootDir, scriptpath, page, selection, modal);
-	}
-
-	/**
-	 * 
-	 * @param currentRootDir
-	 * @param scriptpath
-	 * @param page current active page, might be null
-	 * @param sel current selection, might be null
-	 */
-	public static void executeScript(String scriptpath, final  IWorkbenchPart page, final ISelection selection) {
-		executeScript(scriptpath, page, selection, false);
-	}
-
-	/**
-	 * 
-	 * @param currentRootDir
-	 * @param scriptpath
-	 * @param page current active page, might be null
-	 * @param sel current selection, might be null
-	 */
-	public static void executeScript(final File currentRootDir, String scriptpath, final  IWorkbenchPart page, final ISelection sel, final boolean modal) {
-		// check script
-		final File scriptfile = new File(scriptpath);
-		if (!scriptfile.exists()) {
-			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1, scriptpath));
-			return;
-		}
-		ExecuteLastGroovyScript.setLastScript(scriptfile, currentRootDir.getName().equals("macro")); // register last groovy script //$NON-NLS-1$
-
-		// get current selection of the corpora view
-		final Object corpusViewSelection = CorporaView.getSelection();
-		final Object corpusViewSelections = CorporaView.getSelections();
-
-		final Object selection;
-		final List selections;
-		if (sel != null && sel instanceof IStructuredSelection) {
-			selection = ((IStructuredSelection)sel).getFirstElement();
-			selections = ((IStructuredSelection)sel).toList();
-		} else {
-			selection = sel;
-			selections = null;
-		}
-
-		String tmp = Toolbox.getTXMHOMEPATH() + "/scripts"; //$NON-NLS-1$
-		if (previousScriptRootDir == null || !tmp.equals(previousScriptRootDir)) {
-			previousScriptRootDir = tmp;
-			gse = null;
-			//System.out.println("SCRIPT ROOT DIR CHANGED tmp="+tmp);
-		}
-
-		String dir = currentRootDir.getAbsolutePath();
-		String path = scriptfile.getAbsolutePath();
-		if (!path.startsWith(dir)) {
-			System.out.println(RCPMessages.bind(RCPMessages.ExecuteGroovyScriptFromFile_2, dir));
-			return;
-		}
-		final String relativepath = path.substring(dir.length()+1);
-
-		if (gse == null) {
-			gse = buildGSE(previousScriptRootDir, scriptfile);
-			if (gse == null) {
-				System.out.println("Could not create the Groovy script engine. Aborting.");
-				return;
-			}
-		}
-
-		JobHandler jobhandler = new JobHandler(NLS.bind(RCPMessages.ExecuteRScript_1,scriptfile.getName())) {
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				this.runInit(monitor);
-				//this.setCurrentMonitor(monitor);
-				monitor.beginTask(NLS.bind(RCPMessages.ExecuteRScript_1, scriptfile.getName()), 100);
-
-				try {
-					Binding binding = new Binding();
-					binding.setVariable("editor", page); //$NON-NLS-1$
-					binding.setVariable("selection", selection); //$NON-NLS-1$
-					binding.setVariable("selections", selections); //$NON-NLS-1$
-					binding.setVariable("corpusViewSelection", corpusViewSelection); //$NON-NLS-1$
-					binding.setVariable("corpusViewSelections", corpusViewSelections); //$NON-NLS-1$
-					binding.setProperty("monitor", this); //$NON-NLS-1$
-					binding.setProperty("gse", gse);
-					
-					System.out.println(NLS.bind(RCPMessages.ExecuteRScript_1, scriptfile.getName()));
-					long time = System.currentTimeMillis();
-					gse.run(relativepath, binding);
-					
-					System.out.println(RCPMessages.ExecuteRScript_2+(System.currentTimeMillis()-time)+RCPMessages.ExecuteGroovyScript_0);
-				} catch (ThreadDeath td) {
-					return Status.CANCEL_STATUS;
-				} catch (UIParameterException e) {
-					if (e.isError()) {
-						System.out.println(RCPMessages.ExecuteGroovyScript_1);
-					} else {
-						System.out.println(RCPMessages.ExecuteGroovyScript_2);
-					}
-				} catch (Exception e) {
-					System.out.println(RCPMessages.ExecuteGroovyScript_9+e);
-					org.txm.rcp.utils.Logger.printStackTrace(e);
-				} finally {
-					monitor.done();			
-				}
-				return Status.OK_STATUS;
-			}
-		};
-
-		jobhandler.startJob(modal);
-		//        //gse.loadScriptByName("scripts/B.groovy");
-		//		gse.run("A.groovy", new Binding());
-
-		//		ClassLoader parent = getClass().getClassLoader();
-		//		GroovyClassLoader loader = new GroovyClassLoader(parent);
-		//
-		//		List<File> classPath = new ArrayList<File>();
-		//		classPath.add(new File(scriptRootDir));
-		/*classPath.add(new File(scriptfile));
-		classPath.add(new File(scriptfile).getParentFile().getParentFile());
-		classPath.add(new File("")); //$NON-NLS-1$*/
-		// System.out.println(classPath);
-		//System.out.println("Build groovy scripts - Start");
-		//org.txm.Build.run();
-		//System.out.println("Build groovy scripts - Done");
-
-		//		Class groovyClass = null;
-		//		for (File f : classPath)
-		//			loader.addClasspath(f.getAbsolutePath());
-		//		loader.setShouldRecompile(true);
-		//
-		//		try {
-		//			groovyClass = loader.parseClass(new File(scriptfile));
-		//		} catch (CompilationFailedException e) {
-		//			org.txm.rcp.utils.Logger.printStackTrace(e);
-		//		} catch (IOException e) {
-		//			org.txm.rcp.utils.Logger.printStackTrace(e);
-		//		}
-		//
-		//		// let's call some method on an instance
-		//		GroovyObject groovyObject = null;
-		//		try {
-		//			groovyObject = (GroovyObject) groovyClass.newInstance();
-		//		} catch (InstantiationException e) {
-		//			org.txm.rcp.utils.Logger.printStackTrace(e);
-		//		} catch (IllegalAccessException e) {
-		//			org.txm.rcp.utils.Logger.printStackTrace(e);
-		//		}
-		//
-		//		Object[] args = {};
-		//		try {
-		//			groovyObject.invokeMethod("run", args); //$NON-NLS-1$
-		//		} catch (Exception e) {
-		//			System.err.println(e);
-		//			org.txm.rcp.utils.Logger.printStackTrace(e);
-		//		}
-
-		/*
-		 * try { File script = new File(scriptfile); // GroovyImportScriptRunner
-		 * g = new GroovyImportScriptRunner(new File(""),new ArrayList<File>());
-		 * 
-		 * GroovyClassLoader classLoader = new
-		 * GroovyClassLoader(this.getClass().getClassLoader());
-		 * classLoader.addURL(script.getParentFile().toURI().toURL());
-		 * 
-		 * GroovyScriptEngine gse = new
-		 * GroovyScriptEngine(script.getParent(),classLoader);
-		 * gse.run(script.getAbsolutePath(), new Binding());
-		 * System.out.println("END : execute script RCP "); } catch (Exception
-		 * e) { // TODO Auto-generated catch block org.txm.rcp.utils.Logger.printStackTrace(e); }
-		 * 
-		 * /* if (scriptfile == "") return; final File script = new
-		 * File(scriptfile);
-		 * 
-		 * String[] roots = new String[] {script.getParent()};
-		 * System.out.println("SCRIPTROOTDIR "+script.getParent());
-		 * System.out.println("SCRIPT "+script); GroovyScriptEngine gse; try {
-		 * gse = new GroovyScriptEngine(roots); for(File f :
-		 * script.getParentFile().listFiles())
-		 * gse.loadScriptByName(f.getName()); Binding binding = new Binding();
-		 * 
-		 * System.out.println("start execution"); gse.run(script.getName(),
-		 * binding); System.out.println("end execution"); } catch (Exception e)
-		 * {org.txm.rcp.utils.Logger.printStackTrace(e);}
-		 */
-	}
-	
-public static GSERunner buildGSE(String scriptRootDir, File script) {
-		
-		GSERunner gse;
-		
-		String[] roots = new String[] { 
-				scriptRootDir+"/user/", //$NON-NLS-1$
-				scriptRootDir+"/macro/", //$NON-NLS-1$
-				scriptRootDir+"/import/", //$NON-NLS-1$
-				script.getParent(),
-		}; 
-
-		HashMap<String, Bundle> bundleWithActivators = new HashMap<String, Bundle>();
-		HashSet<ClassLoader> loaders = new HashSet<ClassLoader>();
-		BundleContext bundleContext = InternalPlatform.getDefault().getBundleContext();
-		for (Bundle b : bundleContext.getBundles()) {
-			String acName = b.getHeaders().get("Bundle-Activator");
-			//System.out.println(b.getSymbolicName()+":"+b.getHeaders());
-			if (acName != null) {
-				if (!bundleWithActivators.containsKey(b.getSymbolicName())) {
-					bundleWithActivators.put(b.getSymbolicName(),b);
-				} else {
-					Bundle b2 = bundleWithActivators.get(b.getSymbolicName());
-					if (b2.getVersion().compareTo(b.getVersion()) < 0) {
-						bundleWithActivators.put(b.getSymbolicName(),b);
-					}
-				}
-			}
-		}
-		
-		for (Bundle b : bundleWithActivators.values()) {
-			try {
-				String acName = b.getHeaders().get("Bundle-Activator");
-				Class<?> ac = b.loadClass(acName);
-				loaders.add(ac.getClassLoader());
-			} catch (ClassNotFoundException e) {
-				e.printStackTrace();
-			}
-		}
-		Log.info("Initialized TXMClassLoader with "+loaders.size()+ " bundles.");
-		TXMClassLoader scl = new TXMClassLoader(loaders);
-
-		try {
-			gse = new GSERunner(roots, scl);
-		} catch (IOException e) {
-			e.printStackTrace();
-			return null;
-		}
-
-		File jardir = new File(scriptRootDir,"lib"); //$NON-NLS-1$
-		if (jardir.exists() && jardir.isDirectory()) {
-			for (File f: jardir.listFiles(new FilenameFilter() {
-				@Override
-				public boolean accept(File dir, String name) {
-					return name.endsWith(".jar"); //$NON-NLS-1$
-				}
-			}))
-			{
-				try {
-					gse.getGroovyClassLoader().addURL(f.toURI().toURL());
-				} catch (MalformedURLException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}	
-		gse.getGroovyClassLoader().addClasspath(scriptRootDir); // for the .class files if any
-		
-		return gse;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditSelectedFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditSelectedFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditSelectedFile.java	(revision 669)
@@ -1,126 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.Toolbox;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.utils.logger.Log;
-
-/**
- * Open a file in the TxtEditor
- * 
- * @author mdecorde.
- */
-public class EditSelectedFile extends AbstractHandler {
-
-	public static final String ID = EditSelectedFile.class.getCanonicalName(); //$NON-NLS-1$
-	/** The lastopenedfile. */
-	public static String lastopenedfile;
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		File file = null;
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection != null & selection instanceof IStructuredSelection) {
-			IStructuredSelection strucSelection = (IStructuredSelection) selection;
-			for (Object o : strucSelection.toList())
-				if (o != null && o instanceof File) {
-					file = (File)o;
-					break;
-				}
-		}
-
-		if (file == null) {
-			System.out.println("Selection has no file. Aborting.");
-			return null;
-		} else {
-			if (file.isDirectory()) {
-				System.out.println("Selected file is a directory. Aborting.");
-				return null;
-			} else {
-				openfile(file.getAbsolutePath());
-			}
-		}
-
-		return null;
-	}
-
-	/**
-	 * Open a file in TXM TxtEditor.
-	 *
-	 * @param filepath the filepath
-	 */
-	static public void openfile(File file) {
-		if (file.isDirectory())
-			return;
-		try {
-			IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(file.toURI());
-
-			FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
-			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-			IWorkbenchPage page = window.getActivePage();
-
-			IEditorPart a = page.openEditor(editorInput, TxtEditor.ID, true);
-			TxtEditor editor = (TxtEditor) a;
-		} catch (Exception e) {
-			Log.printStackTrace(e);
-		}
-	}
-
-	/**
-	 * Openfile.
-	 *
-	 * @param filepath the filepath
-	 */
-	static public void openfile(String filepath) {
-		openfile(new File(filepath));
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DeleteFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DeleteFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DeleteFile.java	(revision 669)
@@ -1,125 +0,0 @@
-// 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.io.File;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.views.fileexplorer.Explorer;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-import org.txm.utils.DeleteDir;
-// TODO: Auto-generated Javadoc
-/**
- * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
- */
-public class DeleteFile extends AbstractHandler {
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection instanceof IStructuredSelection) {
-			Object o = ((IStructuredSelection)selection).getFirstElement();
-
-			if (o instanceof File) {
-				File file = (File)o;
-				delete(file);
-			}
-		}
-		return null;
-	}
-
-	public static void delete(File file) {
-		//ask new file name
-
-		Shell shell = new Shell();
-		MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO);
-		dialog.setMessage(RCPMessages.DeleteFile_0+file+" ? ");  //$NON-NLS-1$
-
-		int buttonID = dialog.open();
-		switch(buttonID) {
-		case SWT.YES:
-			if (file.isFile()) {
-				if (!file.delete()) System.out.println(RCPMessages.DeleteFile_2+file);
-			} else if (file.isDirectory()) {
-				if (!DeleteDir.deleteDirectory(file)) System.out.println(RCPMessages.DeleteFile_2+file);
-			}
-			Explorer.refresh();
-			MacroExplorer.refresh();
-		case SWT.NO:
-			// exits here ...
-			break;
-		case SWT.CANCEL:
-			// does nothing ...
-		}
-	}
-
-	public static void delete(List files) {
-		Shell shell = new Shell();
-		MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO);
-		dialog.setMessage(RCPMessages.DeleteFile_0+files+" ? ");  //$NON-NLS-1$
-		
-		int buttonID = dialog.open();
-		switch(buttonID) {
-		case SWT.YES:
-			for (Object o : files) {
-				if (o instanceof File) {
-					File file = (File) o;
-					if (file.exists())
-					if (file.isFile()) {
-						if (!file.delete()) System.out.println(RCPMessages.DeleteFile_2+file);
-					} else if (file.isDirectory()) {
-						if (!DeleteDir.deleteDirectory(file)) System.out.println(RCPMessages.DeleteFile_2+file);
-					}
-				}
-			}
-			Explorer.refresh();
-			MacroExplorer.refresh();
-		case SWT.NO:
-			// exits here ...
-			break;
-		case SWT.CANCEL:
-			// does nothing ...
-		}
-		
-		
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteText.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteText.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteText.java	(revision 669)
@@ -1,95 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.TxtEditor;
-
-// TODO: Auto-generated Javadoc
-/**
- * Handler: execute a selection of code from the TxtEditor. It uses the file extension to execute it as Groovy or R.
- * 
- * 
- * @author mdecorde.
- */
-public class ExecuteText extends AbstractHandler {
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getSelection();
-		if(!(selection instanceof TextSelection)) return null;
-		
-		TextSelection t = (TextSelection) selection;
-		String result = t.getText();
-
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
-		if (!(page instanceof TxtEditor)) return null;
-		TxtEditor te = (TxtEditor) page;
-		FileStoreEditorInput input = (FileStoreEditorInput) te.getEditorInput();
-
-		File f = new File(input.getURI().getPath());
-		String scriptfile = f.getAbsolutePath();
-
-		return executeText(result, scriptfile);
-	}
-
-	/**
-	 * Execute text.
-	 *
-	 * @param text the text
-	 * @param scriptfile the scriptfile
-	 * @return the object
-	 */
-	public static Object executeText(final String text, final String scriptfile) {
-		File script = new File(scriptfile);
-		if (script.getName().endsWith(".groovy")) { //$NON-NLS-1$
-			ExecuteGroovyText.executeText(text, scriptfile);
-		} else if (script.getName().endsWith(".R")) { //$NON-NLS-1$
-			System.out.println("Execute R text selection not implemented");
-			//ExecuteRText.executeText(text);
-		} else {
-			System.out.println(RCPMessages.ExecuteScript_3+script.getName());
-		}
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RenameFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RenameFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RenameFile.java	(revision 669)
@@ -1,84 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.views.fileexplorer.Explorer;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-// TODO: Auto-generated Javadoc
-/**
- * Execute a groovy script file in the same thread a the RCP @ author mdecorde.
- */
-public class RenameFile extends AbstractHandler {
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if (selection instanceof IStructuredSelection) {
-			Object o = ((IStructuredSelection)selection).getFirstElement();
-
-			if (o instanceof File) {
-				File file = (File)o;
-				rename(file);
-			}
-		}
-		return null;
-	}
-
-	public static void rename(File file) {
-		String newname = file.getName();
-		InputDialog dlg = new InputDialog(new Shell(),
-				RCPMessages.RenameFile_0, RCPMessages.RenameFile_0+newname, newname, null);
-		if (dlg.open() == Window.OK) {
-			newname = dlg.getValue();
-			System.out.println(RCPMessages.RenameFile_2+newname);
-			if (newname.equals(file.getName())) return; // nothing to do
-			if (newname == null || newname.trim().length() == 0) return; // error
-			
-			if (!file.renameTo(new File(file.getParentFile(), newname)))
-				System.out.println(RCPMessages.RenameFile_3+file+RCPMessages.ApplicationWorkbenchAdvisor_37+newname);
-			Explorer.refresh();
-			MacroExplorer.refresh();
-		}
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DownloadFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DownloadFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/DownloadFile.java	(revision 669)
@@ -1,84 +0,0 @@
-package org.txm.rcp.commands;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.txm.rcp.utils.DownloadJobHandler;
-import org.txm.utils.logger.Log;
-
-public class DownloadFile  extends AbstractHandler {
-
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public static boolean download(URL url, File outputDirectory) {
-		String filename = url.getFile();
-		File outfile = new File(outputDirectory, filename);
-		Boolean done = false;
-
-		BufferedOutputStream writeFile = null;
-		HttpURLConnection connection = null;
-		InputStream input = null;
-		try {
-			connection = (HttpURLConnection)url.openConnection();  
-			connection.connect();  
-
-			// Check if the request is handled successfully  
-			if (connection.getResponseCode() / 100 == 2) { 
-
-				// size in bytes  
-				final int contentLength = connection.getContentLength(); 
-
-				if (contentLength == -1) {
-					System.out.println("Could not get file size");
-				} else {
-					done = false;
-
-					DownloadJobHandler job = new DownloadJobHandler("Download "+url, outfile, contentLength, done);
-					job.schedule();					
-
-					writeFile = new BufferedOutputStream(new FileOutputStream(outfile));
-					input = connection.getInputStream();
-					byte[] buffer = new byte[1024];
-					int read;
-					while ((read = input.read(buffer)) > 0)
-						writeFile.write(buffer, 0, read);
-
-					done = true;
-					job.done();
-				}
-			}
-		} catch (IOException e) {
-			Log.printStackTrace(e);
-			return false;
-		} finally {
-			if (writeFile != null)
-				try {
-					writeFile.close();
-				} catch (IOException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			if (input != null)
-				try {
-					input.close();
-				} catch (IOException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			if (connection != null) connection.disconnect();
-		}
-		return true;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyText.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyText.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyText.java	(revision 669)
@@ -1,177 +0,0 @@
-// 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 groovy.lang.Binding;
-import groovy.lang.GroovyShell;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.codehaus.groovy.control.CompilationFailedException;
-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.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.Application;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.rcp.views.corpora.CorporaView;
-
-// TODO: Auto-generated Javadoc
-/**
- * execute a selection of Groovy code from the TxtEditor 
- * 
- * @author mdecorde.
- */
-public class ExecuteGroovyText extends AbstractHandler {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
-	 * .ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-		ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getSelection();
-		if (!(selection instanceof TextSelection))
-			return null;
-		TextSelection t = (TextSelection) selection;
-		String result = t.getText();
-
-		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-				.getActivePage().getActivePart();
-		TxtEditor te = (TxtEditor) page;
-		FileStoreEditorInput input = (FileStoreEditorInput) te.getEditorInput();
-
-		File f = new File(input.getURI().getPath());
-		String scriptfile = f.getAbsolutePath();
-
-		executeText(result, scriptfile);
-		return null;
-	}
-
-	/**
-	 * Execute text.
-	 * 
-	 * @param text
-	 *            the text
-	 * @param scriptfile
-	 *            the scriptfile
-	 * @return the object
-	 */
-	public static Object executeText(final String text, final String scriptfile) {
-		if (!new File(scriptfile).exists()) {
-			System.err.println(NLS.bind(RCPMessages.ExecuteScriptImport_1,
-					scriptfile));
-			return null;
-		}
-		final String scriptRootDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
-
-		// get current selection of the corpora view
-				final Object corpusViewSelection = CorporaView.getSelection();
-				final Object corpusViewSelections = CorporaView.getSelections();
-				final Object selection = null;
-				final List selections = null;
-				
-		JobHandler jobhandler = new JobHandler("run") { //$NON-NLS-1$
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				// this.setCurrentMonitor(monitor);
-				this.runInit(monitor);
-
-				try {
-					List<File> classPath = new ArrayList<File>();
-					classPath.add(new File(scriptRootDir));
-					classPath.add(new File(scriptfile));
-					classPath.add(new File(scriptfile).getParentFile());
-					classPath.add(new File(".")); //$NON-NLS-1$
-					// System.out.println(classPath);
-					
-					Binding binding = new Binding();
-					//binding.setVariable("editor", page); //$NON-NLS-1$
-					binding.setVariable("selection", selection); //$NON-NLS-1$
-					binding.setVariable("selections", selections); //$NON-NLS-1$
-					binding.setVariable("corpusViewSelection", corpusViewSelection); //$NON-NLS-1$
-					binding.setVariable("corpusViewSelections", corpusViewSelections); //$NON-NLS-1$
-					binding.setProperty("monitor", this); //$NON-NLS-1$
-					//binding.setProperty("gse", gse);
-					GroovyShell shell = new GroovyShell(this.getClass()
-							.getClassLoader(), binding);
-
-					for (File file : classPath) {
-						try {
-							shell.getClassLoader().addURL(file.toURI().toURL());
-							shell.getClassLoader().addClasspath(
-									file.getAbsolutePath());
-						} catch (MalformedURLException e) {
-							org.txm.rcp.utils.Logger.printStackTrace(e);
-							return null;
-						}
-					}
-
-					// try {
-					System.out.println("Executing text selection..."); //$NON-NLS-1$
-					long time = System.currentTimeMillis();
-					shell.evaluate(text);
-					System.out
-							.println("Done: " + (System.currentTimeMillis() - time) + RCPMessages.ExecuteRScript_3); //$NON-NLS-1$
-				} catch (ThreadDeath td) { 
-					return Status.CANCEL_STATUS;
-				} catch (CompilationFailedException e) {
-					System.err.println(e);
-				} catch (Exception e) {
-					org.txm.rcp.utils.Logger.printStackTrace(e);
-				}
-				return Status.OK_STATUS;
-			}
-		};
-
-		jobhandler.startJob();
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateMacro.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateMacro.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateMacro.java	(revision 669)
@@ -1,205 +0,0 @@
-// 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.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.views.fileexplorer.MacroExplorer;
-import org.txm.utils.AsciiUtils;
-import org.txm.utils.io.IOUtils;
-// TODO: Auto-generated Javadoc
-/**
- * Handler: creates a macro template
- */
-public class CreateMacro extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.CreateMacro"; //$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 {
-
-		//get scripts dir
-		String scriptRootDir = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE)+ "/scripts";
-		File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
-
-		//if selection is a file, get its path
-		String dir = null;
-		IWorkbenchWindow activeW = HandlerUtil.getActiveWorkbenchWindow(event);
-		if (activeW != null) {
-			IWorkbenchPage activeP = activeW.getActivePage();
-			if (activeP != null) {
-				ISelection selection = activeP.getSelection();
-				if (selection != null && selection instanceof IStructuredSelection) {
-					IStructuredSelection sel = (IStructuredSelection) selection;
-					Object obj = sel.getFirstElement();
-					if (obj instanceof File) {
-						File current = ((File)obj);
-						if (current.isDirectory()) {
-							dir = current.getAbsolutePath();
-						} else {
-							dir = current.getParent();
-						}
-					}
-				}
-			}
-		}
-
-		if (dir == null) {
-			dir = currentRootDir.getAbsolutePath();
-		}
-		
-		//ask new file name
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-		InputDialog dialog = new InputDialog(shell, RCPMessages.CreateMacro_0, RCPMessages.CreateMacro_1, "", null); //$NON-NLS-1$
-		
-		dialog.open();
-		String name = dialog.getValue();
-		
-		return createMacro(dir, name);
-	}
-	
-	public static boolean createMacro(String dir, String name) {
-		if (name == null) return false;
-		if (dir == null) return false;
-		
-		int idx = dir.indexOf("scripts/macro/org/txm/macro/");
-		String packagePath = "org.txm.macro";
-		if (idx > 0) {
-			String sub = dir.substring(idx + "scripts/macro/org/txm/macro/".length(), dir.length()).replaceAll("/", ".").replaceAll("\\\\", ".");
-			if (sub.trim().length() > 0) {
-				packagePath += "."+sub;
-			}
-		}
-		name = name.replaceAll("\\p{Punct}", ""); //$NON-NLS-1$ //$NON-NLS-2$
-		name = AsciiUtils.convertNonAscii(name);
-		name = name.substring(0, 1).toUpperCase()+name.substring(1);
-		StringBuffer tmp = new StringBuffer();
-		for (int i = 0 ; i < name.length() ; i++) {
-			if (name.charAt(i) == ' ') {
-				i++;
-				if (i <name.length() )
-					tmp.append((""+name.charAt(i)).toUpperCase()); //$NON-NLS-1$
-			} else {
-				tmp.append(name.charAt(i));
-			}
-		}
-		name = tmp.toString();
-		if (name == null) return false;
-
-		//create the new file
-		File newfile = new File(dir, name+"Macro.groovy"); //$NON-NLS-1$
-		LastOpened.set(ID, newfile.getParent(), newfile.getName());
-		if (!newfile.exists() && newfile.getParentFile().canWrite()) {
-			try {
-				if (newfile.createNewFile()) {
-					System.out.println(NLS.bind(RCPMessages.CreateFile_1, newfile.getAbsolutePath()));
-					
-					PrintWriter writer = IOUtils.getWriter(newfile, "UTF-8"); //$NON-NLS-1$
-					writer.println("// STANDARD DECLARATIONS"); //$NON-NLS-1$
-					writer.println("package "+packagePath); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("import org.kohsuke.args4j.*"); //$NON-NLS-1$
-					writer.println("import groovy.transform.Field"); //$NON-NLS-1$
-					writer.println("import org.txm.rcp.swt.widget.parameters.*"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("// BEGINNING OF PARAMETERS"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("// Declare each parameter here"); //$NON-NLS-1$
-					writer.println("// (available widget types: Query, File, Folder, String, Text, Boolean, Integer, Float and Date)"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"query\", usage=\"an example query\", widget=\"Query\", required=true, def='[pos=\"V.*\"]')"); //$NON-NLS-1$
-					writer.println("//def query"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"inputFile\", usage=\"an example file\", widget=\"FileOpen\", required=true, def=\"C:/Temp/foo.txt\")"); //$NON-NLS-1$
-					writer.println("//def inputFile"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"outputFile\", usage=\"an example file\", widget=\"FileSave\", required=true, def=\"C:/Temp/foo.txt\")"); //$NON-NLS-1$
-					writer.println("//def outputFile"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"folder\", usage=\"an example folder\", widget=\"Folder\", required=false, def=\"C:/Temp\")"); //$NON-NLS-1$
-					writer.println("//def folder"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"date\", usage=\"an example date\", widget=\"Date\", required=false, def=\"1984-09-01\")"); //$NON-NLS-1$
-					writer.println("//def date"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"integer\", usage=\"an example integer\", widget=\"Integer\", required=false, def=\"42\")"); //$NON-NLS-1$
-					writer.println("//def integer"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"floatValue\", usage=\"an example float\", widget=\"Float\", required=false, def=\"42.42\")"); //$NON-NLS-1$
-					writer.println("//def floatValue"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"string\", usage=\"an example string\", widget=\"String\", required=false, def=\"hello world!\")"); //$NON-NLS-1$
-					writer.println("//def string"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"longString\", usage=\"an example longString\", widget=\"Text\", required=false, def=\"hello world!\")"); //$NON-NLS-1$
-					writer.println("//def longString"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("//@Field @Option(name=\"bool\", usage=\"an example boolean\", widget=\"Boolean\", required=false, def=\"true\")"); //$NON-NLS-1$
-					writer.println("//def bool"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("// Open the parameters input dialog box"); //$NON-NLS-1$
-					writer.println("if (!ParametersDialog.open(this)) return;"); //$NON-NLS-1$
-					writer.println(""); //$NON-NLS-1$
-					writer.println("// END OF PARAMETERS"); //$NON-NLS-1$ 
-					writer.println(""); //$NON-NLS-1$
-					writer.println("println \"corpora selection: \"+corpusViewSelection"); //$NON-NLS-1$
-					writer.close();
-					
-					EditFile.openfile(newfile);
-					//Explorer.refresh();
-					MacroExplorer.refresh();
-				}
-			} catch (IOException e) {
-				System.out.println(e.getLocalizedMessage());
-				return false;
-			}
-		}
-		
-		
-		return true;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditFile.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditFile.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/EditFile.java	(revision 669)
@@ -1,115 +0,0 @@
-// 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.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.rcp.editors.TxtEditor;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.utils.logger.Log;
-
-/**
- * Open a file in the TxtEditor
- * 
- * @author mdecorde.
- */
-public class EditFile extends AbstractHandler {
-
-	public static final String ID = EditFile.class.getCanonicalName(); //$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 {
-
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-		String txmhome = Toolbox.getTXMHOMEPATH();
-
-		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-		if (LastOpened.getFile(ID) != null) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-			dialog.setFileName(LastOpened.getFile(ID));
-		} else {
-			dialog.setFilterPath(txmhome);
-		}
-		if (dialog.open() == null) return null;
-		String filepath = dialog.getFilterPath() + "/" + dialog.getFileName(); //$NON-NLS-1$
-		LastOpened.set(ID, dialog.getFilterPath(), dialog.getFileName());
-		openfile(filepath);
-
-		return null;
-	}
-
-	/**
-	 * Open a file in TXM TxtEditor.
-	 *
-	 * @param filepath the filepath
-	 */
-	static public void openfile(File file) {
-		if (file.isDirectory())
-			return;
-		try {
-			IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(file.toURI());
-
-			FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
-			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-			IWorkbenchPage page = window.getActivePage();
-
-			IEditorPart a = page.openEditor(editorInput, TxtEditor.ID, true);
-			TxtEditor editor = (TxtEditor) a;
-		} catch (Exception e) {
-			Log.printStackTrace(e);
-		}
-	}
-
-	/**
-	 * Openfile.
-	 *
-	 * @param filepath the filepath
-	 */
-	static public void openfile(String filepath) {
-		openfile(new File(filepath));
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportResult.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportResult.java	(revision 669)
@@ -1,175 +0,0 @@
-// 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.function;
-
-import java.io.File;
-import java.io.IOException;
-
-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.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
-import org.txm.rcp.JobsTimer;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.StatusLine;
-import org.txm.rcp.commands.EditFile;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.rcp.utils.JobHandler;
-// TODO: Auto-generated Javadoc
-/**
- * export a result of a result by calling the function toTxt(File f) then show
- * the result in the text editor @ author mdecorde.
- */
-public class ExportResult extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.function.ExportResult"; //$NON-NLS-1$
-	/** The selection. */
-	private IStructuredSelection selection;
-
-	/** The lastopenedfile. */
-	//private static String lastopenedfile;
-
-	/**
-	 * Export a TXM result in a CSV file.
-	 *
-	 * @param event the event
-	 * @return the object
-	 * @throws ExecutionException the execution exception
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
-		final Object s = selection.getFirstElement();
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-
-		//String txmhome = Toolbox.getTXMHOMEPATH();
-		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-
-		String extensions[] = {"*.csv"}; //$NON-NLS-1$
-		if (s instanceof TXMResult) {
-			extensions = ((TXMResult)s).getExportTXTExtensions(); //$NON-NLS-1$
-		}
-		dialog.setFilterExtensions(extensions);
-
-		if (LastOpened.getFile(ID) != null) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-		}
-
-		if (dialog.open() != null) {
-			StatusLine.setMessage(RCPMessages.ExportResult_0);
-			String filepath = dialog.getFilterPath()
-					+ "/" + dialog.getFileName(); //$NON-NLS-1$
-			if (!(filepath.endsWith(extensions[0].substring(1))))
-				filepath += extensions[0].substring(1);
-
-			final File outfile = new File(filepath);
-			LastOpened.set(ID, outfile.getParent(), outfile.getName());
-			try {
-				outfile.createNewFile();
-			} catch (IOException e1) {
-				System.err.println(NLS.bind(RCPMessages.ExportResult_3, outfile, e1));
-			}
-			if (!outfile.canWrite()) {
-				System.out.println(NLS.bind(RCPMessages.ExportResult_5, outfile));
-				return null;
-			}
-			if (!outfile.isFile()) {
-				System.out.println("Error: " + outfile + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
-				return null;
-			}
-
-			final String encoding = TXMPreferences.getString(TBXPreferences.EXPORT_ENCODING, TBXPreferences.PREFERENCES_NODE);
-			String _colseparator = TXMPreferences.getString(TBXPreferences.EXPORT_COLSEPARATOR, TBXPreferences.PREFERENCES_NODE);
-			final String colseparator = _colseparator;
-			String _txtseparator = TXMPreferences.getString(TBXPreferences.EXPORT_TXTSEPARATOR, TBXPreferences.PREFERENCES_NODE);
-			final String txtseparator = _txtseparator;
-
-			JobHandler jobhandler = new JobHandler(RCPMessages.ExportResult_0) {
-				@Override
-				protected IStatus run(IProgressMonitor monitor) {
-					try {
-						this.runInit(monitor);
-						monitor.beginTask(RCPMessages.ExportResult_1, 100);
-
-						if (s instanceof TXMResult) {
-							((TXMResult)s).setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
-							((TXMResult)s).toTxt(outfile, encoding, colseparator, txtseparator);
-						} else {
-							System.out.println("Exported object is not a TXMResult result");
-							return Status.CANCEL_STATUS;
-						}
-
-						if (outfile.exists()) {
-							// Open internal editor in the UI thread
-							if(TXMPreferences.getBoolean(TBXPreferences.EXPORT_SHOW, TBXPreferences.PREFERENCES_NODE))	{
-								this.syncExec(new Runnable() {
-									@Override
-									public void run() {
-										EditFile.openfile(outfile.getAbsolutePath());
-									}
-								});
-							}
-
-							System.out.println(NLS.bind("", outfile.getAbsolutePath())); //$NON-NLS-1$
-						} else {
-							System.out.println(NLS.bind(RCPMessages.ExportResult_6, outfile.getAbsolutePath()));
-						}
-					} catch (ThreadDeath td) {
-						if (s instanceof TXMResult)
-							((TXMResult)s).clean();
-						return Status.CANCEL_STATUS;
-					} catch (Exception e) {
-						System.out.println(NLS.bind(RCPMessages.ExportResult_6, s, e));
-						org.txm.rcp.utils.Logger.printStackTrace(e);
-						return Status.CANCEL_STATUS;
-					} finally {
-						if (s instanceof TXMResult)
-							((TXMResult)s).setCurrentMonitor(null);
-						monitor.done();
-						JobsTimer.stopAndPrint();
-					}
-					return Status.OK_STATUS;
-				}
-			};
-
-			jobhandler.startJob();
-		}
-		return null;
-	}
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportSVG.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportSVG.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportSVG.java	(revision 669)
@@ -1,185 +0,0 @@
-// 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.function;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
-import org.txm.rcp.RCPMessages;
-import org.txm.rcp.swt.dialog.LastOpened;
-import org.txm.utils.io.FileCopy;
-
-/**
- * save the SVG file selected @ author mdecorde.
- */
-@Deprecated
-public class ExportSVG extends AbstractHandler {
-
-	private static final String ID = "org.txm.rcp.commands.function.ExportSVG"; //$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 {
-		// FIXME : implement charts engine after we defined if here we need to export the chart or the view
-//		try {
-//			// After that call directly "ExportChart" or "ExportChartEditorView"
-//			System.out.println(Messages.ExportSVG_0);
-//			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-//
-//			String txmhome = Toolbox.getTXMHOMEPATH();
-//
-//			// get editor
-//			IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
-//					.getActivePage().getActivePart();
-//
-//			String prefDevice = TxmPreferences.getString(ExportPreferencePage.RDEVICE, "SVG"); //$NON-NLS-1$
-//			RDevice device = RDevice.valueOf(prefDevice.toUpperCase());
-//			System.out.println(NLS.bind(Messages.ExportSVG_2, device));
-//
-//			new File(txmhome, "results").mkdir(); //$NON-NLS-1$
-//			File svgSourceFile = new File(txmhome, "results/temp"+device.getExt()); //$NON-NLS-1$
-//			
-//			if (page instanceof SVGGraphicEditor) {
-//				SVGGraphicEditor te = (SVGGraphicEditor) page;
-//				svgSourceFile = te.getSVGFile();
-//				device = RDevice.SVG;
-//			} else if (page instanceof CorporaView) {
-//				CorporaView view = (CorporaView) page;
-//				StructuredSelection sel = (StructuredSelection) view.getTreeViewer().getSelection();
-//				Object obj = sel.getFirstElement();
-//				//System.out.println("sel: "+obj);
-//				if (obj instanceof CAH) {
-//					ChartsEngine.getChartsEngine(RChartsEngine.class).getChartCreator(CAH.class).createChartFile(obj, svgSourceFile, CAHPreferences.PREFERENCES_NODE);
-////						((CAH)obj).toSVG(svgSourceFile, device);
-//				}
-//				else if (obj instanceof Progression) {
-//					ChartsEngine.getChartsEngine(RChartsEngine.class).getChartCreator(Progression.class).createChartFile(obj, svgSourceFile, ProgressionPreferences.PREFERENCES_NODE);
-////						((Progression)obj).toSvg(svgSourceFile, device);
-//				}
-//			}
-//
-//			if (svgSourceFile != null && svgSourceFile.exists()) {
-//				String ext = null;
-//				if (svgSourceFile.getName().lastIndexOf(".") > 0) { //$NON-NLS-1$
-//					ext = svgSourceFile.getName();
-//					ext = ext.substring(ext.lastIndexOf("."), ext.length()); //$NON-NLS-1$
-//				}
-//				FileDialog dialog = new FileDialog(shell, SWT.SAVE);
-//				String[] exts = {"*"+device.getExt()}; //$NON-NLS-1$
-//				dialog.setFilterExtensions(exts);
-//				
-//				if (LastOpened.getFile(ID) != null) {
-//					dialog.setFilterPath(LastOpened.getFolder(ID));
-//					//dialog.setFileName(LastOpened.getFile(ID));
-//				} else {
-//					dialog.setFilterPath(txmhome);
-//				}
-//
-//				File outfile;
-//
-//				if (dialog.open() != null) {
-//					String filename =  dialog.getFileName(); //$NON-NLS-1$
-//					if (!filename.endsWith(device.getExt())) 
-//						filename = filename+device.getExt();
-//					outfile = new File(dialog.getFilterPath(), filename);
-//					LastOpened.set(ID, outfile);
-//				} else
-//					return null;
-//
-//				try {
-//					JobsTimer.start();
-//					StatusLine.setMessage(""); //$NON-NLS-1$
-//					FileCopy.copy(svgSourceFile, outfile);
-//					if (outfile.exists()) {
-//						System.out.println(NLS.bind(Messages.ExportSVG_1, outfile, device.getName())); 
-//					} else {
-//						System.out.println(NLS.bind(Messages.ExportSVG_3 + outfile, device.getExt()));
-//					}
-//
-//				} catch (IOException e) {
-//					System.err.println("Export failed: " + svgSourceFile //$NON-NLS-1$
-//							+ "" + outfile + ": " + e); //$NON-NLS-1$ //$NON-NLS-2$ 
-//				}
-//			}
-//		} catch(Exception e) {
-//			System.out.println(e.getLocalizedMessage());
-//			org.txm.rcp.utils.Logger.printStackTrace(e);
-//		}
-		return null;
-	}
-
-	/**
-	 * Export.
-	 *
-	 * @param infile the infile
-	 */
-	public static void export(File infile) {
-		// Shell shell =
-		// HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-		String txmhome = Toolbox.getTXMHOMEPATH();
-		FileDialog dialog = new FileDialog(new Shell(), SWT.SAVE);
-		if (LastOpened.getFile(ID) != null) {
-			dialog.setFilterPath(LastOpened.getFolder(ID));
-			dialog.setFileName(LastOpened.getFile(ID));
-		} else {
-			dialog.setFilterPath(txmhome);
-		}
-
-		File outfile;
-
-		if (dialog.open() != null) {
-			outfile = new File(dialog.getFilterPath(), dialog.getFileName());
-			LastOpened.set(ID, outfile);
-		} else
-			return;
-
-		try {
-			FileCopy.copy(infile, outfile);
-		} catch (IOException e) {
-			System.out.println("Error: " + infile //$NON-NLS-1$
-					+ "" + outfile + ": " + e); //$NON-NLS-1$ //$NON-NLS-2$ 
-		}
-
-		if (outfile.exists()) {
-			System.out.println(NLS.bind(RCPMessages.ExportSVG_1, outfile, ""));  //$NON-NLS-1$
-		} else {
-			System.out.println(NLS.bind(RCPMessages.ExportSVG_3 + outfile, "")); //$NON-NLS-1$
-		}
-	}
-
-}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CloseEditorsUsing.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CloseEditorsUsing.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CloseEditorsUsing.java	(revision 669)
@@ -6,8 +6,8 @@
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorReference;
 import org.eclipse.ui.IWorkbenchPage;
-import org.txm.rcp.commands.base.DeleteObject;
 import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.results.DeleteObject;
 import org.txm.searchengine.cqp.corpus.Corpus;
 
 public class CloseEditorsUsing extends AbstractHandler {
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/editor/SaveAs.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/editor/SaveAs.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/editor/SaveAs.java	(revision 669)
@@ -40,8 +40,8 @@
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.commands.EditFile;
 import org.txm.rcp.editors.TxtEditor;
+import org.txm.rcp.handlers.files.EditFile;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.views.fileexplorer.Explorer;
 // TODO: Auto-generated Javadoc
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 669)
@@ -15,7 +15,7 @@
 import org.txm.importer.ImportKeys;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.commands.CloseEditorsUsing;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.utils.logger.Log;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImports.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImports.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImports.java	(revision 669)
@@ -46,7 +46,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.JobsTimer;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.utils.zip.Zip;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImportLangs.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImportLangs.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/tests/TestImportLangs.java	(revision 669)
@@ -24,7 +24,7 @@
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.JobsTimer;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.utils.io.IOUtils;
 import org.xml.sax.SAXException;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportSelectedText.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportSelectedText.java	(revision 668)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportSelectedText.java	(revision 669)
@@ -49,6 +49,7 @@
 import org.txm.objects.BaseParameters;
 import org.txm.objects.Project;
 import org.txm.rcp.RCPMessages;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
 import org.txm.utils.LangDetector;
 import org.txm.utils.xml.DomUtils;
Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 668)
+++ tmp/org.txm.rcp/plugin.xml	(revision 669)
@@ -2284,17 +2284,17 @@
             name="%category.name.0">
       </category>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteGroovyScript"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteGroovyScript"
             id="org.txm.rcp.commands.ExecuteScriptGroovy"
             name="%command.name.0">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteGroovyText"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteGroovyText"
             id="org.txm.rcp.commands.ExecuteGroovyText"
             name="%command.name.10">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteImportScript"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteImportScript"
             id="org.txm.rcp.commands.ExecuteScriptImport"
             name="%command.name.22">
          <commandParameter
@@ -2327,7 +2327,7 @@
             name="%command.name.25">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.base.DeleteObject"
+            defaultHandler="org.txm.rcp.handlers.results.DeleteObject"
             id="org.txm.rcp.commands.base.DeleteObject"
             name="%command.name.26">
       </command>
@@ -2355,7 +2355,7 @@
          </commandParameter>
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteGroovyScriptFromFile"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteGroovyScriptFromFile"
             id="org.txm.rcp.commands.ExecuteScriptGroovyFromFile"
             name="%command.name.66">
       </command>
@@ -2378,7 +2378,7 @@
             name="%command.name.19">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteScript"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteScript"
             id="org.txm.rcp.commands.ExecuteScript"
             name="%command.name.21">
             <commandParameter
@@ -2388,7 +2388,7 @@
          </commandParameter>
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteText"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteText"
             id="org.txm.rcp.commands.ExecuteText"
             name="%command.name.50">
       </command>
@@ -2420,7 +2420,7 @@
          </commandParameter>
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteGroovyMacro"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteGroovyMacro"
             id="org.txm.rcp.commands.ExecuteMacro"
             name="%command.name.79">
             <commandParameter
@@ -2430,7 +2430,7 @@
          </commandParameter>
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.CreateMacro"
+            defaultHandler="org.txm.rcp.handlers.scripts.CreateMacro"
             id="org.txm.rcp.commands.CreateMacro"
             name="%command.name.80">
       </command>
@@ -2458,7 +2458,7 @@
             name="%command.name.88">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.ExecuteLastGroovyScript"
+            defaultHandler="org.txm.rcp.handlers.scripts.ExecuteLastGroovyScript"
             id="org.txm.rcp.commands.ExecuteLastGroovyScript"
             name="%command.name.89">
       </command>
@@ -2486,7 +2486,7 @@
             name="Reload">
       </command>
       <command
-            defaultHandler="org.txm.rcp.handlers.ComputeTXMResult"
+            defaultHandler="org.txm.rcp.handlers.results.ComputeTXMResult"
             description="Compute/Update the TXMResult of a TXMEditor"
             id="org.txm.rcp.handlers.ComputeTXMResult"
             name="Compute">
@@ -2510,12 +2510,12 @@
             name="%command.name.85">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.function.ExportResult"
+            defaultHandler="org.txm.rcp.handlers.export.ExportResult"
             id="org.txm.rcp.commands.function.ExportResult"
             name="%command.name.24">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.function.ExportSVG"
+            defaultHandler="org.txm.rcp.handlers.export.ExportSVG"
             id="org.txm.rcp.commands.function.ExportSVG"
             name="%command.name.34">
       </command>
@@ -2581,12 +2581,12 @@
             name="%command.name.56">
       </command>
       <command
-            defaultHandler="org.txm.rcp.commands.DownloadFile"
+            defaultHandler="org.txm.rcp.handlers.files.DownloadFile"
             id="org.txm.rcp.commands.DownloadFile"
             name="%command.name.91">
       </command>
       <command
-            defaultHandler="org.txm.rcp.handlers.CloneTXMResult"
+            defaultHandler="org.txm.rcp.handlers.results.CloneTXMResult"
             id="CloneTXMResult"
             name="Clone result">
       </command>
@@ -2602,7 +2602,7 @@
       </category>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.CutFile"
+            defaultHandler="org.txm.rcp.handlers.files.CutFile"
             id="org.txm.rcp.commands.CutFile"
             name="%command.name.71">
       </command>
@@ -2614,49 +2614,49 @@
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.DeleteFile"
+            defaultHandler="org.txm.rcp.handlers.files.DeleteFile"
             id="org.txm.rcp.commands.DeleteFile"
             name="%command.name.68">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.CopyFile"
+            defaultHandler="org.txm.rcp.handlers.files.CopyFile"
             id="org.txm.rcp.commands.CopyFile"
             name="%command.name.69">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.PasteFile"
+            defaultHandler="org.txm.rcp.handlers.files.PasteFile"
             id="org.txm.rcp.commands.PasteFile"
             name="%command.name.70">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.RenameFile"
+            defaultHandler="org.txm.rcp.handlers.files.RenameFile"
             id="org.txm.rcp.commands.RenameFile"
             name="%command.name.108">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.CreateFile"
+            defaultHandler="org.txm.rcp.handlers.files.CreateFile"
             id="org.txm.rcp.commands.CreateFile"
             name="%command.name.47">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.CreateFolder"
+            defaultHandler="org.txm.rcp.handlers.files.CreateFolder"
             id="org.txm.rcp.commands.CreateFolder"
             name="%command.name.48">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.EditSelectedFile"
+            defaultHandler="org.txm.rcp.handlers.files.EditSelectedFile"
             id="org.txm.rcp.commands.EditSelectedFile"
             name="%command.name.106">
       </command>
       <command
             categoryId="org.txm.rcp.categories.file"
-            defaultHandler="org.txm.rcp.commands.EditFile"
+            defaultHandler="org.txm.rcp.handlers.files.EditFile"
             id="org.txm.rcp.commands.EditFile"
             name="%command.name">
          <commandParameter
Index: tmp/org.txm.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.rcp/META-INF/MANIFEST.MF	(revision 668)
+++ tmp/org.txm.rcp/META-INF/MANIFEST.MF	(revision 669)
@@ -77,6 +77,7 @@
  org.apache.commons.cli,
  org.apache.commons.lang,
  org.apache.commons.lang.builder,
+ org.apache.commons.lang.enum,
  org.apache.commons.lang.enums,
  org.apache.commons.lang.exception,
  org.apache.commons.lang.math,
@@ -128,7 +129,6 @@
  org.txm.rcp.actions,
  org.txm.rcp.adapters,
  org.txm.rcp.commands,
- org.txm.rcp.commands.base,
  org.txm.rcp.commands.editor,
  org.txm.rcp.commands.function,
  org.txm.rcp.commands.queryview,
@@ -142,6 +142,10 @@
  org.txm.rcp.editors.input,
  org.txm.rcp.editors.listeners,
  org.txm.rcp.handlers,
+ org.txm.rcp.handlers.export,
+ org.txm.rcp.handlers.files,
+ org.txm.rcp.handlers.results,
+ org.txm.rcp.handlers.scripts,
  org.txm.rcp.jface,
  org.txm.rcp.log,
  org.txm.rcp.p2.plugins,
Index: tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/commands/RecodeCorpus.java
===================================================================
--- tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/commands/RecodeCorpus.java	(revision 668)
+++ tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/commands/RecodeCorpus.java	(revision 669)
@@ -26,7 +26,7 @@
 import org.txm.importer.ImportKeys;
 import org.txm.objects.BaseParameters;
 import org.txm.rcp.commands.CloseEditorsUsing;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.swt.widget.parameters.ParametersDialog;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
Index: tmp/org.txm.chartsengine.rcp/plugin.xml
===================================================================
--- tmp/org.txm.chartsengine.rcp/plugin.xml	(revision 668)
+++ tmp/org.txm.chartsengine.rcp/plugin.xml	(revision 669)
@@ -92,7 +92,7 @@
       </menuContribution>
       <menuContribution
             allPopups="false"
-            locationURI="toolbar:org.txm.rcp.toolbarresult?before=org.txm.rcp.commands.function.ExportResult">
+            locationURI="toolbar:org.txm.rcp.toolbarresult?before=org.txm.rcp.handlers.export.ExportResult">
          <command
                commandId="ExportChart"
                icon="icons/export_chart.png"
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportTEICorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportTEICorpus.java	(revision 668)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportTEICorpus.java	(revision 669)
@@ -14,7 +14,7 @@
 import org.txm.analec.AnalecCorpora;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.swt.widget.parameters.ParametersDialog;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
Index: tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportGlozzCorpus.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportGlozzCorpus.java	(revision 668)
+++ tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportGlozzCorpus.java	(revision 669)
@@ -17,7 +17,7 @@
 import org.txm.analec.AnalecCorpora;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.BaseParameters;
-import org.txm.rcp.commands.ExecuteImportScript;
+import org.txm.rcp.handlers.scripts.ExecuteImportScript;
 import org.txm.rcp.swt.widget.parameters.ParametersDialog;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
