ExportManager.java: surrounded statement with try-catch block
[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 boolean performFinish = false;
53 URI urlString;
54 File savePath = new File(page.getFolderText() + File.separator + page.getExportFileName());
55 urlString = savePath.toURI();
56 //orig: urlString = new URI(page.getFolderText() + File.separator + page.getExportFileName());
57 configurator.setDestination(urlString);
58 CdmStore.getExportManager().run(configurator);
59 performFinish = true;
60 return performFinish;
61 }
62
63 /* (non-Javadoc)
64 * @see org.eclipse.jface.wizard.Wizard#addPages()
65 */
66 /** {@inheritDoc} */
67 @Override
68 public void addPages() {
69 super.addPages();
70
71 page = ExportToFileDestinationWizardPage.Jaxb();
72 addPage(page);
73 }
74
75 /* (non-Javadoc)
76 * @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
77 */
78 /** {@inheritDoc} */
79 @Override
80 public JaxbExportConfigurator getConfigurator() {
81 return configurator;
82 }
83
84
85 }