1
|
package eu.etaxonomy.taxeditor.io.wizard;
|
2
|
|
3
|
import java.io.File;
|
4
|
import java.util.HashSet;
|
5
|
import java.util.List;
|
6
|
import java.util.UUID;
|
7
|
|
8
|
import org.eclipse.core.runtime.jobs.Job;
|
9
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
10
|
import org.eclipse.swt.widgets.Combo;
|
11
|
import org.eclipse.ui.IWorkbench;
|
12
|
import org.eclipse.ui.progress.IProgressConstants;
|
13
|
|
14
|
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
|
15
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
16
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
17
|
|
18
|
public class CsvPrintExportWizard extends CsvNameExportWizard{
|
19
|
|
20
|
|
21
|
private final String description = "Export the contents of the currently selected database into Semicolon Separated Value format.";
|
22
|
@Override
|
23
|
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
24
|
configurator = CsvNameExportConfigurator.NewInstance(null,null);
|
25
|
configurator.setNamesOnly(false);
|
26
|
}
|
27
|
|
28
|
@Override
|
29
|
public CsvNameExportConfigurator getConfigurator() {
|
30
|
|
31
|
return configurator;
|
32
|
}
|
33
|
|
34
|
|
35
|
|
36
|
/*
|
37
|
* (non-Javadoc)
|
38
|
*
|
39
|
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
|
40
|
*/
|
41
|
@Override
|
42
|
public void addPages() {
|
43
|
//TODO create page with drop down menu for export for single classification.
|
44
|
// super.addPages();
|
45
|
|
46
|
|
47
|
//standard page
|
48
|
page = ExportToFileDestinationWizardPage.CsvPrint(configurator);
|
49
|
|
50
|
addPage(page);
|
51
|
}
|
52
|
/*
|
53
|
* (non-Javadoc)
|
54
|
*
|
55
|
* @see org.eclipse.jface.wizard.Wizard#performFinish()
|
56
|
*/
|
57
|
@Override
|
58
|
public boolean performFinish() {
|
59
|
String urlString = page.getFolderText() + File.separator
|
60
|
+ page.getExportFileName();
|
61
|
|
62
|
final Combo combo = page.getCombo();
|
63
|
|
64
|
|
65
|
configurator.setClassificationUUID(page.getSelectedClassificationUUID());
|
66
|
// create job
|
67
|
Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
|
68
|
// configure the job
|
69
|
job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
|
70
|
job.setUser(true);
|
71
|
// schedule job
|
72
|
job.schedule();
|
73
|
|
74
|
return true;
|
75
|
}
|
76
|
|
77
|
}
|