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
.featuretree
.e4
;
13 import org
.eclipse
.core
.runtime
.jobs
.Job
;
14 import org
.eclipse
.swt
.events
.SelectionAdapter
;
15 import org
.eclipse
.swt
.events
.SelectionEvent
;
16 import org
.eclipse
.swt
.widgets
.DirectoryDialog
;
17 import org
.eclipse
.swt
.widgets
.Shell
;
18 import org
.eclipse
.ui
.progress
.IProgressConstants
;
20 import eu
.etaxonomy
.cdm
.io
.descriptive
.owl
.out
.OwlExportConfigurator
;
21 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class FeatureTreeExportListener
extends SelectionAdapter
{
32 private FeatureTreeEditorComposite composite
;
34 public FeatureTreeExportListener(Shell shell
, FeatureTreeEditorComposite composite
) {
37 this.composite
= composite
;
41 public void widgetSelected(SelectionEvent e
) {
42 if(composite
.getFeatureTree()==null){
43 MessagingUtils
.informationDialog("Export not possible", "There is no feature tree selected.");
46 DirectoryDialog dialog
= new DirectoryDialog(e
.widget
.getDisplay().getActiveShell());
47 String directoryString
= dialog
.open();
48 if(directoryString
!=null){
50 Job job
= CdmStore
.getExportManager().createIOServiceJob(OwlExportConfigurator
.NewInstance(null, null, composite
.getFeatureTree()), new File(directoryString
+"/owl.owl"));
52 job
.setProperty(IProgressConstants
.KEEP_PROPERTY
, true);