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
.tcsxml
.in
.TcsXmlImportConfigurator
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class TcsImportWizard
extends AbstractImportWizard
<TcsXmlImportConfigurator
>{
30 private static final Logger logger
= Logger
.getLogger(TcsImportWizard
.class);
32 private TcsXmlImportConfigurator configurator
;
34 private ImportFromFileDataSourceWizardPage dataSourcePage
;
37 * @see org.eclipse.jface.wizard.Wizard#performFinish()
40 public boolean performFinish() {
42 String platformDependendFile
= dataSourcePage
.getFile();
45 // TcsXmlImport expects a string that can be used to instantiate a URL instance
46 // TODO consolidate import and exports regarding what may be passed in as source
47 // will construct a url string for now
49 File file
= new File(platformDependendFile
);
50 URI fileUri
= file
.toURI();
52 configurator
.setSource(fileUri
.toString());
53 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
55 CdmStore
.getImportHandler().run(configurator
);
61 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
63 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
64 configurator
= CdmStore
.getImportHandler().TcsConfigurator();
68 * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#getConfigurator()
71 public TcsXmlImportConfigurator
getConfigurator() {
76 * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#addPages()
79 public void addPages() {
82 dataSourcePage
= ImportFromFileDataSourceWizardPage
.XML();
83 addPage(dataSourcePage
);