Project

General

Profile

Revision c2d94ebc

IDc2d94ebc0a9fa2689b91e60157a2813a48c85132
Parent 8f555f2f
Child 398b6133

Added by Patrick Plitzner over 1 year ago

ref #6774 Initial implementation of OWL term export wizard

View differences:

eu.etaxonomy.taxeditor.store/fragment.e4xmi
158 158
    <elements xsi:type="commands:Command" xmi:id="_d6YpoEAVEembfJNLZI9wiA" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.moveTerm" commandName="%command.commandname.17"/>
159 159
    <elements xsi:type="commands:Command" xmi:id="_lJi2sGZvEemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionPerAreaStatusWizardHandler" commandName="%command.commandname.18"/>
160 160
    <elements xsi:type="commands:Command" xmi:id="_QnWnMGZ-Eemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionAreaWizardHandler" commandName="%command.commandname.19"/>
161
    <elements xsi:type="commands:Command" xmi:id="_WISF0H1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.store.command.export.term.owl" commandName="OWL Term Export"/>
161 162
  </fragments>
162 163
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
163 164
    <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
......
200 201
    <elements xsi:type="commands:Handler" xmi:id="_iKdcQGdoEemm7Ie9EDdklA" elementId="eu.etaxonomy.taxeditor.io.e4.in.owl.OpenOwlImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.owl.OpenOwlImportWizard" command="_Z7vHUGdoEemm7Ie9EDdklA"/>
201 202
    <elements xsi:type="commands:Handler" xmi:id="_e-sBgGZwEemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusPerAreaWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionPerAreaStatusWizardHandler" command="_lJi2sGZvEemew5ARzf3JfA"/>
202 203
    <elements xsi:type="commands:Handler" xmi:id="_XxpDoGZ-Eemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionAreaWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionAreaWizardHandler" command="_QnWnMGZ-Eemew5ARzf3JfA"/>
204
    <elements xsi:type="commands:Handler" xmi:id="_nhGLwH1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.io.e4.out.owl.OpenOwlTermExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.owl.OpenOwlTermExportWizard" command="_WISF0H1LEem6uMX-L-maww"/>
203 205
  </fragments>
204 206
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
205 207
    <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">
......
236 238
      <children xsi:type="menu:HandledMenuItem" xmi:id="_qR5ocKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvName" label="%wizard.name.19" command="_zDy74KqZEeeXcJGhyhlrKA"/>
237 239
      <children xsi:type="menu:HandledMenuItem" xmi:id="_tBUcEKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvPrint" label="%wizard.name.20" command="_zIKegKqZEeeXcJGhyhlrKA"/>
238 240
      <children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
241
      <children xsi:type="menu:HandledMenuItem" xmi:id="_OL6sMH1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportOwlTerm" label="OWL Term Export" command="_WISF0H1LEem6uMX-L-maww">
242
        <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_c7iiUH1LEem6uMX-L-maww" coreExpressionId="isShowExperimentalFeatures"/>
243
      </children>
239 244
    </elements>
240 245
    <elements xsi:type="menu:Menu" xmi:id="_QC5O8KkaEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.store.menu.import" label="%menu.label.3">
241 246
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/RootElementsOnlyTreeContentProvider.java
12 12

  
13 13
import org.eclipse.jface.viewers.ITreeContentProvider;
14 14

  
15
import eu.etaxonomy.cdm.model.term.TermVocabulary;
16

  
17 15
/**
18 16
 *
19 17
 * @author pplitzner
......
24 22

  
25 23
    @Override
26 24
    public Object[] getElements(Object inputElement) {
27
        return ((Collection<TermVocabulary>)inputElement).toArray();
25
        if(inputElement instanceof Collection){
26
            return ((Collection)inputElement).toArray();
27
        }
28
        return new Object[0];
28 29
    }
29 30

  
30 31
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportOntologyHandler.java
10 10

  
11 11
import java.io.File;
12 12
import java.util.ArrayList;
13
import java.util.Collections;
14 13
import java.util.List;
15 14

  
16 15
import javax.inject.Named;
......
58 57
        String directoryString = dialog.open();
59 58
        if(directoryString!=null){
60 59
            // create job
61
            Job job = CdmStore.getExportManager().createIOServiceJob(StructureTreeOwlExportConfigurator.NewInstance(null, null, featureTrees, Collections.EMPTY_LIST), new File(directoryString+"/term_trees.owl"));
60
            Job job = CdmStore.getExportManager().createIOServiceJob(StructureTreeOwlExportConfigurator.NewInstance(), new File(directoryString+"/term_trees.owl"));
62 61
            // configure the job
63 62
            job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
64 63
            job.setUser(true);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/owl/OpenOwlTermExportWizard.java
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 eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
12
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
13

  
14
/**
15
 *
16
 * @author pplitzner
17
 * @since May 23, 2019
18
 *
19
 */
20
public class OpenOwlTermExportWizard extends AbstractOpenExportWizard {
21

  
22
    @Override
23
    protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
24
        return OwlTermExportWizard.class;
25
    }
26

  
27
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/owl/OwlTermExportComposite.java
1
/**
2
* Copyright (C) 2019 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.util.Collections;
12
import java.util.List;
13

  
14
import org.eclipse.jface.layout.GridLayoutFactory;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.layout.GridLayout;
17
import org.eclipse.swt.widgets.Composite;
18

  
19
import eu.etaxonomy.cdm.api.service.IVocabularyService;
20
import eu.etaxonomy.cdm.model.term.TermType;
21
import eu.etaxonomy.cdm.persistence.dto.TermDto;
22
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
23
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
24
import eu.etaxonomy.taxeditor.editor.definedterm.RootElementsOnlyTreeContentProvider;
25
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
26
import eu.etaxonomy.taxeditor.preference.wizard.CheckBoxTreeComposite;
27
import eu.etaxonomy.taxeditor.store.CdmStore;
28

  
29
/**
30
 * @author pplitzner
31
 * @since May 23, 2019
32
 *
33
 */
34
public class OwlTermExportComposite extends Composite {
35

  
36
    private List<TermVocabularyDto> areaVocabularies;
37

  
38
    public OwlTermExportComposite(List<TermDto> selectedAreas, Composite parent, int style) {
39
        super(parent, style);
40
        setLayout(new GridLayout(3, false));
41

  
42
        this.areaVocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(TermType.NamedArea);
43

  
44
        CheckBoxTreeComposite treeComposite = new CheckBoxTreeComposite(parent, new RootElementsOnlyTreeContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
45
        treeComposite.setAllowTopLevelSelection(true);
46
        treeComposite.getViewer().setComparator(new DefinedTermSorter());
47
        treeComposite.getViewer().setInput(areaVocabularies);
48
        Collections.sort(selectedAreas, (o1, o2)->o1.getOrderIndex()-o2.getOrderIndex());
49
        treeComposite.setCheckedElements(selectedAreas.toArray());
50
        GridLayoutFactory.fillDefaults().applyTo(treeComposite);
51

  
52
    }
53

  
54
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/owl/OwlTermExportWizard.java
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 javax.inject.Inject;
12
import javax.inject.Named;
13

  
14
import org.eclipse.e4.core.contexts.IEclipseContext;
15
import org.eclipse.e4.core.di.annotations.Optional;
16
import org.eclipse.e4.ui.services.IServiceConstants;
17
import org.eclipse.jface.viewers.IStructuredSelection;
18

  
19
import eu.etaxonomy.cdm.io.descriptive.owl.out.StructureTreeOwlExportConfigurator;
20
import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
21

  
22
/**
23
 *
24
 * @author pplitzner
25
 * @since May 23, 2019
26
 *
27
 */
28
public class OwlTermExportWizard extends
29
AbstractExportWizardE4<StructureTreeOwlExportConfigurator> {
30

  
31
    private StructureTreeOwlExportConfigurator configurator;
32
    private OwlTermExportWizardPage owlTermExportWizardPage;
33

  
34
    @Inject
35
    public OwlTermExportWizard(IEclipseContext context,
36
            @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
37
        super(context, selection);
38
    }
39

  
40
    @Override
41
    public void init() {
42
        configurator = StructureTreeOwlExportConfigurator.NewInstance();
43
    }
44

  
45
    @Override
46
    public StructureTreeOwlExportConfigurator getConfigurator() {
47
        return configurator;
48
    }
49

  
50
    @Override
51
    public boolean performFinish() {
52
//        CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
53
//        PreferencesUtil.setStringValue("exportFolder", page.getFolderText());
54
        return true;
55
    }
56

  
57
    @Override
58
    public void addPages() {
59
        owlTermExportWizardPage = new OwlTermExportWizardPage("OWL term export");
60
        addPage(owlTermExportWizardPage);
61
    }
62

  
63
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/owl/OwlTermExportWizardPage.java
1
/**
2
* Copyright (C) 2019 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.util.Collections;
12

  
13
import org.eclipse.jface.wizard.WizardPage;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Composite;
16

  
17
/**
18
 * @author pplitzner
19
 * @since May 23, 2019
20
 *
21
 */
22
public class OwlTermExportWizardPage extends WizardPage {
23

  
24
    protected OwlTermExportWizardPage(String pageName) {
25
        super(pageName);
26
        setTitle("OWL Term Export");
27
        setDescription("Select the objects to export");
28
    }
29

  
30
    @Override
31
    public void createControl(Composite parent) {
32
        setControl(new OwlTermExportComposite(Collections.EMPTY_LIST, parent, SWT.NONE));
33
    }
34

  
35
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)