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 javax.naming.OperationNotSupportedException;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
19
|
import org.eclipse.ui.IWorkbench;
|
20
|
|
21
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
22
|
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
|
23
|
import eu.etaxonomy.taxeditor.singlesource.io.wizard.ImportFromFileDataSourceWizardPageFacade;
|
24
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
25
|
|
26
|
|
27
|
/**
|
28
|
* <p>ExcelNormalExplicitTaxaImportWizard class.</p>
|
29
|
*
|
30
|
* @author n.hoffmann
|
31
|
* @created Sep 22, 2009
|
32
|
* @version 1.0
|
33
|
*/
|
34
|
public class ExcelNormalExplicitTaxaImportWizard extends AbstractImportWizard<NormalExplicitImportConfigurator>{
|
35
|
private static final Logger logger = Logger.getLogger(ExcelNormalExplicitTaxaImportWizard.class);
|
36
|
|
37
|
private NormalExplicitImportConfigurator configurator;
|
38
|
|
39
|
private ImportFromFileDataSourceWizardPageFacade dataSourcePage;
|
40
|
|
41
|
/* (non-Javadoc)
|
42
|
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
|
43
|
*/
|
44
|
/** {@inheritDoc} */
|
45
|
@Override
|
46
|
public NormalExplicitImportConfigurator getConfigurator() {
|
47
|
return configurator;
|
48
|
}
|
49
|
|
50
|
/* (non-Javadoc)
|
51
|
* @see org.eclipse.jface.wizard.Wizard#performFinish()
|
52
|
*/
|
53
|
/** {@inheritDoc} */
|
54
|
@Override
|
55
|
public boolean performFinish() {
|
56
|
URI source = dataSourcePage.getUri();
|
57
|
configurator.setSource(source);
|
58
|
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
|
59
|
|
60
|
CdmStore.getImportManager().run(configurator);
|
61
|
|
62
|
return true;
|
63
|
}
|
64
|
|
65
|
/* (non-Javadoc)
|
66
|
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
|
67
|
*/
|
68
|
/** {@inheritDoc} */
|
69
|
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
70
|
super.init(workbench, selection);
|
71
|
configurator = CdmStore.getImportManager().NormalExplicitConfigurator();
|
72
|
}
|
73
|
|
74
|
/* (non-Javadoc)
|
75
|
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
|
76
|
*/
|
77
|
/** {@inheritDoc} */
|
78
|
@Override
|
79
|
public void addPages() {
|
80
|
super.addPages();
|
81
|
|
82
|
dataSourcePage = ImportFromFileDataSourceWizardPageFacade.getInstance("Choose NormalExplicit",
|
83
|
"Please choose an xls file in the NormalExplicit format.", new String[]{"*.xls"});
|
84
|
|
85
|
addPage(dataSourcePage);
|
86
|
}
|
87
|
}
|