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.e4.out.jaxb;
|
11
|
|
12
|
import java.io.File;
|
13
|
|
14
|
import javax.inject.Inject;
|
15
|
|
16
|
import org.eclipse.core.runtime.jobs.Job;
|
17
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
18
|
import org.eclipse.ui.progress.IProgressConstants;
|
19
|
|
20
|
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
|
21
|
import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
|
22
|
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
|
23
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
24
|
|
25
|
/**
|
26
|
*
|
27
|
* @author pplitzner
|
28
|
* @since Oct 6, 2017
|
29
|
*
|
30
|
*/
|
31
|
public class JaxbExportWizardE4 extends AbstractExportWizardE4<JaxbExportConfigurator> {
|
32
|
|
33
|
private ExportToFileDestinationWizardPage page;
|
34
|
|
35
|
private JaxbExportConfigurator configurator;
|
36
|
|
37
|
@Inject
|
38
|
public JaxbExportWizardE4(IEclipseContext context) {
|
39
|
super(context);
|
40
|
}
|
41
|
|
42
|
/** {@inheritDoc} */
|
43
|
@Override
|
44
|
public void init() {
|
45
|
this.setWindowTitle("JAXB Export");
|
46
|
this.configurator = CdmStore.getExportManager().JaxbConfigurator();
|
47
|
}
|
48
|
|
49
|
/** {@inheritDoc} */
|
50
|
@Override
|
51
|
public boolean performFinish() {
|
52
|
boolean performFinish = false;
|
53
|
|
54
|
File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
|
55
|
|
56
|
configurator.setDestination(exportFile);
|
57
|
|
58
|
// create job
|
59
|
Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
|
60
|
// configure the job
|
61
|
job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
|
62
|
job.setUser(true);
|
63
|
// schedule job
|
64
|
job.schedule();
|
65
|
|
66
|
performFinish = true;
|
67
|
return performFinish;
|
68
|
}
|
69
|
|
70
|
/** {@inheritDoc} */
|
71
|
@Override
|
72
|
public void addPages() {
|
73
|
super.addPages();
|
74
|
|
75
|
page = ExportToFileDestinationWizardPage.Jaxb(configurator);
|
76
|
addPage(page);
|
77
|
}
|
78
|
|
79
|
/** {@inheritDoc} */
|
80
|
@Override
|
81
|
public JaxbExportConfigurator getConfigurator() {
|
82
|
return configurator;
|
83
|
}
|
84
|
|
85
|
|
86
|
}
|