Project

General

Profile

Download (2.16 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

    
10
package eu.etaxonomy.taxeditor.io.wizard;
11

    
12
import java.io.File;
13

    
14
import org.eclipse.core.runtime.jobs.Job;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.ui.IWorkbench;
17
import org.eclipse.ui.progress.IProgressConstants;
18

    
19
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created May 2, 2011
25
 * @version 1.0
26
 */
27
public class DarwinCoreArchiveExportWizard extends
28
		AbstractExportWizard<DwcaTaxExportConfigurator> {
29

    
30
	private DwcaTaxExportConfigurator configurator;
31
	private ExportToFileDestinationWizardPage page;
32

    
33
	/*
34
	 * (non-Javadoc)
35
	 *
36
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
37
	 * org.eclipse.jface.viewers.IStructuredSelection)
38
	 */
39
	@Override
40
	public void init(IWorkbench workbench, IStructuredSelection selection) {
41
		configurator = DwcaTaxExportConfigurator.NewInstance(null, null, null);
42
	}
43

    
44
	/*
45
	 * (non-Javadoc)
46
	 *
47
	 * @see
48
	 * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
49
	 */
50
	@Override
51
	public DwcaTaxExportConfigurator getConfigurator() {
52
		return configurator;
53
	}
54

    
55
	/*
56
	 * (non-Javadoc)
57
	 *
58
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
59
	 */
60
	@Override
61
	public boolean performFinish() {
62
		String urlString = page.getFolderText() + File.separator
63
				+ page.getExportFileName();
64

    
65
		configurator.setDestination(new File(urlString));
66

    
67
		Job exportJob = CdmStore.getExportManager().createIOServiceJob(configurator, configurator.getDestination());
68
		exportJob.setProperty(IProgressConstants.KEEP_PROPERTY, true);
69
		exportJob.setUser(true);
70
        // schedule job
71
		exportJob.schedule();
72

    
73
		return true;
74
	}
75

    
76
	/*
77
	 * (non-Javadoc)
78
	 *
79
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
80
	 */
81
	@Override
82
	public void addPages() {
83
		super.addPages();
84

    
85
		page = ExportToFileDestinationWizardPage.Dwca();
86
		addPage(page);
87
	}
88
}
(12-12/29)