Project

General

Profile

Download (1.9 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.io.wizard;
5

    
6
import org.eclipse.jface.viewers.IStructuredSelection;
7
import org.eclipse.ui.IWorkbench;
8

    
9
import eu.etaxonomy.cdm.common.URI;
10
import eu.etaxonomy.cdm.database.DbSchemaValidation;
11
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
12
import eu.etaxonomy.taxeditor.store.CdmStore;
13

    
14
/**
15
 * @author n.hoffmann
16
 *
17
 */
18
public class SpecimenCdmExcelImportWizard extends AbstractImportWizard<SpecimenCdmExcelImportConfigurator> {
19

    
20
	private SpecimenCdmExcelImportConfigurator configurator;
21

    
22
	private ImportFromFileDataSourceWizardPage dataSourcePage;
23

    
24
	/* (non-Javadoc)
25
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
26
	 */
27
	@Override
28
	public SpecimenCdmExcelImportConfigurator getConfigurator() {
29
		return configurator;
30
	}
31

    
32
	/* (non-Javadoc)
33
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
34
	 */
35
	/** {@inheritDoc} */
36
	@Override
37
    public void init(IWorkbench workbench, IStructuredSelection selection) {
38
		super.init(workbench, selection);
39
		configurator =  CdmStore.getImportManager().SpecimenCdmExcelImportConfigurator();
40
	}
41

    
42
	/* (non-Javadoc)
43
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
44
	 */
45
	@Override
46
	public boolean performFinish() {
47
		URI source = dataSourcePage.getUri();
48
		configurator.setSource(source);
49
		configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
50

    
51
		CdmStore.getImportManager().run(configurator);
52

    
53
		return true;
54
	}
55

    
56
	/* (non-Javadoc)
57
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
58
	 */
59
	/** {@inheritDoc} */
60
	@Override
61
	public void addPages() {
62
		super.addPages();
63

    
64
		dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose Specimen CDM Excel",
65
				"Please choose an xls file in the SpecimenCdmExcel format.", new String[]{"*.xlsx", "*.xls", "*.*"});
66
		addPage(dataSourcePage);
67
	}
68

    
69
}
(28-28/30)