Project

General

Profile

Revision 38a5ce3e

ID38a5ce3ea8a6eed44ade21161f92d3d8021624c2
Parent b5920c8b
Child 12cf452e, 1028d180

Added by Katja Luther over 2 years ago

call exports with progress monitor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
25 25
import java.util.zip.ZipOutputStream;
26 26

  
27 27
import org.apache.log4j.Logger;
28
import org.eclipse.core.runtime.IStatus;
29
import org.eclipse.core.runtime.jobs.Job;
30
import org.eclipse.swt.widgets.Display;
31 28
import org.eclipse.core.runtime.Assert;
32 29
import org.eclipse.core.runtime.IProgressMonitor;
30
import org.eclipse.core.runtime.IStatus;
33 31
import org.eclipse.core.runtime.Status;
34

  
32
import org.eclipse.core.runtime.jobs.Job;
33
import org.eclipse.swt.widgets.Display;
35 34

  
36 35
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
37 36
import eu.etaxonomy.cdm.api.application.ICdmRepository;
......
185 184
				return Status.OK_STATUS;
186 185
			}
187 186

  
188
			
187

  
189 188
		};
190 189

  
191 190
		return job;
......
347 346
                 monitor.beginTask("Exporting database. This will take some time.", IProgressMonitor.UNKNOWN);
348 347
                 try {
349 348
                     IIOService ioService = CdmApplicationState.getIOService();
350

  
349
                     monitor.beginTask(
350
                             "Exporting database. This will take some time.", 100);
351
                     monitor.worked(10);
352
                     configurator.setProgressMonitor(CdmProgressMonitorAdapter
353
                             .CreateSubMonitor(monitor, 80));
351 354
                     ExportResult result = ioService.export(configurator);
352 355
                     ExportDataWrapper data = result.getExportData();
353 356
                     try{
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java
16 16
import javax.inject.Inject;
17 17
import javax.inject.Named;
18 18

  
19
import org.eclipse.core.runtime.jobs.Job;
20 19
import org.eclipse.e4.core.contexts.IEclipseContext;
21 20
import org.eclipse.e4.core.di.annotations.Optional;
22 21
import org.eclipse.e4.ui.services.IServiceConstants;
23 22
import org.eclipse.jface.viewers.IStructuredSelection;
24 23
import org.eclipse.jface.viewers.TreeSelection;
25 24
import org.eclipse.swt.widgets.Combo;
26
import org.eclipse.ui.progress.IProgressConstants;
27 25

  
28 26
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
29 27
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
......
102 100
            }
103 101
        }
104 102
        configurator.getTaxonNodeFilter().setIncludeUnpublished(page.isExportUnpublishedData());
105

  
103
        CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
106 104
        // create job
107
        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
108
        // configure the job
109
        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
110
        job.setUser(true);
111
        // schedule job
112
        job.schedule();
105
//        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
106
//        // configure the job
107
//        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
108
//        job.setUser(true);
109
//        // schedule job
110
//        job.schedule();
113 111
        PreferencesUtil.getPreferenceStore().setValue("exportFolder", page.getFolderText());
114 112
        return true;
115 113
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java
8 8
import org.eclipse.e4.core.contexts.IEclipseContext;
9 9
import org.eclipse.ui.progress.IProgressConstants;
10 10

  
11
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
11 12
import eu.etaxonomy.cdm.io.common.ExportResultType;
12 13
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
13 14
import eu.etaxonomy.taxeditor.io.e4.out.csv.name.CsvNameExportWizardE4;
......
25 26
	public void init() {
26 27
		configurator = CsvNameExportConfigurator.NewInstance(null,null);
27 28
		configurator.setNamesOnly(false);
29
		configurator.setCondensedDistribution(true);
28 30
	}
29 31

  
30 32
	@Override
......
49 51
		String urlString = page.getFolderText() + File.separator
50 52
				+ page.getExportFileName();
51 53

  
52
	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
54
//	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
55
	    configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(page.getSelectedClassificationUUID()));
53 56
	    configurator.setResultType(ExportResultType.BYTE_ARRAY);
54 57
		// create job
55 58
	    Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
17 17
import org.eclipse.swt.SWT;
18 18
import org.eclipse.swt.events.SelectionAdapter;
19 19
import org.eclipse.swt.events.SelectionEvent;
20
import org.eclipse.swt.events.SelectionListener;
21
import org.eclipse.swt.layout.GridData;
20 22
import org.eclipse.swt.layout.GridLayout;
21 23
import org.eclipse.swt.widgets.Button;
24
import org.eclipse.swt.widgets.Combo;
22 25
import org.eclipse.swt.widgets.Composite;
23 26

  
24 27
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
25 29
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard;
26 30
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
27 31
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
......
31 35
 * @author pplitzner
32 36
 *
33 37
 */
34
public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
38
public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard implements SelectionListener {
35 39

  
36 40
	public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
37 41

  
......
41 45

  
42 46
	private boolean isPreferencePage = false;
43 47

  
48
    private Combo nomenclaturalCodeSelectionCombo;
49

  
44 50
	protected AbcdImportConfiguratorWizardPage(String title, String description, Abcd206ImportConfigurator configurator) {
45 51
        super(PAGE_NAME);
46 52
        this.configurator = configurator;
......
230 236
            }
231 237
        });
232 238

  
239
        GridData gridData = new GridData();
240
        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
241
        gridData.horizontalIndent = 5;
242
//      classificationSelection.setLayoutData(gridData);
243

  
244
        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
245
        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
246
        for(NomenclaturalCode code: NomenclaturalCode.values()){
247
            nomenclaturalCodeSelectionCombo.add(code.getKey());
248
        }
249

  
233 250

  
251

  
252
        // TODO remember last selection
253
        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
234 254
		setControl(composite);
235 255
	}
236 256

  
257
	@Override
258
    public void widgetSelected(SelectionEvent e) {
259
        this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
260

  
261
    }
262

  
237 263
	 public void saveConfigToPrefernceStore() {
238 264
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
239 265
	                configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
......
267 293
                    configurator.isReuseExistingMetaData());
268 294
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
269 295
                    configurator.isReuseExistingTaxaWhenPossible());
296
	        if ( configurator.getNomenclaturalCode() != null){
297
	            PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE, configurator.getNomenclaturalCode().getKey());
298
	        }
299

  
270 300

  
271 301
	    }
272 302

  
......
278 308
	 protected IPreferenceStore doGetPreferenceStore() {
279 309
	        return PreferencesUtil.getPreferenceStore();
280 310
	    }
311

  
312
    /* (non-Javadoc)
313
     * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
314
     */
315
    @Override
316
    public void widgetDefaultSelected(SelectionEvent e) {
317
        // TODO Auto-generated method stub
318

  
319
    }
281 320
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)