1
|
/**
|
2
|
* Copyright (C) 2017 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
|
package eu.etaxonomy.taxeditor.io.e4.out.owl;
|
10
|
|
11
|
import java.io.File;
|
12
|
|
13
|
import javax.inject.Inject;
|
14
|
import javax.inject.Named;
|
15
|
|
16
|
import org.eclipse.core.runtime.jobs.Job;
|
17
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
18
|
import org.eclipse.e4.core.di.annotations.Optional;
|
19
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
20
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
21
|
import org.eclipse.ui.progress.IProgressConstants;
|
22
|
|
23
|
import eu.etaxonomy.cdm.io.descriptive.owl.out.StructureTreeOwlExportConfigurator;
|
24
|
import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
|
25
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
26
|
|
27
|
/**
|
28
|
*
|
29
|
* @author pplitzner
|
30
|
* @since May 23, 2019
|
31
|
*
|
32
|
*/
|
33
|
public class OwlTermExportWizard extends
|
34
|
AbstractExportWizardE4<StructureTreeOwlExportConfigurator> {
|
35
|
|
36
|
private StructureTreeOwlExportConfigurator configurator;
|
37
|
private OwlTermExportWizardPage exportPage;
|
38
|
|
39
|
@Inject
|
40
|
public OwlTermExportWizard(IEclipseContext context,
|
41
|
@Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
|
42
|
super(context, selection);
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
public void init() {
|
47
|
configurator = StructureTreeOwlExportConfigurator.NewInstance();
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public StructureTreeOwlExportConfigurator getConfigurator() {
|
52
|
return configurator;
|
53
|
}
|
54
|
|
55
|
@Override
|
56
|
public boolean performFinish() {
|
57
|
configurator.setFeatureTreeUuids(exportPage.getSelectedTrees());
|
58
|
configurator.setVocabularyUuids(exportPage.getSelectedVocabularies());
|
59
|
|
60
|
if(exportPage.getExportDirectory()!=null){
|
61
|
// create job
|
62
|
Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(exportPage.getExportDirectory()));
|
63
|
// configure the job
|
64
|
job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
|
65
|
job.setUser(true);
|
66
|
// schedule job
|
67
|
job.schedule();
|
68
|
}
|
69
|
return true;
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public void addPages() {
|
74
|
exportPage = new OwlTermExportWizardPage("OWL term export");
|
75
|
addPage(exportPage);
|
76
|
}
|
77
|
|
78
|
}
|