Merge branch 'release/5.19.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / JaxbExportWizard.java
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 package eu.etaxonomy.taxeditor.io.wizard;
10
11 import java.io.File;
12
13 import org.eclipse.core.runtime.jobs.Job;
14 import org.eclipse.jface.viewers.IStructuredSelection;
15 import org.eclipse.ui.IWorkbench;
16 import org.eclipse.ui.progress.IProgressConstants;
17
18 import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
19 import eu.etaxonomy.taxeditor.store.CdmStore;
20
21 /**
22 * <p>JaxbExportWizard class.</p>
23 *
24 * @author n.hoffmann
25 * @created 15.06.2009
26 */
27 public class JaxbExportWizard extends AbstractExportWizard<JaxbExportConfigurator> {
28
29 private ExportToFileDestinationWizardPage page;
30
31 private JaxbExportConfigurator configurator;
32
33 @Override
34 public void init(IWorkbench workbench, IStructuredSelection selection) {
35 this.setWindowTitle("JAXB Export");
36 this.configurator = CdmStore.getExportManager().JaxbConfigurator();
37 }
38
39 @Override
40 public boolean performFinish() {
41 boolean performFinish = false;
42
43 File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
44
45 configurator.setDestination(exportFile);
46
47 // create job
48 Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
49 // configure the job
50 job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
51 job.setUser(true);
52 // schedule job
53 job.schedule();
54
55 performFinish = true;
56 return performFinish;
57 }
58
59 @Override
60 public void addPages() {
61 super.addPages();
62
63 page = ExportToFileDestinationWizardPage.Jaxb(configurator);
64 addPage(page);
65 }
66
67 @Override
68 public JaxbExportConfigurator getConfigurator() {
69 return configurator;
70 }
71 }