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
;
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
.tcsxml
.in
.TcsXmlImportConfigurator
;
19 import eu
.etaxonomy
.taxeditor
.datasource
.wizard
.CdmDataSourceSQLServerWizardPage
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
27 public class TcsImportWizard
extends AbstractImportWizard
<TcsXmlImportConfigurator
>{
28 private static final Logger logger
= Logger
.getLogger(TcsImportWizard
.class);
30 private TcsXmlImportConfigurator configurator
;
32 private ImportFromFileDataSourceWizardPage dataSourcePage
;
35 * @see org.eclipse.jface.wizard.Wizard#performFinish()
38 public boolean performFinish() {
40 String file
= dataSourcePage
.getFile();
42 // TcsXmlImport expects a string that can be used to instantiate a URL instance
43 // TODO consolidate import and exports regarding what may be passed in as source
44 // will construct a url string for now
46 file
= "file://" + file
;
48 CdmStore
.NewTransactionalConversation();
50 configurator
.setSource(file
);
51 configurator
.setDbSchemaValidation(DbSchemaValidation
.CREATE
);
52 configurator
.setCdmAppController(CdmStore
.getApplicationController());
54 return doImportInternal(configurator
);
58 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
60 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
61 configurator
= TcsXmlImportConfigurator
.NewInstance(null, null);
65 * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#getConfigurator()
68 public TcsXmlImportConfigurator
getConfigurator() {
73 * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#addPages()
76 public void addPages() {
79 dataSourcePage
= new ImportFromFileDataSourceWizardPage();
80 addPage(dataSourcePage
);