Project

General

Profile

Download (1.6 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 java.net.URI;
12

    
13
import org.eclipse.jface.viewers.IStructuredSelection;
14
import org.eclipse.ui.IWorkbench;
15

    
16
import eu.etaxonomy.cdm.database.DbSchemaValidation;
17
import eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator;
18
import eu.etaxonomy.taxeditor.store.CdmStore;
19

    
20
/**
21
 * <p>JaxbImportWizard class.</p>
22
 *
23
 * @author n.hoffmann
24
 * @created 15.06.2009
25
 */
26
public class JaxbImportWizard extends AbstractImportWizard<JaxbImportConfigurator> {
27

    
28
	private JaxbImportConfigurator configurator;
29
	
30
	private ImportFromFileDataSourceWizardPage dataSourcePage;
31
	
32
	@Override
33
	public JaxbImportConfigurator getConfigurator() {
34
		return configurator;
35
	}
36

    
37
	@Override
38
	public boolean performFinish() {
39
		URI source = dataSourcePage.getUri();
40
		configurator.setSource(source);
41
		configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
42
		
43
		CdmStore.getImportManager().run(configurator);
44
		
45
		return true;
46
	}
47

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

    
53
	@Override
54
	public void addPages() {
55
		super.addPages();
56
		
57
		dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose File", 
58
				"Please choose an XML file in the cdm JAXB format.", new String[]{"*.xml"});
59
		addPage(dataSourcePage);
60
	}
61
}
(23-23/30)