3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.io
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
18 import org
.eclipse
.core
.runtime
.Status
;
19 import org
.eclipse
.core
.runtime
.jobs
.Job
;
20 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
21 import org
.eclipse
.jface
.wizard
.Wizard
;
22 import org
.eclipse
.ui
.IExportWizard
;
23 import org
.eclipse
.ui
.IWorkbench
;
25 import eu
.etaxonomy
.cdm
.io
.common
.CdmDefaultExport
;
26 import eu
.etaxonomy
.cdm
.io
.common
.ICdmExporter
;
27 import eu
.etaxonomy
.cdm
.io
.jaxb
.JaxbExportConfigurator
;
28 import eu
.etaxonomy
.taxeditor
.datasource
.CdmDataSourceRepository
;
29 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
36 public class JaxbExportWizard
extends Wizard
implements IExportWizard
{
37 private static final Logger logger
= Logger
38 .getLogger(JaxbExportWizard
.class);
40 public final String JAXB_EXPORT
= "JAXB_EXPORT";
42 private ICdmExporter export
;
44 private JaxbExportWizardPage page
;
46 private JaxbExportConfigurator exportConfigurator
;
49 * @see org.eclipse.jface.wizard.Wizard#performFinish()
52 public boolean performFinish() {
54 export
= new CdmDefaultExport();
56 String url
= page
.getFolderText() + File
.pathSeparator
+ page
.getExportFileName();
58 exportConfigurator
= JaxbExportConfigurator
.NewInstance(CdmDataSourceRepository
.getDefault().getCurrentDataSource(), url
);
59 exportConfigurator
.setCdmAppController(CdmStore
.getApplicationController());
62 Job exportJob
= new Job("JAXB Export"){
64 protected IStatus
run(IProgressMonitor monitor
) {
65 return export
.invoke(exportConfigurator
) ? Status
.OK_STATUS
: Status
.CANCEL_STATUS
;
75 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
77 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
81 * @see org.eclipse.jface.wizard.Wizard#addPages()
84 public void addPages() {
87 page
= new JaxbExportWizardPage(JAXB_EXPORT
);