eada1477bbf3f1db1fe801a6323c8639bded663a
[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 import java.net.URISyntaxException;
16
17 import org.eclipse.jface.viewers.IStructuredSelection;
18 import org.eclipse.ui.IWorkbench;
19
20 import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
21 import eu.etaxonomy.taxeditor.store.CdmStore;
22 import eu.etaxonomy.taxeditor.store.StoreUtil;
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 public void init(IWorkbench workbench, IStructuredSelection selection) {
42 this.setWindowTitle("JAXB Export");
43 this.configurator = CdmStore.getExportManager().JaxbConfigurator();
44 }
45
46 /* (non-Javadoc)
47 * @see org.eclipse.jface.wizard.Wizard#performFinish()
48 */
49 /** {@inheritDoc} */
50 @Override
51 public boolean performFinish() {
52 try {
53 URI urlString = new URI(page.getFolderText() + File.separator + page.getExportFileName());
54 configurator.setDestination(urlString);
55 CdmStore.getExportManager().run(configurator);
56 return true;
57 } catch (URISyntaxException e) {
58 StoreUtil.error(getClass(), "Could not run JAXB export", e);
59 }
60
61 return false;
62
63 }
64
65 /* (non-Javadoc)
66 * @see org.eclipse.jface.wizard.Wizard#addPages()
67 */
68 /** {@inheritDoc} */
69 @Override
70 public void addPages() {
71 super.addPages();
72
73 page = ExportToFileDestinationWizardPage.Jaxb();
74 addPage(page);
75 }
76
77 /* (non-Javadoc)
78 * @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
79 */
80 /** {@inheritDoc} */
81 @Override
82 public JaxbExportConfigurator getConfigurator() {
83 return configurator;
84 }
85
86
87 }