performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / SddImportWizard.java
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.sdd.in.SDDImportConfigurator;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * <p>SddImportWizard class.</p>
24 *
25 * @author n.hoffmann
26 * @created Jun 16, 2010
27 * @version 1.0
28 */
29 public class SddImportWizard extends AbstractImportWizard<SDDImportConfigurator> {
30
31 private SDDImportConfigurator 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 SDDImportConfigurator getConfigurator() {
41 return configurator;
42 }
43
44 /*
45 * (non-Javadoc)
46 * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
47 */
48 /** {@inheritDoc} */
49 @Override
50 public void addPages() {
51 super.addPages();
52
53 dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose File",
54 "Please choose an XML file in the SDD format.", new String[]{"*.xml", "*.sdd"});
55 addPage(dataSourcePage);
56 }
57
58 /* (non-Javadoc)
59 * @see org.eclipse.jface.wizard.Wizard#performFinish()
60 */
61 /** {@inheritDoc} */
62 @Override
63 public boolean performFinish() {
64 URI source = dataSourcePage.getUri();
65 configurator.setSource(source);
66 configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
67
68 CdmStore.getImportHandler().run(configurator);
69
70 return true;
71 }
72
73 /* (non-Javadoc)
74 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
75 */
76 /** {@inheritDoc} */
77 public void init(IWorkbench workbench, IStructuredSelection selection) {
78 configurator = CdmStore.getImportHandler().SddConfigurator();
79 }
80 }