Project

General

Profile

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

    
6
import java.net.URI;
7

    
8
import org.eclipse.jface.viewers.IStructuredSelection;
9
import org.eclipse.ui.IWorkbench;
10

    
11
import eu.etaxonomy.cdm.database.DbSchemaValidation;
12
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
13
import eu.etaxonomy.taxeditor.store.CdmStore;
14

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

    
21
	private SpecimenCdmExcelImportConfigurator configurator;
22

    
23
	private ImportFromFileDataSourceWizardPage dataSourcePage;
24

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

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

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

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

    
54
		return true;
55
	}
56

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

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

    
70
}
(28-28/30)