merge-update from trunk
[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.jface.viewers.IStructuredSelection;
17 import org.eclipse.ui.IWorkbench;
18
19 import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * <p>JaxbExportWizard class.</p>
24 *
25 * @author n.hoffmann
26 * @created 15.06.2009
27 * @version 1.0
28 */
29 public class JaxbExportWizard extends AbstractExportWizard<JaxbExportConfigurator> {
30
31 private ExportToFileDestinationWizardPage page;
32
33 private JaxbExportConfigurator configurator;
34
35 /* (non-Javadoc)
36 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
37 */
38 /** {@inheritDoc} */
39 public void init(IWorkbench workbench, IStructuredSelection selection) {
40 this.setWindowTitle("JAXB Export");
41 this.configurator = CdmStore.getExportManager().JaxbConfigurator();
42 }
43
44 /* (non-Javadoc)
45 * @see org.eclipse.jface.wizard.Wizard#performFinish()
46 */
47 /** {@inheritDoc} */
48 @Override
49 public boolean performFinish() {
50 boolean performFinish = false;
51 URI urlString;
52 File savePath = new File(page.getFolderText() + File.separator + page.getExportFileName());
53 urlString = savePath.toURI();
54 //orig: urlString = new URI(page.getFolderText() + File.separator + page.getExportFileName());
55 configurator.setDestination(urlString);
56 CdmStore.getExportManager().run(configurator);
57 performFinish = true;
58 return performFinish;
59 }
60
61 /* (non-Javadoc)
62 * @see org.eclipse.jface.wizard.Wizard#addPages()
63 */
64 /** {@inheritDoc} */
65 @Override
66 public void addPages() {
67 super.addPages();
68
69 page = ExportToFileDestinationWizardPage.Jaxb();
70 addPage(page);
71 }
72
73 /* (non-Javadoc)
74 * @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
75 */
76 /** {@inheritDoc} */
77 @Override
78 public JaxbExportConfigurator getConfigurator() {
79 return configurator;
80 }
81
82
83 }