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
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
15 import org
.eclipse
.ui
.IWorkbench
;
17 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
18 import eu
.etaxonomy
.cdm
.io
.sdd
.in
.SDDImportConfigurator
;
19 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
23 * @created Jun 16, 2010
26 public class SddImportWizard
extends AbstractImportWizard
<SDDImportConfigurator
> {
27 private static final Logger logger
= Logger
28 .getLogger(SddImportWizard
.class);
30 private SDDImportConfigurator configurator
;
32 private ImportFromFileDataSourceWizardPage dataSourcePage
;
35 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
38 public SDDImportConfigurator
getConfigurator() {
44 * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
47 public void addPages() {
50 dataSourcePage
= new ImportFromFileDataSourceWizardPage("Choose File",
51 "Please choose an XML file in the SDD format.", new String
[]{"*.xml", "*.sdd"});
52 addPage(dataSourcePage
);
56 * @see org.eclipse.jface.wizard.Wizard#performFinish()
59 public boolean performFinish() {
60 // TODO this is a quick copy from JAXB import. It might not work at all.
62 String file
= dataSourcePage
.getFile();
64 // Imports are expecting a string that can be used to instantiate a URL instance
65 // TODO consolidate import and exports regarding what may be passed in as source
66 // will construct a url string for now
68 file
= "file://" + file
;
70 configurator
.setSource(file
);
71 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
73 CdmStore
.getImportHandler().run(configurator
);
79 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
81 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
82 configurator
= CdmStore
.getImportHandler().SddConfigurator();