Project

General

Profile

Download (1.78 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 java.io.File;
13

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

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

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

    
32
	private TcsXmlImportConfigurator configurator;
33

    
34
	private ImportFromFileDataSourceWizardPage dataSourcePage;
35

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

    
42
	    Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
43
	    CdmStore.getImportManager().run(job);
44
	   
45
	    return true;
46
	}
47

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

    
54
	@Override
55
	public TcsXmlImportConfigurator getConfigurator() {
56
		return configurator;
57
	}
58

    
59
	@Override
60
	public void addPages() {
61
		super.addPages();
62

    
63
		dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
64
		addPage(dataSourcePage);
65
	}
66
}
(30-30/30)