Index: tmp/org.txm.rcp/icons/functions/import_parameters.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

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

Index: tmp/org.txm.rcp/icons/functions/import_data.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

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

Index: tmp/org.txm.rcp/icons/functions/export_parameters.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java	(revision 1512)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java	(revision 1513)
@@ -34,8 +34,8 @@
  *
  */
 public class SWTEditorsUtils {
-	
-	
+
+
 	/**
 	 * Gets an editor for the specified result if its opened.
 	 * @param result the result used by the editor to find
@@ -43,10 +43,12 @@
 	 */
 	public static IEditorPart getEditor(TXMResult result)	{
 
-		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-		IWorkbenchPage page = window.getActivePage();
-		
-		return page.findEditor(new TXMResultEditorInput<TXMResult>(result));
+		for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+			for (IWorkbenchPage page : window.getPages()) {
+				return page.findEditor(new TXMResultEditorInput<TXMResult>(result));
+			}
+		}
+		return null;
 	}
 
 	/**
@@ -83,74 +85,74 @@
 
 					}
 				}
-				
+
 			}
 		}
-		
+
 		return editors;
-		
+
 	}
-	
+
 	/**
 	 * Gets the current active editor.
 	 * @param event
 	 * @return
 	 */
 	public static TXMEditor getActiveEditor(ExecutionEvent event)	{
-		
+
 		IEditorPart editor = null;
-		
+
 		if(event != null)	{
 			editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor();
 		}
 		else	{
 			editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
 		}
-		
+
 		if(editor instanceof TXMMultiPageEditor)	{
 			editor = ((TXMMultiPageEditor)editor).getMainEditorPart();
-			
+
 		}
-		
+
 		if(!(editor instanceof TXMEditor))	{
 			return null;
 		}
-		
+
 		return (TXMEditor)editor;
 	}
 
-	
-//	// FIXME: SJ: seems useless since page.findEditor() seem to return the multipage editor if a nested editor exists? 
-//	/***
-//	 * Gets an editor for the specified result if its opened inside a TXMMultiPageEditor.
-//	 * @param result the result used by the editor to find
-//	 * @return the editor if its opened otherwise null
-//	 */
-//	public static IEditorPart getEditorInMultiPageEditor(TXMResult result)	{
-//		
-//		IEditorPart editor = null;
-//		
-//		for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) {
-//			IEditorPart tmpEditor = reference.getEditor(false);
-//
-//			if(tmpEditor instanceof TXMMultiPageEditor)	{
-//				TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)tmpEditor);
-//				for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) {
-//					if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor)	{
-//						TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i));
-//						if(txmEditor.getResult() == result)	{
-//							editor = txmEditor;
-//							break;
-//						}
-//					}
-//				}
-//				
-//			}
-//		}
-//		
-//		return editor;
-//	}
-	
+
+	//	// FIXME: SJ: seems useless since page.findEditor() seem to return the multipage editor if a nested editor exists? 
+	//	/***
+	//	 * Gets an editor for the specified result if its opened inside a TXMMultiPageEditor.
+	//	 * @param result the result used by the editor to find
+	//	 * @return the editor if its opened otherwise null
+	//	 */
+	//	public static IEditorPart getEditorInMultiPageEditor(TXMResult result)	{
+	//		
+	//		IEditorPart editor = null;
+	//		
+	//		for (IEditorReference reference : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) {
+	//			IEditorPart tmpEditor = reference.getEditor(false);
+	//
+	//			if(tmpEditor instanceof TXMMultiPageEditor)	{
+	//				TXMMultiPageEditor txmMultipageEditor = ((TXMMultiPageEditor)tmpEditor);
+	//				for (int i = 0; i < txmMultipageEditor.getEditors().size(); i++) {
+	//					if(txmMultipageEditor.getEditors().get(i) instanceof TXMEditor)	{
+	//						TXMEditor txmEditor = ((TXMEditor)txmMultipageEditor.getEditors().get(i));
+	//						if(txmEditor.getResult() == result)	{
+	//							editor = txmEditor;
+	//							break;
+	//						}
+	//					}
+	//				}
+	//				
+	//			}
+	//		}
+	//		
+	//		return editor;
+	//	}
+
 	/**
 	 * Checks if the editor specified by its editor input is already open in the active page.
 	 * @param editorInput
@@ -174,16 +176,16 @@
 		}
 		return null;
 	}
-	
-//	/**
-//	 * Checks if the specified editor is already open in the active page.
-//	 * @param editor
-//	 * @return
-//	 */
-//	public static boolean isOpenEditor(EditorPart editor)	{
-//		return isOpenEditor(editor.getEditorInput());
-//	}
 
+	//	/**
+	//	 * Checks if the specified editor is already open in the active page.
+	//	 * @param editor
+	//	 * @return
+	//	 */
+	//	public static boolean isOpenEditor(EditorPart editor)	{
+	//		return isOpenEditor(editor.getEditorInput());
+	//	}
+
 	/**
 	 * Splits the parent area of an editor and add another one in this area by splitting it. 
 	 * (Same behavior than the splitting drag and drop event on editor.)
@@ -210,7 +212,7 @@
 	public static void addEditor(EditorPart parentEditor, EditorPart editorToAdd, int position) {
 		addEditor(parentEditor, editorToAdd, position, 0.5f);
 	}
-	
+
 	/**
 	 * Splits the parent area of a part and add another one in this area by splitting it. 
 	 * (Same behavior than the splitting drag and drop event on editor.)
@@ -232,7 +234,7 @@
 		}
 		service.insert(stackToInsert, (MPartSashContainerElement) parent, position, percent);
 	}
-	
+
 	/**
 	 * Creates a part stack for the specified part.
 	 * @param part
@@ -245,4 +247,46 @@
 		stack.setSelectedElement(stackElement);
 		return stack;
 	}
+
+	/**
+	 * close a TXMEditor from its result
+	 * 
+	 * @param r
+	 */
+	public static boolean closeEditor(TXMResult r) {
+		IEditorPart e = getEditor(r);
+		if (e != null && e instanceof TXMEditor && ((TXMEditor)e).getResult() == r) {
+			((TXMEditor)e).close();
+			return true;
+		}
+		return false;
+	}
+
+	public static boolean refreshEditor(TXMResult r) {
+		IEditorPart e = getEditor(r);
+		if (e != null && e instanceof TXMEditor && ((TXMEditor)e).getResult() == r) {
+			try {
+				((TXMEditor)e).refresh(true);
+				return true;
+			} catch (Exception e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
+		}
+		return false;
+	}
+	
+	public static boolean activateEditor(TXMResult r) {
+		IEditorPart e = getEditor(r);
+		if (e != null && e instanceof TXMEditor && ((TXMEditor)e).getResult() == r) {
+			try {
+				((TXMEditor)e).getSite().getPage().activate(e);
+				return true;
+			} catch (Exception e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
+		}
+		return false;
+	}
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResult.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResult.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResult.java	(revision 1513)
@@ -0,0 +1,146 @@
+// 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.StatusLine;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+// 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 ImportResult extends AbstractHandler {
+
+	private static final String ID = ImportResult.class.getName();
+
+	/**
+	 * Export a TXM result parameters in the preferences format
+	 *
+	 * @param event the event
+	 * @return the object
+	 * @throws ExecutionException the execution exception
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		final Object s = selection.getFirstElement();
+		if (!(s instanceof TXMResult)) {
+			return null;
+		}
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+
+		//String txmhome = Toolbox.getTxmHomePath();
+		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+
+		String extensions[] = {"*.parameters"}; //$NON-NLS-1$
+		dialog.setFilterExtensions(extensions);
+
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+		}
+
+		if (dialog.open() != null) {
+			StatusLine.setMessage(TXMUIMessages.exportingResults);
+			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(TXMUIMessages.exportColonCantCreateFileP0ColonP1, outfile, e1));
+			}
+			if (!outfile.canWrite()) {
+				System.out.println(NLS.bind(TXMUIMessages.impossibleToReadP0, outfile));
+				return null;
+			}
+			if (!outfile.isFile()) {
+				System.out.println("Error: " + outfile + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
+				return null;
+			}
+
+			JobHandler jobhandler = new JobHandler(TXMUIMessages.exportingResults) {
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						this.runInit(monitor);
+						monitor.beginTask(TXMUIMessages.exporting, 100);
+
+						TXMResult parent = (TXMResult)s;
+						TXMResult r = parent.importResult(outfile);
+						CorporaView.refreshObject(r);
+						if (r != null) {
+							System.out.println(NLS.bind("{0} result imported from the {0} file.", r, outfile));
+						}
+					} catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					} catch (Exception e) {
+						System.out.println(NLS.bind(TXMUIMessages.failedToExportResultP0ColonP1, 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;
+	}
+}
\ No newline at end of file

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

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResultParameters.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResultParameters.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResultParameters.java	(revision 1513)
@@ -0,0 +1,149 @@
+// 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.StatusLine;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.utils.SWTEditorsUtils;
+import org.txm.rcp.views.corpora.CorporaView;
+// 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 ImportResultParameters extends AbstractHandler {
+
+	private static final String ID = ImportResultParameters.class.getName();
+
+	/**
+	 * Export a TXM result parameters in the preferences format
+	 *
+	 * @param event the event
+	 * @return the object
+	 * @throws ExecutionException the execution exception
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		final Object s = selection.getFirstElement();
+		if (!(s instanceof TXMResult)) {
+			return null;
+		}
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+
+		//String txmhome = Toolbox.getTxmHomePath();
+		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+
+		String extensions[] = {"*.parameters"}; //$NON-NLS-1$
+		dialog.setFilterExtensions(extensions);
+
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+		}
+
+		if (dialog.open() != null) {
+			StatusLine.setMessage(TXMUIMessages.exportingResults);
+			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(TXMUIMessages.exportColonCantCreateFileP0ColonP1, outfile, e1));
+			}
+			if (!outfile.canWrite()) {
+				System.out.println(NLS.bind(TXMUIMessages.impossibleToReadP0, outfile));
+				return null;
+			}
+			if (!outfile.isFile()) {
+				System.out.println("Error: " + outfile + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
+				return null;
+			}
+
+			JobHandler jobhandler = new JobHandler(TXMUIMessages.exportingResults) {
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						this.runInit(monitor);
+						monitor.beginTask(TXMUIMessages.exporting, 100);
+
+						TXMResult r = (TXMResult)s;
+						if (r.importParameters(outfile)) {
+							r.setDirty();
+							CorporaView.refreshObject(r);
+							System.out.println(NLS.bind("Parameter imported from the {0} file.", outfile));
+							SWTEditorsUtils.refreshEditor(r);
+						}
+					} catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					} catch (Exception e) {
+						System.out.println(NLS.bind(TXMUIMessages.failedToExportResultP0ColonP1, 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;
+	}
+}
\ No newline at end of file

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

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 1512)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResult.java	(revision 1513)
@@ -53,7 +53,7 @@
 import org.txm.rcp.utils.JobHandler;
 /**
  * Exports a result by calling the function toTxt(File f) then opens or not the result in the text editor according to the preferences.
- * @author mdecorde
+ * @author mdecorde, sjacquot
  */
 public class ExportResult extends AbstractHandler {
 
@@ -157,8 +157,6 @@
 							System.out.println(NLS.bind(TXMUIMessages.failedToExportResultP0ColonP1, outfile.getAbsolutePath()));
 						}
 					} catch (ThreadDeath td) {
-						if (s instanceof TXMResult)
-							((TXMResult)s).clean();
 						return Status.CANCEL_STATUS;
 					} catch (Exception e) {
 						System.out.println(NLS.bind(TXMUIMessages.failedToExportResultP0ColonP1, s, e));
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResultParameters.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResultParameters.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResultParameters.java	(revision 1513)
@@ -0,0 +1,167 @@
+// 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.StatusLine;
+import org.txm.rcp.handlers.files.EditFile;
+import org.txm.rcp.messages.TXMUIMessages;
+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 ExportResultParameters extends AbstractHandler {
+
+	private static final String ID = ExportResultParameters.class.getName();
+
+	/**
+	 * Export a TXM result parameters in the preferences format
+	 *
+	 * @param event the event
+	 * @return the object
+	 * @throws ExecutionException the execution exception
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		final Object s = selection.getFirstElement();
+		if (!(s instanceof TXMResult)) {
+			return null;
+		}
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+
+		//String txmhome = Toolbox.getTxmHomePath();
+		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+
+		String extensions[] = {"*.parameters"}; //$NON-NLS-1$
+		dialog.setFilterExtensions(extensions);
+
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+		}
+
+		if (dialog.open() != null) {
+			StatusLine.setMessage(TXMUIMessages.exportingResults);
+			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(TXMUIMessages.exportColonCantCreateFileP0ColonP1, outfile, e1));
+			}
+			if (!outfile.canWrite()) {
+				System.out.println(NLS.bind(TXMUIMessages.impossibleToReadP0, outfile));
+				return null;
+			}
+			if (!outfile.isFile()) {
+				System.out.println("Error: " + outfile + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
+				return null;
+			}
+
+			JobHandler jobhandler = new JobHandler(TXMUIMessages.exportingResults) {
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					try {
+						this.runInit(monitor);
+						monitor.beginTask(TXMUIMessages.exporting, 100);
+
+							TXMResult r = (TXMResult)s;
+							if (r.isAltered()) {
+								System.out.println("Warning: only parameters are exported, manual changes are not transfered.");
+							} else {
+								r.compute(this); // refresh result
+							}
+							r.setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
+							if (r.toParametersFile(outfile)) {
+								System.out.println(NLS.bind("Parameters exported to the {0} file.", outfile));
+							}
+
+						if (outfile.exists()) {
+							// Open internal editor in the UI thread
+							if(TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPORT_SHOW))	{
+								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(TXMUIMessages.failedToExportResultP0ColonP1, outfile.getAbsolutePath()));
+						}
+					} catch (ThreadDeath td) {
+						if (s instanceof TXMResult)
+							((TXMResult)s).clean();
+						return Status.CANCEL_STATUS;
+					} catch (Exception e) {
+						System.out.println(NLS.bind(TXMUIMessages.failedToExportResultP0ColonP1, 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;
+	}
+}
\ No newline at end of file

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

Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 1512)
+++ tmp/org.txm.rcp/plugin.xml	(revision 1513)
@@ -550,41 +550,44 @@
                      style="push">
                   <visibleWhen
                         checkEnabled="false">
-                     <or>
+                     <and>
                         <reference
-                              definitionId="OneLexiconSelected">
+                              definitionId="OneTXMResultSelected">
                         </reference>
+                        <not>
+                           <or>
+                              <reference
+                                    definitionId="OnePartitionSelected">
+                              </reference>
+                              <reference
+                                    definitionId="OneCorpusSelected">
+                              </reference>
+                           </or>
+                        </not>
+                     </and>
+                  </visibleWhen>
+               </command>
+               <command
+                     commandId="org.txm.rcp.handlers.export.ExportResultParameters"
+                     icon="icons/functions/export_parameters.png"
+                     style="push">
+                  <visibleWhen
+                        checkEnabled="false">
+                     <and>
                         <reference
-                              definitionId="OneConcordanceSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneSpecificitiesResultSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneIndexSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneCooccurrenceSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneReferencerSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneProgressionSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneLexicalTableSelected">
-                        </reference>
-                        <reference
-                              definitionId="OneCASelected">
-                        </reference>
-                        <reference
-                              definitionId="OneCAHSelected">
-                        </reference>
-                        <reference
                               definitionId="OneTXMResultSelected">
                         </reference>
-                     </or>
+                        <not>
+                           <or>
+                              <reference
+                                    definitionId="OnePartitionSelected">
+                              </reference>
+                              <reference
+                                    definitionId="OneCorpusSelected">
+                              </reference>
+                           </or>
+                        </not>
+                     </and>
                   </visibleWhen>
                </command>
             </menu>
@@ -690,7 +693,112 @@
          <menu
                id="menu.edit"
                label="%menu.label.3">
+               
+               <command
+                  commandId="org.txm.rcp.handlers.results.SetTXMResultPersistentState"
+                  mode="FORCE_TEXT"
+                  style="toggle">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
+                     <reference
+                           definitionId="OneTXMResultSelected">
+                     </reference>
+                     <test
+                           property="org.txm.rcp.testers.persistable"
+                           value="true">
+                     </test>
+                     <test
+                           property="org.txm.rcp.testers.AutoPersistenceDisabled">
+                     </test>
+                  </and>
+               </visibleWhen>
+            </command>
             <command
+                  commandId="org.txm.rcp.commands.function.RenameResult"
+                  label="%command.label.26"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="OneTXMResultSelected">
+                  </reference>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="org.txm.rcp.handlers.results.CloneTXMResult"
+                  label="Clone"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
+                     <reference
+                           definitionId="OneTXMResultSelected">
+                     </reference>
+                     <not>
+                        <reference
+                              definitionId="OneMainCorpusSelected">
+                        </reference>
+                     </not>
+                  </and>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="org.txm.rcp.handlers.results.CloneTXMResultTree"
+                  label="Clone all"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
+                     <reference
+                           definitionId="OneTXMResultSelected">
+                     </reference>
+                     <not>
+                        <reference
+                              definitionId="OneMainCorpusSelected">
+                        </reference>
+                     </not>
+                  </and>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="org.txm.rcp.handlers.results.ShowHiddenParents"
+                  label="Show hidden parents"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
+                     <reference
+                           definitionId="OneTXMResultSelected">
+                     </reference>
+                     <test
+                           property="org.txm.rcp.testers.IsParentHidden">
+                     </test>
+                  </and>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="org.txm.rcp.handlers.results.HideIntermediateParents"
+                  label="Hide intermediate parents"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
+                     <reference
+                           definitionId="OneTXMResultSelected">
+                     </reference>
+                     <test
+                           property="org.txm.rcp.testers.IsParentVisible"
+                           value="true">
+                     </test>
+                  </and>
+               </visibleWhen>
+            </command>
+            <separator
+                  name="org.txm.rcp.separator1">
+            </separator>
+            
+            <command
                   commandId="org.eclipse.ui.edit.findReplace"
                   label="%command.label.15">
                <visibleWhen
@@ -1267,41 +1375,48 @@
             <command
                   commandId="org.txm.rcp.commands.function.ExportResult"
                   icon="icons/functions/export_data.png"
+                  label="%command.label.51"
                   style="push">
                <visibleWhen
                      checkEnabled="false">
-                  <or>
+                  <and>
                      <reference
-                           definitionId="OneLexiconSelected">
+                           definitionId="OneTXMResultSelected">
                      </reference>
+                     <not>
+                        <or>
+                           <reference
+                                 definitionId="OnePartitionSelected">
+                           </reference>
+                           <reference
+                                 definitionId="OneCorpusSelected">
+                           </reference>
+                        </or>
+                     </not>
+                  </and>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="org.txm.rcp.handlers.export.ExportResultParameters"
+                  icon="icons/functions/export_parameters.png"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <and>
                      <reference
-                           definitionId="OneIndexSelected">
+                           definitionId="OneTXMResultSelected">
                      </reference>
-                     <reference
-                           definitionId="OneConcordanceSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneSpecificitiesResultSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneReferencerSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneProgressionSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCooccurrenceSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneLexicalTableSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCASelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCAHSelected">
-                     </reference>
-                  </or>
+                     <not>
+                        <or>
+                           <reference
+                                 definitionId="OnePartitionSelected">
+                           </reference>
+                           <reference
+                                 definitionId="OneCorpusSelected">
+                           </reference>
+                        </or>
+                     </not>
+                  </and>
                </visibleWhen>
             </command>
          </toolbar>
@@ -1832,50 +1947,83 @@
                      icon="icons/functions/export.png"
                      id="org.txm.rcp.corporaview.export"
                      label="%menu.label.13">
-                     <command
-                  commandId="org.txm.rcp.commands.function.ExportResult"
-                  icon="icons/functions/export_data.png"
-                  label="%command.label.51"
-                  style="push">
-               <visibleWhen
-                     checkEnabled="false">
-                  <or>
-                     <reference
-                           definitionId="OneLexiconSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneConcordanceSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneSpecificitiesResultSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneIndexSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneReferencerSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneProgressionSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCooccurrenceSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneLexicalTableSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCASelected">
-                     </reference>
-                     <reference
-                           definitionId="OneCAHSelected">
-                     </reference>
-                     <reference
-                           definitionId="OneTXMResultSelected">
-                     </reference>
-                  </or>
-               </visibleWhen>
-            </command>
+                  <command
+                        commandId="org.txm.rcp.commands.function.ExportResult"
+                        icon="icons/functions/export_data.png"
+                        label="%command.label.51"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <and>
+                           <reference
+                                 definitionId="OneTXMResultSelected">
+                           </reference>
+                           <not>
+                              <or>
+                                 <reference
+                                       definitionId="OnePartitionSelected">
+                                 </reference>
+                                 <reference
+                                       definitionId="OneCorpusSelected">
+                                 </reference>
+                              </or>
+                           </not>
+                        </and>
+                     </visibleWhen>
+                  </command>
+                  <command
+                        commandId="org.txm.rcp.handlers.export.ExportResultParameters"
+                        icon="icons/functions/export_parameters.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <and>
+                           <reference
+                                 definitionId="OneTXMResultSelected">
+                           </reference>
+                           <not>
+                              <or>
+                                 <reference
+                                       definitionId="OneMainCorpusSelected">
+                                 </reference>
+                              </or>
+                           </not>
+                        </and>
+                     </visibleWhen>
+                  </command>
+                  <command
+                        commandId="org.txm.rcp.handlers.export.ImportResult"
+                        icon="icons/functions/import_data.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <and>
+                           <reference
+                                 definitionId="OneTXMResultSelected">
+                           </reference>
+                        </and>
+                     </visibleWhen>
+                  </command>
+                  <command
+                        commandId="org.txm.rcp.handlers.export.ImportResultParameters"
+                        icon="icons/functions/import_parameters.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <and>
+                           <reference
+                                 definitionId="OneTXMResultSelected">
+                           </reference>
+                           <not>
+                              <or>
+                                 <reference
+                                       definitionId="OneMainCorpusSelected">
+                                 </reference>
+                              </or>
+                           </not>
+                        </and>
+                     </visibleWhen>
+                  </command>
                </menu>
             
             <separator
@@ -2402,11 +2550,31 @@
             id="org.txm.rcp.commands.function.ExportResult"
             name="%command.name.24">
       </command>
+            <command
+                  defaultHandler="org.txm.rcp.handlers.export.ExportResultParameters"
+                  id="org.txm.rcp.handlers.export.ExportResultParameters"
+                  name="Parameters...">
+      </command>
       <command
             defaultHandler="org.txm.rcp.handlers.export.ExportSVG"
             id="org.txm.rcp.commands.function.ExportSVG"
             name="%command.name.34">
       </command>
+      <command
+            defaultHandler="org.txm.rcp.handlers.export.ImportResultParameters"
+            id="org.txm.rcp.handlers.export.ImportResultParameters"
+            name="Result...">
+      </command>
+      <command
+            defaultHandler="org.txm.rcp.handlers.export.ImportResult"
+            id="org.txm.rcp.handlers.export.ImportResult"
+            name="Import result...">
+      </command>
+      <command
+            defaultHandler="org.txm.rcp.handlers.export.ImportResultParameters"
+            id="org.txm.rcp.handlers.export.ImportResultParameters"
+            name="Import result parameters...">
+      </command>
    </extension>
    <extension
          id="links"
Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 1512)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 1513)
@@ -156,6 +156,14 @@
 	public Index(String parametersNodePath)	{
 		super(parametersNodePath);
 	}
+	
+	/**
+	 * 
+	 * @param parametersNodePath
+	 */
+	public Index(String parametersNodePath, TXMResult parent)	{
+		super(parametersNodePath, parent);
+	}
 
 
 	@Override
Index: tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 1512)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 1513)
@@ -2,6 +2,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -14,18 +15,22 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.core.runtime.preferences.DefaultScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osgi.util.NLS;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.service.prefs.BackingStoreException;
 import org.osgi.service.prefs.Preferences;
 import org.txm.Toolbox;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
+import org.txm.objects.Project;
+import org.txm.utils.io.FileCopy;
 import org.txm.utils.logger.Log;
 
 
@@ -1712,6 +1717,42 @@
 		this.put(key, TXMResult.ID_TIME_FORMAT.format(date));
 	}
 
+	/**
+	 * Saves the local preferences to a file.
+	 * @param result
+	 * @throws IOException 
+	 */
+	public static boolean flush(TXMResult result, File parametersFile) throws IOException	{
+		try {
+			preferencesRootNode.node(result.getParametersNodePath()).flush();
+			
+			Project p = result.getProject();
+			String store = p.getPreferencesScope().getLocation().toString();
+			String internalPath = result.getParametersNodePath();
+			String prefix = "/project/"+p.getRCPProject().getName();
+			if (internalPath.startsWith(prefix)) {
+				internalPath = internalPath.substring(prefix.length());
+			}
+			File prefFile = new File(store, internalPath+".prefs");
+			if (prefFile.exists()) {
+				parametersFile.delete();
+				FileCopy.copy(prefFile, parametersFile);
+				if (parametersFile.exists()) {
+					return true;
+				} else {
+					System.out.println(NLS.bind("** Error: could not write parameters to {0} file.", parametersFile));
+				}
+			} else {
+				System.out.println(NLS.bind("** Error: internal preference {0} file not found.", prefFile));
+			}
+		} catch(BackingStoreException e) {
+			System.out.println(NLS.bind("Parameters exported to the {0} file: {1}.", parametersFile, e));
+			e.printStackTrace();
+			Log.severe(e.getMessage());
+		}
+		return false;
+	}
+	
 	//FIXME: this code is dedicated to dynamically retrieve the static field PREFERENCES_NODE of the runtime subclass and use it super class to avoid to pass it to all methods.
 	// eg. to use ProgressionPreferences.getBoolean("test") instead of TXMPreferences.getBoolean(ProgressionPreferences.PREFERENCES_NODE, "test")
 	// but it doesn"t work, need to continue the tests...
Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 1512)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 1513)
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -11,13 +12,17 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Properties;
 import java.util.concurrent.Semaphore;
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.xmlbeans.impl.common.IOUtil;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.preferences.DefaultScope;
 import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.service.prefs.BackingStoreException;
 import org.txm.Toolbox;
@@ -28,6 +33,7 @@
 import org.txm.objects.Workspace;
 import org.txm.stat.utils.LogMonitor;
 import org.txm.utils.AsciiUtils;
+import org.txm.utils.io.IOUtils;
 import org.txm.utils.logger.Log;
 
 // FIXME: At this moment, an empty list is created for children, to not return
@@ -200,14 +206,6 @@
 		this(null, parent);
 	}
 
-	public Date getComputeDate() {
-		return this.lastComputingDate;
-	}
-
-	public Date getCreationDate() {
-		return this.creationDate;
-	}
-	
 	/**
 	 * Creates a new TXMResult with no parent.
 	 * If a local node exist with the parent_uuid, the parent will be retrieved and this result will be added to it. 
@@ -314,6 +312,15 @@
 		}
 	}
 
+	public Date getComputeDate() {
+		return this.lastComputingDate;
+	}
+
+	public Date getCreationDate() {
+		return this.creationDate;
+	}
+	
+	
 	/**
 	 * Sets the user name.
 	 * @param name
@@ -1926,7 +1933,108 @@
 		return clone;
 	}
 
+	public boolean importParameters(File parameters) {
+		try {
+			Properties props = new Properties();
+			props.load(IOUtils.getReader(parameters));
+			
+			// some tests before...
+			String className = props.getProperty("class");
+			if (className == null || className.length() == 0) {
+				System.out.println("** Error: No class internal parameter set.");
+				return false;
+			}
+			
+			if (this.getClass().getName().equals(className)) {
+				for (Object p : props.keySet()) {
+					String ps = p.toString();
+					if (TXMPreferences.PARENT_PARAMETERS_NODE_PATH.equals(ps)) continue;
+					if (TXMPreferences.RESULT_PARAMETERS_NODE_PATH.equals(ps)) continue;
+					TXMPreferences.put(this.getParametersNodePath(), ps, props.getProperty(ps, ""));
+				}
+				this.autoLoadParametersFromAnnotations(); // update java parameters
+				this.loadParameters();
+			} else {
+				System.out.println(NLS.bind("Cannot import parameters of {0} in a {1} result.", className, this.getClass().getName()));
+				return false;
+			}
+		} catch(Exception e) {
+			Log.printStackTrace(e);
+		}
+		return true;
+	}
+	
 	/**
+	 * import a result from a parameter file
+	 * @param allparameters the parameters file
+	 * @return the created result
+	 */
+	public TXMResult importResult(File parameters) {
+		try {
+			Properties props = new Properties();
+			props.load(IOUtils.getReader(parameters));
+			
+			// some tests before...
+			String className = props.getProperty("class");
+			if (className == null || className.length() == 0) {
+				System.out.println("** Error: No class internal parameter set.");
+				return null;
+			}
+			
+			String bundleId = props.getProperty("bundle_id");
+			if (bundleId == null || bundleId.length() == 0) {
+				System.out.println("** Error: No bundle_id internal parameter set.");
+				return null;
+			}
+			
+			Bundle bundle = Platform.getBundle(bundleId);
+			if (bundle == null) {
+				Log.finest("** Error: can not restore object with bundle name " + bundleId); //$NON-NLS-1$
+				return null;
+			}
+			
+			// copy parameters
+			String newNodePath = this.getProject().getParametersNodeRootPath()+ createUUID() + "_" + className;
+			TXMPreferences.put(newNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.getParametersNodePath());
+			for (Object p : props.keySet()) {
+				String ps = p.toString();
+				if (TXMPreferences.PARENT_PARAMETERS_NODE_PATH.equals(ps)) continue;
+				if (TXMPreferences.RESULT_PARAMETERS_NODE_PATH.equals(ps)) continue;
+				TXMPreferences.put(newNodePath, ps, props.getProperty(ps, ""));
+			}
+			
+			// create instance
+			Class<?> cl = bundle.loadClass(className);
+			Constructor<?> cons = null;
+			Class clazz = this.getClass();
+			while (cons == null) {
+				if (clazz.getSimpleName().equals("TXMResult")) {
+					continue; // no luck
+				}
+				try {
+					cons = cl.getConstructor(clazz);
+				} catch (Exception ce) {
+					clazz = clazz.getSuperclass();
+				}
+			}
+			
+			if (cons == null) {
+				System.out.println(NLS.bind("Cannot import {0} in {1}", parameters, this));
+			} else {
+				cons = cl.getConstructor(String.class);
+				TXMResult result = (TXMResult) cons.newInstance(newNodePath);
+				System.out.println(NLS.bind("{0} imported", result));
+				return result;
+			}
+			
+		} catch (Exception e) {
+			System.out.println(NLS.bind("Fail to import result from {0}: {1}", parameters, e));
+			Log.printStackTrace(e);
+		}
+		return null;
+	}
+	
+	/**
 	 * Set the TXMResult parameters
 	 * 
 	 * @param parameters
@@ -2471,4 +2579,8 @@
 	public ArrayList<HashMap<String, Object>> getParametersHistory() {
 		return parametersHistory;
 	}
+
+	public boolean toParametersFile(File outfile) throws IOException {
+		return TXMPreferences.flush(this, outfile);
+	}
 }
