Project

General

Profile

Download (1.69 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
4
 * http://www.e-taxonomy.eu
5
 * 
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9
package eu.etaxonomy.taxeditor.io.wizard;
10

    
11
import org.eclipse.jface.viewers.IStructuredSelection;
12
import org.eclipse.ui.IWorkbench;
13

    
14
import eu.etaxonomy.cdm.common.URI;
15
import eu.etaxonomy.cdm.database.DbSchemaValidation;
16
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
17
import eu.etaxonomy.taxeditor.store.CdmStore;
18

    
19
/**
20
 * @author n.hoffmann
21
 */
22
public class SpecimenCdmExcelImportWizard extends AbstractImportWizard<SpecimenCdmExcelImportConfigurator> {
23

    
24
	private SpecimenCdmExcelImportConfigurator configurator;
25

    
26
	private ImportFromFileDataSourceWizardPage dataSourcePage;
27

    
28
	@Override
29
	public SpecimenCdmExcelImportConfigurator getConfigurator() {
30
		return configurator;
31
	}
32

    
33
	@Override
34
    public void init(IWorkbench workbench, IStructuredSelection selection) {
35
		super.init(workbench, selection);
36
		configurator =  CdmStore.getImportManager().SpecimenCdmExcelImportConfigurator();
37
	}
38

    
39
	@Override
40
	public boolean performFinish() {
41
		URI source = dataSourcePage.getUri();
42
		configurator.setSource(source);
43
		configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
44

    
45
		CdmStore.getImportManager().run(configurator);
46

    
47
		return true;
48
	}
49

    
50
	@Override
51
	public void addPages() {
52
		super.addPages();
53

    
54
		dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose Specimen CDM Excel",
55
				"Please choose an xls file in the SpecimenCdmExcel format.", new String[]{"*.xlsx", "*.xls", "*.*"});
56
		addPage(dataSourcePage);
57
	}
58
}
(28-28/30)