Project

General

Profile

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

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

    
13
import java.net.URI;
14

    
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.ui.IWorkbench;
17

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

    
22
/**
23
 * <p>JaxbImportWizard class.</p>
24
 *
25
 * @author n.hoffmann
26
 * @created 15.06.2009
27
 * @version 1.0
28
 */
29
public class JaxbImportWizard extends AbstractImportWizard<JaxbImportConfigurator> {
30

    
31
	private JaxbImportConfigurator configurator;
32
	
33
	private ImportFromFileDataSourceWizardPage dataSourcePage;
34
	
35
	/* (non-Javadoc)
36
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
37
	 */
38
	/** {@inheritDoc} */
39
	@Override
40
	public JaxbImportConfigurator getConfigurator() {
41
		return configurator;
42
	}
43

    
44
	/* (non-Javadoc)
45
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
46
	 */
47
	/** {@inheritDoc} */
48
	@Override
49
	public boolean performFinish() {
50
		URI source = dataSourcePage.getUri();
51
		configurator.setSource(source);
52
		configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
53
		
54
		CdmStore.getImportManager().run(configurator);
55
		
56
		return true;
57
	}
58

    
59
	/* (non-Javadoc)
60
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
61
	 */
62
	/** {@inheritDoc} */
63
	public void init(IWorkbench workbench, IStructuredSelection selection) {
64
		super.init(workbench, selection);
65
		configurator =  CdmStore.getImportManager().JaxbConfigurator();
66
	}
67

    
68
	/* (non-Javadoc)
69
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#addPages()
70
	 */
71
	/** {@inheritDoc} */
72
	@Override
73
	public void addPages() {
74
		super.addPages();
75
		
76
		dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose File", 
77
				"Please choose an XML file in the cdm JAXB format.", new String[]{"*.xml"});
78
		addPage(dataSourcePage);
79
	}
80
}
(19-19/25)