Project

General

Profile

Download (1.76 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

    
10
package eu.etaxonomy.taxeditor.io.wizard;
11

    
12
import org.eclipse.core.runtime.jobs.Job;
13
import org.eclipse.jface.viewers.IStructuredSelection;
14
import org.eclipse.ui.IWorkbench;
15

    
16
import eu.etaxonomy.cdm.common.URI;
17
import eu.etaxonomy.cdm.database.DbSchemaValidation;
18
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
19
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
21

    
22
/**
23
 * <p>TcsImportWizard class.</p>
24
 *
25
 * @author n.hoffmann
26
 * @created 15.06.2009
27
 */
28
public class TcsImportWizard extends AbstractImportWizard<TcsXmlImportConfigurator> {
29

    
30
	private TcsXmlImportConfigurator configurator;
31

    
32
	private ImportFromFileDataSourceWizardPage dataSourcePage;
33

    
34
	@Override
35
	public boolean performFinish() {
36
	    URI source = dataSourcePage.getUri();
37
	    configurator.setSource(source);
38
	    configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
39

    
40
	    Job job = CdmStore.getImportManager().createIOServiceJob(configurator, source.toFile(), SOURCE_TYPE.URI);
41
	    CdmStore.getImportManager().run(job);
42
	   
43
	    return true;
44
	}
45

    
46
	@Override
47
    public void init(IWorkbench workbench, IStructuredSelection selection) {
48
		super.init(workbench, selection);
49
		configurator = CdmStore.getImportManager().TcsConfigurator();
50
	}
51

    
52
	@Override
53
	public TcsXmlImportConfigurator getConfigurator() {
54
		return configurator;
55
	}
56

    
57
	@Override
58
	public void addPages() {
59
		super.addPages();
60

    
61
		dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
62
		addPage(dataSourcePage);
63
	}
64
}
(30-30/30)