Index: DefaultJExportProcessPanel.java
===================================================================
--- DefaultJExportProcessPanel.java	(revision 44385)
+++ DefaultJExportProcessPanel.java	(revision 44386)
@@ -27,8 +27,10 @@
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.logging.Level;
 import javax.swing.JButton;
 
 import javax.swing.JComponent;
@@ -38,19 +40,20 @@
 import jwizardcomponent.DefaultJWizardComponents;
 
 import org.gvsig.export.ExportException;
+import org.gvsig.export.ExportLocator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.gvsig.fmap.dal.feature.Feature;
 import org.gvsig.gui.beans.wizard.WizardPanel;
 import org.gvsig.gui.beans.wizard.WizardPanelActionListener;
-import org.gvsig.gui.beans.wizard.WizardPanelWithLogo;
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.i18n.I18nManager;
 import org.gvsig.export.ExportParameters;
 import org.gvsig.export.ExportProcess;
 import org.gvsig.export.Filter;
 import org.gvsig.export.spi.ExportServiceFactory;
+import org.gvsig.export.spi.ExportServiceManager;
 import org.gvsig.export.swing.ExportSwingLocator;
 import org.gvsig.export.swing.JExportProcessPanel;
 import org.gvsig.export.swing.impl.panels.ExportProgressPanel;
@@ -61,6 +64,7 @@
 import org.gvsig.export.swing.spi.ExportPanelsManager;
 import org.gvsig.gui.beans.wizard.WizardPanelWithLogo;
 import org.gvsig.gui.beans.wizard.panel.OptionPanel;
+import org.gvsig.tools.bookmarksandhistory.History;
 
 /**
  * Default implementation for the {@link JExportProcessPanel}.
@@ -68,10 +72,9 @@
  * @author gvSIG Team
  * @version $Id$
  */
-public class DefaultJExportProcessPanel 
+public class DefaultJExportProcessPanel
         extends JPanel
-        implements JExportProcessPanel, WizardPanel 
-    {
+        implements JExportProcessPanel, WizardPanel {
 
     private static final Logger LOG = LoggerFactory.getLogger(DefaultJExportProcessPanel.class);
 
@@ -81,35 +84,34 @@
     private WizardPanelWithLogo wizardPanel;
     private WizardPanelActionListener wizardListener;
     private int lastAction;
-    
-    
+
     public DefaultJExportProcessPanel(
-            ExportProcess process, 
+            ExportProcess process,
             Filter<ExportServiceFactory> serviceFilter
-        ) {
+    ) {
         this.process = process;
         this.serviceFilter = serviceFilter;
         this.finishListeners = new HashSet<>();
         this.initComponents();
     }
-    
+
     private void initComponents() {
         I18nManager i18n = ToolsLocator.getI18nManager();
-        
+
         this.wizardPanel = new WizardPanelWithLogo();
         this.addPanel(
-            new SelectFormatPanel(
-                this,
-                this.process.getParameters(), 
-                this.serviceFilter, 
-                new ActionListener() {
+                new SelectFormatPanel(
+                        this,
+                        this.process.getParameters(),
+                        this.serviceFilter,
+                        new ActionListener() {
                     @Override
                     public void actionPerformed(ActionEvent e) {
-                        doAddPanels(((SelectFormatPanel)(e.getSource())).getSelectedService());
+                        doAddPanels(((SelectFormatPanel) (e.getSource())).getSelectedService());
                     }
                 }
-            )
-        );        
+                )
+        );
         this.setLayout(new BorderLayout());
         this.add(this.wizardPanel, BorderLayout.CENTER);
         this.wizardPanel.setFinishButtonText(i18n.getTranslation("export"));
@@ -120,52 +122,61 @@
         this.wizardPanel.setFinishButtonEnabled(false);
         this.setPreferredSize(new Dimension(600, 350));
     }
-    
+
     private void addPanel(ExportPanel panel) {
         OptionPanel optionPanel = new WizardOptionPanelAdapter(this, panel);
         this.wizardPanel.addOptionPanel(optionPanel);
     }
-    
+
     private void doAddPanels(ExportServiceFactory serviceFactory) {
-        
+
         try {
             removePreviousPanels();
+            if (this.process.getParameters() != null) {
+                if (this.process.getParameters().getServiceName() != serviceFactory.getName()) {
+                    this.process.setParameters(null);
+                }
+            }
             
-            this.process.setOutputFormat(serviceFactory.getName());
+            if (this.process.getParameters()==null) {
+                this.process.setOutputFormat(serviceFactory.getName());
+            }
+            
+
             ExportParameters parameters = this.process.getParameters();
-            
+
             ExportPanelsManager panelsManager = ExportSwingLocator.getExportPanelsManager();
             ExportPanelsFactory panelsFactory = panelsManager.getPanelsFactory(serviceFactory.getName());
             ExportPanels panels = panelsFactory.createPanels(this, parameters);
             for (ExportPanel panel : panels) {
                 this.addPanel(panel);
             }
-            if( parameters.needsSelectTargetProjection() ) {
-                if( ! panels.contains(ExportPanelsManager.PANEL_SELECT_TARGET_PROJECTION) ) {
-                    this.addPanel( panelsManager.createStandardPanel(
+            if (parameters.needsSelectTargetProjection()) {
+                if (!panels.contains(ExportPanelsManager.PANEL_SELECT_TARGET_PROJECTION)) {
+                    this.addPanel(panelsManager.createStandardPanel(
                             ExportPanelsManager.PANEL_SELECT_TARGET_PROJECTION,
                             this,
                             parameters
-                        )
+                    )
                     );
                 }
             }
-            if( ! panels.contains(ExportPanelsManager.PANEL_SELECT_FILTER) ) {
-                this.addPanel( panelsManager.createStandardPanel(
+            if (!panels.contains(ExportPanelsManager.PANEL_SELECT_FILTER)) {
+                this.addPanel(panelsManager.createStandardPanel(
                         ExportPanelsManager.PANEL_SELECT_FILTER,
                         this,
                         parameters
-                    )
+                )
                 );
             }
             this.addPanel(new ExportProgressPanel(this, parameters));
 
         } catch (ExportException ex) {
-            LOG.warn("Can't add panels to wizard.",ex);
+            LOG.warn("Can't add panels to wizard.", ex);
             showError(ex);
         }
     }
-    
+
     @Override
     public ExportProcess getProcess() {
         return this.process;
@@ -175,11 +186,11 @@
     public ExportParameters getParameters() {
         return this.process.getParameters();
     }
-    
+
     @Override
     public void setWizardPanelActionListener(
             WizardPanelActionListener wizardListener
-        ) {
+    ) {
         this.wizardListener = wizardListener;
     }
 
@@ -205,18 +216,18 @@
         DefaultJWizardComponents wizardComponents = wizardPanel.getWizardComponents();
         for (int i = wizardComponents.getWizardPanelList().size() - 1; i >= 1; i--) {
             wizardComponents.removeWizardPanel(i);
-        }        
+        }
     }
-    
+
     private void lastWizard() {
         this.wizardPanel.getWizardComponents().getNextButton()
-            .getActionListeners()[0].actionPerformed(null);
-    }    
+                .getActionListeners()[0].actionPerformed(null);
+    }
 
     private void showError(Exception e) {
         Feature f = null;
-        if( e instanceof ExportException ) {
-            f = ((ExportException)e).getFeature();
+        if (e instanceof ExportException) {
+            f = ((ExportException) e).getFeature();
         }
         I18nManager i18nManager = ToolsLocator.getI18nManager();
         MessagePanel.showMessage(
@@ -226,14 +237,14 @@
                 f
         );
     }
-    
+
     @Override
     public void addFinishListener(ExportFinishListener finishListener) {
         this.finishListeners.add(finishListener);
     }
 
     private void fireCancelled() {
-        if( ! SwingUtilities.isEventDispatchThread() ) {
+        if (!SwingUtilities.isEventDispatchThread()) {
             SwingUtilities.invokeLater(new Runnable() {
                 @Override
                 public void run() {
@@ -244,14 +255,14 @@
         for (ExportFinishListener listener : this.finishListeners) {
             try {
                 listener.cancelled(this);
-            } catch(Exception ex) {
-                
+            } catch (Exception ex) {
+
             }
         }
     }
-    
+
     private void fireFinished() {
-        if( ! SwingUtilities.isEventDispatchThread() ) {
+        if (!SwingUtilities.isEventDispatchThread()) {
             SwingUtilities.invokeLater(new Runnable() {
                 @Override
                 public void run() {
@@ -263,38 +274,50 @@
         for (ExportFinishListener listener : this.finishListeners) {
             try {
                 listener.finished(this);
-            } catch(Exception ex) {
-                
+            } catch (Exception ex) {
+
             }
         }
     }
-    
+
     private void doCancel() {
         this.setVisible(false);
         this.fireCancelled();
     }
-    
+
     private void doExport() {
         lastWizard();
+        ExportParameters params = this.process.getParameters();
+        ExportServiceManager ems = ExportLocator.getServiceManager();
+
+        ExportParameters copyParams = null;
+        try {
+            copyParams = (ExportParameters) params.clone();
+            History<ExportParameters> h = ems.getHistory();
+            h.add(copyParams);
+        } catch (CloneNotSupportedException ex) {
+            LOG.error("Not able to create a clone object for export parameters", ex);
+        }
+
         Thread th = new Thread(
-            new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        process.run();
-                        doProcessFinished();
-                    } catch(Exception ex) {
-                        LOG.warn("Can't export",ex);
-                        showError(ex);
-                    }
+                new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    process.run();
+                    doProcessFinished();
+                } catch (Exception ex) {
+                    LOG.warn("Can't export", ex);
+                    showError(ex);
                 }
-            },
-            "exportProcess"
+            }
+        },
+                "exportProcess"
         );
         th.start();
     }
-    
-    private void doProcessFinished() {  
+
+    private void doProcessFinished() {
         fireFinished();
     }
 
@@ -304,7 +327,7 @@
     }
 
     private JButton getButton(int button) {
-        switch(button) {
+        switch (button) {
             case BUTTON_BACK:
                 return this.wizardPanel.getWizardComponents().getBackButton();
             case BUTTON_NEXT:
@@ -314,9 +337,9 @@
             case BUTTON_CANCEL:
                 return this.wizardPanel.getWizardComponents().getCancelButton();
         }
-        throw new IllegalArgumentException("Illegal button value ("+button+").");
+        throw new IllegalArgumentException("Illegal button value (" + button + ").");
     }
-    
+
     @Override
     public void setButtonEnabled(int button, boolean enabled) {
         this.getButton(button).setEnabled(enabled);
@@ -340,7 +363,7 @@
     public void setLastAcction(int action) {
         this.lastAction = action;
     }
-    
+
     public int getLastAction() {
         return this.lastAction;
     }
@@ -354,5 +377,5 @@
     public void previousPanel() {
         this.wizardPanel.doAction(WizardPanelWithLogo.ACTION_PREVIOUS);
     }
-    
+
 }
