3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.io
.wizard
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
18 import org
.eclipse
.ui
.IWorkbench
;
20 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
21 import eu
.etaxonomy
.cdm
.io
.jaxb
.JaxbImportConfigurator
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class JaxbImportWizard
extends AbstractImportWizard
<JaxbImportConfigurator
> {
30 private static final Logger logger
= Logger
31 .getLogger(JaxbImportWizard
.class);
33 private JaxbImportConfigurator configurator
;
35 private ImportFromFileDataSourceWizardPage dataSourcePage
;
38 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
41 public JaxbImportConfigurator
getConfigurator() {
46 * @see org.eclipse.jface.wizard.Wizard#performFinish()
49 public boolean performFinish() {
51 String platformDependendFile
= dataSourcePage
.getFile();
54 // Imports are expecting a string that can be used to instantiate a URL instance
55 // TODO consolidate import and exports regarding what may be passed in as source
56 // will construct a url string for now
58 File file
= new File(platformDependendFile
);
59 URI fileUri
= file
.toURI();
61 configurator
.setSource(fileUri
.toString());
62 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
64 CdmStore
.getImportHandler().run(configurator
);
70 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
72 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
73 configurator
= CdmStore
.getImportHandler().JaxbConfigurator();
77 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
80 public void addPages() {
83 dataSourcePage
= new ImportFromFileDataSourceWizardPage("Choose File",
84 "Please choose an XML file in the cdm JAXB format.", new String
[]{"*.xml"});
85 addPage(dataSourcePage
);