2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.io
.wizard
;
12 import java
.util
.HashSet
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.eclipse
.core
.runtime
.jobs
.Job
;
17 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
18 import org
.eclipse
.swt
.widgets
.Combo
;
19 import org
.eclipse
.ui
.IWorkbench
;
20 import org
.eclipse
.ui
.progress
.IProgressConstants
;
22 import eu
.etaxonomy
.cdm
.io
.outputmodel
.OutputModelConfigurator
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
31 public class OutputModelExportWizard
extends
32 AbstractExportWizard
<OutputModelConfigurator
> {
34 private OutputModelConfigurator configurator
;
35 private ExportToFileDestinationWizardPage page
;
37 private final String description
= "Export the contents of the currently selected database into Comma Separated Value format.";
41 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
42 * org.eclipse.jface.viewers.IStructuredSelection)
45 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
46 configurator
= new OutputModelConfigurator(null);
53 * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
56 public OutputModelConfigurator
getConfigurator() {
63 * @see org.eclipse.jface.wizard.Wizard#performFinish()
66 public boolean performFinish() {
67 String urlString
= page
.getFolderText() + File
.separator
;
68 //+ page.getExportFileName();
70 final Combo combo
= page
.getCombo();
71 final List
<Classification
> listClassifications
= CdmStore
.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
73 int selectionIndex
= combo
.getSelectionIndex();
74 HashSet
<UUID
> set
= new HashSet
<UUID
>();
75 if(selectionIndex
== -1){
76 for(Classification c
:listClassifications
){
80 for(Classification c
:listClassifications
){
81 if(c
.getTitleCache().equalsIgnoreCase(combo
.getItem(selectionIndex
))){
85 configurator
.setClassificationUuids(set
);
91 Job job
= CdmStore
.getExportManager().createIOServiceJob(configurator
, urlString
);
93 job
.setProperty(IProgressConstants
.KEEP_PROPERTY
, true);
104 * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
107 public void addPages() {
108 //TODO create page with drop down menu for export for single classification.
113 page
= ExportToFileDestinationWizardPage
.OutputModel();