commit 38a5ce3ea8a6eed44ade21161f92d3d8021624c2
Author: Katja Luther <k.luther@bgbm.org>
Date:   Tue Feb 13 12:12:53 2018 +0100

    call exports with progress monitor

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
index 8944aac68..372e7d50e 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
@@ -25,13 +25,12 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
 import org.apache.log4j.Logger;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
 
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.application.ICdmRepository;
@@ -185,7 +184,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
 				return Status.OK_STATUS;
 			}
 
-			
+
 		};
 
 		return job;
@@ -347,7 +346,11 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                  monitor.beginTask("Exporting database. This will take some time.", IProgressMonitor.UNKNOWN);
                  try {
                      IIOService ioService = CdmApplicationState.getIOService();
-
+                     monitor.beginTask(
+                             "Exporting database. This will take some time.", 100);
+                     monitor.worked(10);
+                     configurator.setProgressMonitor(CdmProgressMonitorAdapter
+                             .CreateSubMonitor(monitor, 80));
                      ExportResult result = ioService.export(configurator);
                      ExportDataWrapper data = result.getExportData();
                      try{
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java
index 69200b69f..f25e2f60c 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java
@@ -16,14 +16,12 @@ import java.util.UUID;
 import javax.inject.Inject;
 import javax.inject.Named;
 
-import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.e4.core.contexts.IEclipseContext;
 import org.eclipse.e4.core.di.annotations.Optional;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.widgets.Combo;
-import org.eclipse.ui.progress.IProgressConstants;
 
 import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
 import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
@@ -102,14 +100,14 @@ AbstractExportWizardE4<CdmLightExportConfigurator> {
             }
         }
         configurator.getTaxonNodeFilter().setIncludeUnpublished(page.isExportUnpublishedData());
-
+        CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
         // create job
-        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
-        // configure the job
-        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
-        job.setUser(true);
-        // schedule job
-        job.schedule();
+//        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
+//        // configure the job
+//        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+//        job.setUser(true);
+//        // schedule job
+//        job.schedule();
         PreferencesUtil.getPreferenceStore().setValue("exportFolder", page.getFolderText());
         return true;
     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java
index be8bbe9dd..e78a939c4 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java
@@ -8,6 +8,7 @@ import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.e4.core.contexts.IEclipseContext;
 import org.eclipse.ui.progress.IProgressConstants;
 
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
 import eu.etaxonomy.cdm.io.common.ExportResultType;
 import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
 import eu.etaxonomy.taxeditor.io.e4.out.csv.name.CsvNameExportWizardE4;
@@ -25,6 +26,7 @@ public class CsvPrintExportWizardE4 extends CsvNameExportWizardE4{
 	public void init() {
 		configurator = CsvNameExportConfigurator.NewInstance(null,null);
 		configurator.setNamesOnly(false);
+		configurator.setCondensedDistribution(true);
 	}
 
 	@Override
@@ -49,7 +51,8 @@ public class CsvPrintExportWizardE4 extends CsvNameExportWizardE4{
 		String urlString = page.getFolderText() + File.separator
 				+ page.getExportFileName();
 
-	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
+//	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
+	    configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(page.getSelectedClassificationUUID()));
 	    configurator.setResultType(ExportResultType.BYTE_ARRAY);
 		// create job
 	    Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
index c8e360f9e..2a1474cb7 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
@@ -17,11 +17,15 @@ import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -31,7 +35,7 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
  * @author pplitzner
  *
  */
-public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
+public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard implements SelectionListener {
 
 	public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
 
@@ -41,6 +45,8 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
 
 	private boolean isPreferencePage = false;
 
+    private Combo nomenclaturalCodeSelectionCombo;
+
 	protected AbcdImportConfiguratorWizardPage(String title, String description, Abcd206ImportConfigurator configurator) {
         super(PAGE_NAME);
         this.configurator = configurator;
@@ -230,10 +236,30 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
             }
         });
 
+        GridData gridData = new GridData();
+        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
+        gridData.horizontalIndent = 5;
+//      classificationSelection.setLayoutData(gridData);
+
+        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
+        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
+        for(NomenclaturalCode code: NomenclaturalCode.values()){
+            nomenclaturalCodeSelectionCombo.add(code.getKey());
+        }
+
 
+
+        // TODO remember last selection
+        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
 		setControl(composite);
 	}
 
+	@Override
+    public void widgetSelected(SelectionEvent e) {
+        this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
+
+    }
+
 	 public void saveConfigToPrefernceStore() {
 	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
 	                configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
@@ -267,6 +293,10 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
                     configurator.isReuseExistingMetaData());
 	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
                     configurator.isReuseExistingTaxaWhenPossible());
+	        if ( configurator.getNomenclaturalCode() != null){
+	            PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE, configurator.getNomenclaturalCode().getKey());
+	        }
+
 
 	    }
 
@@ -278,4 +308,13 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
 	 protected IPreferenceStore doGetPreferenceStore() {
 	        return PreferencesUtil.getPreferenceStore();
 	    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+     */
+    @Override
+    public void widgetDefaultSelected(SelectionEvent e) {
+        // TODO Auto-generated method stub
+
+    }
 }
