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
.eclipse
.core
.runtime
.jobs
.Job
;
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
.common
.IImportConfigurator
.SOURCE_TYPE
;
22 import eu
.etaxonomy
.cdm
.io
.sdd
.in
.SDDImportConfigurator
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * <p>SddImportWizard class.</p>
29 * @created Jun 16, 2010
32 public class SddImportWizard
extends AbstractImportWizard
<SDDImportConfigurator
> {
34 private SDDImportConfigurator configurator
;
36 private ImportFromFileDataSourceWizardPage dataSourcePage
;
39 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
43 public SDDImportConfigurator
getConfigurator() {
49 * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
53 public void addPages() {
56 dataSourcePage
= new ImportFromFileDataSourceWizardPage("Choose File",
57 "Please choose an XML file in the SDD format.", new String
[]{"*.xml", "*.sdd"});
58 addPage(dataSourcePage
);
62 * @see org.eclipse.jface.wizard.Wizard#performFinish()
66 public boolean performFinish() {
67 URI source
= dataSourcePage
.getUri();
68 configurator
.setSource(source
);
69 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
71 if(CdmStore
.getCurrentSessionManager().isRemoting()) {
72 Job job
= CdmStore
.getImportManager().createIOServiceJob(configurator
, new File(source
), SOURCE_TYPE
.URI
);
73 CdmStore
.getImportManager().run(job
);
75 CdmStore
.getImportManager().run(configurator
);
82 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
86 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
87 super.init(workbench
, selection
);
88 configurator
= CdmStore
.getImportManager().SddConfigurator();