2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.io
.wizard
;
15 import org
.eclipse
.core
.runtime
.jobs
.Job
;
16 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
17 import org
.eclipse
.ui
.IWorkbench
;
19 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
20 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
.SOURCE_TYPE
;
21 import eu
.etaxonomy
.cdm
.io
.sdd
.in
.SDDImportConfigurator
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 * <p>SddImportWizard class.</p>
28 * @created Jun 16, 2010
31 public class SddImportWizard
extends AbstractImportWizard
<SDDImportConfigurator
> {
33 private SDDImportConfigurator configurator
;
35 private ImportFromFileDataSourceWizardPage dataSourcePage
;
38 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
42 public SDDImportConfigurator
getConfigurator() {
48 * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
52 public void addPages() {
55 dataSourcePage
= new ImportFromFileDataSourceWizardPage("Choose File",
56 "Please choose an XML file in the SDD format.", new String
[]{"*.xml", "*.sdd"});
57 addPage(dataSourcePage
);
61 * @see org.eclipse.jface.wizard.Wizard#performFinish()
65 public boolean performFinish() {
66 URI source
= dataSourcePage
.getUri();
67 configurator
.setSource(source
);
68 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
69 Job job
= CdmStore
.getImportManager().createIOServiceJob(configurator
, new File(source
), SOURCE_TYPE
.URI
);
70 CdmStore
.getImportManager().run(job
);
76 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
80 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
81 super.init(workbench
, selection
);
82 configurator
= CdmStore
.getImportManager().SddConfigurator();