Project

General

Profile

Download (2.35 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

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

    
12
import java.io.File;
13
import java.net.URI;
14

    
15
import org.eclipse.core.runtime.jobs.Job;
16
import org.eclipse.jface.viewers.IStructuredSelection;
17
import org.eclipse.ui.IWorkbench;
18
import org.eclipse.ui.progress.IProgressConstants;
19

    
20
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * <p>JaxbExportWizard class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created 15.06.2009
28
 * @version 1.0
29
 */
30
public class JaxbExportWizard extends AbstractExportWizard<JaxbExportConfigurator> {
31

    
32
	private ExportToFileDestinationWizardPage page;
33

    
34
	private JaxbExportConfigurator configurator;
35

    
36
	/* (non-Javadoc)
37
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
38
	 */
39
	/** {@inheritDoc} */
40
	@Override
41
    public void init(IWorkbench workbench, IStructuredSelection selection) {
42
		this.setWindowTitle("JAXB Export");
43
		this.configurator = CdmStore.getExportManager().JaxbConfigurator();
44
	}
45

    
46
	/* (non-Javadoc)
47
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
48
	 */
49
	/** {@inheritDoc} */
50
	@Override
51
	public boolean performFinish() {
52
		boolean performFinish = false;
53

    
54
		File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
55
		URI urlString = exportFile.toURI();
56
		configurator.setDestination(urlString);
57
		
58
	    // create job
59
	    Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
60
	    // configure the job
61
	    job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
62
	    job.setUser(true);
63
	    // schedule job
64
	    job.schedule();
65
		
66
		performFinish = true;
67
		return performFinish;
68
	}
69

    
70
	/* (non-Javadoc)
71
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
72
	 */
73
	/** {@inheritDoc} */
74
	@Override
75
	public void addPages() {
76
		super.addPages();
77

    
78
		page = ExportToFileDestinationWizardPage.Jaxb();
79
		addPage(page);
80
	}
81

    
82
	/* (non-Javadoc)
83
	 * @see eu.etaxonomy.taxeditor.io.AbstractExportWizard#getConfigurator()
84
	 */
85
	/** {@inheritDoc} */
86
	@Override
87
	public JaxbExportConfigurator getConfigurator() {
88
		return configurator;
89
	}
90

    
91

    
92
}
(20-20/29)