Revision d7bdaf08
Added by Patrick Plitzner almost 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportOntologyHandler.java | ||
---|---|---|
11 | 11 |
import java.io.File; |
12 | 12 |
import java.util.ArrayList; |
13 | 13 |
import java.util.List; |
14 |
import java.util.UUID; |
|
14 | 15 |
|
15 | 16 |
import javax.inject.Named; |
16 | 17 |
|
... | ... | |
22 | 23 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
23 | 24 |
import org.eclipse.e4.ui.services.IServiceConstants; |
24 | 25 |
import org.eclipse.jface.viewers.IStructuredSelection; |
25 |
import org.eclipse.swt.widgets.DirectoryDialog;
|
|
26 |
import org.eclipse.swt.widgets.FileDialog;
|
|
26 | 27 |
import org.eclipse.swt.widgets.Shell; |
27 | 28 |
import org.eclipse.ui.progress.IProgressConstants; |
28 | 29 |
|
... | ... | |
51 | 52 |
return; |
52 | 53 |
} |
53 | 54 |
|
54 |
List<FeatureTree> featureTrees = new ArrayList<>(); |
|
55 |
selection.toList().stream().filter(o->o instanceof FeatureTree).forEach(tree->featureTrees.add((FeatureTree)tree)); |
|
56 |
DirectoryDialog dialog = new DirectoryDialog(shell); |
|
57 |
String directoryString = dialog.open(); |
|
58 |
if(directoryString!=null){ |
|
55 |
List<UUID> featureTreeUuids = new ArrayList<>(); |
|
56 |
selection.toList().stream().filter(o->o instanceof FeatureTree).forEach(tree->featureTreeUuids.add(((FeatureTree)tree).getUuid())); |
|
57 |
|
|
58 |
FileDialog dialog = new FileDialog(shell); |
|
59 |
String[] filterNames = { |
|
60 |
"Web Ontology Language (*.owl)", |
|
61 |
"Extensible Markup Language (*.xml)", |
|
62 |
"All files (*.*)" |
|
63 |
}; |
|
64 |
String[] filterExtensions = { "*.owl", "*.xml", "*.*"}; |
|
65 |
|
|
66 |
dialog.setOverwrite(true); |
|
67 |
dialog.setFilterNames(filterNames); |
|
68 |
dialog.setFilterExtensions(filterExtensions); |
|
69 |
String fileString = dialog.open(); |
|
70 |
if(fileString!=null){ |
|
59 | 71 |
// create job |
60 |
Job job = CdmStore.getExportManager().createIOServiceJob(StructureTreeOwlExportConfigurator.NewInstance(), new File(directoryString+"/term_trees.owl")); |
|
72 |
StructureTreeOwlExportConfigurator configurator = StructureTreeOwlExportConfigurator.NewInstance(); |
|
73 |
|
|
74 |
configurator.setFeatureTreeUuids(featureTreeUuids); |
|
75 |
|
|
76 |
Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(fileString)); |
|
61 | 77 |
// configure the job |
62 | 78 |
job.setProperty(IProgressConstants.KEEP_PROPERTY, true); |
63 | 79 |
job.setUser(true); |
Also available in: Unified diff
ref #6774 Fix term treee export via context menu