automated build configuration is on its way
[taxeditor.git] / 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 public void init(IWorkbench workbench, IStructuredSelection selection) {
65 super.init(workbench, selection);
66 configurator = CdmStore.getImportManager().NormalExplicitConfigurator();
67 }
68
69 /* (non-Javadoc)
70 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
71 */
72 /** {@inheritDoc} */
73 @Override
74 public void addPages() {
75 super.addPages();
76
77 dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose NormalExplicit",
78 "Please choose an xls file in the NormalExplicit format.", new String[]{"*.xls"});
79 addPage(dataSourcePage);
80 }
81 }