fec238815d0f770d2353a1c274d0a9bdeb0be151
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / ExcelNormalExplicitTaxaImportWizard.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.io.wizard;
12
13 import java.net.URI;
14
15 import org.eclipse.jface.viewers.IStructuredSelection;
16 import org.eclipse.ui.IWorkbench;
17
18 import eu.etaxonomy.cdm.database.DbSchemaValidation;
19 import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22
23 /**
24 * <p>ExcelNormalExplicitTaxaImportWizard class.</p>
25 *
26 * @author n.hoffmann
27 * @created Sep 22, 2009
28 * @version 1.0
29 */
30 public class ExcelNormalExplicitTaxaImportWizard extends AbstractImportWizard<NormalExplicitImportConfigurator>{
31
32 private NormalExplicitImportConfigurator configurator;
33
34 private ImportFromFileDataSourceWizardPage dataSourcePage;
35
36 /* (non-Javadoc)
37 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
38 */
39 /** {@inheritDoc} */
40 @Override
41 public NormalExplicitImportConfigurator getConfigurator() {
42 return configurator;
43 }
44
45 /* (non-Javadoc)
46 * @see org.eclipse.jface.wizard.Wizard#performFinish()
47 */
48 /** {@inheritDoc} */
49 @Override
50 public boolean performFinish() {
51 URI source = dataSourcePage.getUri();
52 configurator.setSource(source);
53 configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
54
55 CdmStore.getImportManager().run(configurator);
56
57 return true;
58 }
59
60 /* (non-Javadoc)
61 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
62 */
63 /** {@inheritDoc} */
64 @Override
65 public void init(IWorkbench workbench, IStructuredSelection selection) {
66 super.init(workbench, selection);
67 configurator = CdmStore.getImportManager().NormalExplicitConfigurator();
68 }
69
70 /* (non-Javadoc)
71 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
72 */
73 /** {@inheritDoc} */
74 @Override
75 public void addPages() {
76 super.addPages();
77
78 dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose NormalExplicit",
79 "Please choose an xls file in the NormalExplicit format.", new String[]{"*.xls" ,"*.xlsx", "*.*"});
80 addPage(dataSourcePage);
81 }
82 }