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
.ICdmExport
;
27 import eu
.etaxonomy
.cdm
.io
.jaxb
.JaxbExportConfigurator
;
28 import eu
.etaxonomy
.taxeditor
.datasource
.CdmDataSourceRepository
;
35 public class JaxbExportWizard
extends Wizard
implements IExportWizard
{
36 private static final Logger logger
= Logger
37 .getLogger(JaxbExportWizard
.class);
39 public final String JAXB_EXPORT
= "JAXB_EXPORT";
41 private ICdmExport
<JaxbExportConfigurator
> export
;
43 private JaxbExportWizardPage page
;
45 private JaxbExportConfigurator exportConfigurator
;
48 * @see org.eclipse.jface.wizard.Wizard#performFinish()
51 public boolean performFinish() {
53 export
= new CdmDefaultExport
<JaxbExportConfigurator
>();
55 String url
= page
.getFolderText() + File
.pathSeparator
+ page
.getExportFileName();
57 exportConfigurator
= JaxbExportConfigurator
.NewInstance(CdmDataSourceRepository
.getDefault().getCurrentDataSource(), url
);
60 Job exportJob
= new Job("JAXB Export"){
62 protected IStatus
run(IProgressMonitor monitor
) {
63 return export
.invoke(exportConfigurator
) ? Status
.OK_STATUS
: Status
.CANCEL_STATUS
;
73 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
75 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
79 * @see org.eclipse.jface.wizard.Wizard#addPages()
82 public void addPages() {
85 page
= new JaxbExportWizardPage(JAXB_EXPORT
);