Project

General

Profile

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

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

    
20
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * @author k.luther
25
 * @created Apr. 12, 2015
26
 * @version 1.0
27
 */
28
public class CsvNameExportWizard extends AbstractExportWizard<CsvNameExportConfigurator> {
29

    
30
	protected CsvNameExportConfigurator configurator;
31
	protected ExportToFileDestinationWizardPage page;
32

    
33
	private final String description = "Export the names of the currently selected database into Semicolon Separated Value format.";
34
	/*
35
	 * (non-Javadoc)
36
	 *
37
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
38
	 * org.eclipse.jface.viewers.IStructuredSelection)
39
	 */
40
	@Override
41
	public void init(IWorkbench workbench, IStructuredSelection selection) {
42
		configurator = CsvNameExportConfigurator.NewInstance(null,null);
43
		configurator.setNamesOnly(true);
44
	}
45

    
46
	/*
47
	 * (non-Javadoc)
48
	 *
49
	 * @see
50
	 * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
51
	 */
52
	@Override
53
	public CsvNameExportConfigurator getConfigurator() {
54
		return configurator;
55
	}
56

    
57
	/*
58
	 * (non-Javadoc)
59
	 *
60
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
61
	 */
62
	@Override
63
	public boolean performFinish() {
64
	    String urlString = page.getFolderText() + File.separator
65
	            + page.getExportFileName();
66

    
67
	    final Combo combo = page.getCombo();
68
	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
69
	    
70
        // create job
71
        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
72
        // configure the job
73
        job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
74
        job.setUser(true);
75
        // schedule job
76
        job.schedule();
77
	   
78
		return true;
79
	}
80

    
81
	/*
82
	 * (non-Javadoc)
83
	 *
84
	 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
85
	 */
86
	@Override
87
	public void addPages() {
88
	    //TODO create page with drop down menu for export for single classification.
89
//		super.addPages();
90

    
91

    
92
		//standard page
93
		page =  ExportToFileDestinationWizardPage.CsvNames(configurator);
94

    
95
		addPage(page);
96
	}
97
}
98

    
(11-11/30)