Merge branch 'release/4.3.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / JaxbExportWizard.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.io.wizard;
12
13 import java.io.File;
14 import java.net.URI;
15
16 import org.eclipse.core.runtime.jobs.Job;
17 import org.eclipse.jface.viewers.IStructuredSelection;
18 import org.eclipse.ui.IWorkbench;
19 import org.eclipse.ui.progress.IProgressConstants;
20
21 import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
22 import eu.etaxonomy.taxeditor.store.CdmStore;
23
24 /**
25 * <p>JaxbExportWizard class.</p>
26 *
27 * @author n.hoffmann
28 * @created 15.06.2009
29 * @version 1.0
30 */
31 public class JaxbExportWizard extends AbstractExportWizard<JaxbExportConfigurator> {
32
33 private ExportToFileDestinationWizardPage page;
34
35 private JaxbExportConfigurator configurator;
36
37 /* (non-Javadoc)
38 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
39 */
40 /** {@inheritDoc} */
41 @Override
42 public void init(IWorkbench workbench, IStructuredSelection selection) {
43 this.setWindowTitle("JAXB Export");
44 this.configurator = CdmStore.getExportManager().JaxbConfigurator();
45 }
46
47 /* (non-Javadoc)
48 * @see org.eclipse.jface.wizard.Wizard#performFinish()
49 */
50 /** {@inheritDoc} */
51 @Override
52 public boolean performFinish() {
53 boolean performFinish = false;
54
55 File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
56 URI urlString = exportFile.toURI();
57 configurator.setDestination(urlString);
58
59 // create job
60 Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
61 // configure the job
62 job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
63 job.setUser(true);
64 // schedule job
65 job.schedule();
66
67 performFinish = true;
68 return performFinish;
69 }
70
71 /* (non-Javadoc)
72 * @see org.eclipse.jface.wizard.Wizard#addPages()
73 */
74 /** {@inheritDoc} */
75 @Override
76 public void addPages() {
77 super.addPages();
78
79 page = ExportToFileDestinationWizardPage.Jaxb();
80 addPage(page);
81 }
82
83 /* (non-Javadoc)
84 * @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
85 */
86 /** {@inheritDoc} */
87 @Override
88 public JaxbExportConfigurator getConfigurator() {
89 return configurator;
90 }
91
92
93 }