Project

General

Profile

Revision 806bd3b0

ID806bd3b034376c5979bc766a829886e0f156f538
Parent aeb34234
Child e8423490

Added by Patrick Plitzner about 3 years ago

ref #7362 Use pre-selected vocabulary when dragging terms

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java
105 105
		    }
106 106
		    else if(droppedObject instanceof OntologyTermWrapper){
107 107
		        OntologyTermWrapper wrapper = (OntologyTermWrapper)droppedObject;
108
		        TermVocabulary vocabulary = TermVocabularySelectionDialog.select(
109
		                "Choose vocabulary for import", viewer.getControl().getShell(), null);
110
		        if(vocabulary instanceof OrderedTermVocabulary){
111
		            MessagingUtils.warningDialog("Import not possible", this,
112
		                    "The chosen vocabulary is an ordered vocabulary.\n"
113
		                    + "Importing into ordered vocabularies is currently not supported.");
114
		            return false;
108
		        TermVocabulary vocabulary = wrapper.getTermVocabulary();
109
		        if(vocabulary==null){
110
		            vocabulary =  TermVocabularySelectionDialog.select(
111
		                    "Choose vocabulary for import", viewer.getControl().getShell(), null);
112
		            if(vocabulary instanceof OrderedTermVocabulary){
113
		                MessagingUtils.warningDialog("Import not possible", this,
114
		                        "The chosen vocabulary is an ordered vocabulary.\n"
115
		                                + "Importing into ordered vocabularies is currently not supported.");
116
		                return false;
117
		            }
115 118
		        }
116 119
		        if(vocabulary!=null){
117 120
		            if(wrapper.getDescription()==null && MessagingUtils.confirmDialog("Load Details?", "Not all details for this term have been loaded yet.\n"
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/GfBioTerminologyImportPresenter.java
150 150
            @Override
151 151
            public void dragSetData(DragSourceEvent event) {
152 152
                if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
153
                    LocalSelectionTransfer.getTransfer().setSelection(composite.getTreeTermHierarchy().getSelection());
153
                    IStructuredSelection selection = (IStructuredSelection) composite.getTreeTermHierarchy().getSelection();
154
                    selection.toList().stream()
155
                    .filter(item->item instanceof OntologyTermWrapper)
156
                    .forEach(wrapper->((OntologyTermWrapper)wrapper).setTermVocabulary(composite.getTermVocabularyComboViewer().getSelection()));
157
                    LocalSelectionTransfer.getTransfer().setSelection(selection);
154 158
                }
155 159
            }
156 160
            @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/wrapper/OntologyTermWrapper.java
10 10

  
11 11
import java.util.List;
12 12

  
13
import eu.etaxonomy.cdm.model.common.TermVocabulary;
14

  
13 15
/**
14 16
 * Wrapper for terms received from the GfBio terminology service.
15 17
 *
......
23 25
    private String description;
24 26
    private List<String> synonyms;
25 27
    private String comment;
28
    private TermVocabulary termVocabulary;
26 29
    public OntologyTermWrapper(String uri, String label, String sourceTerminology) {
27 30
        super(uri, label);
28 31
        this.sourceTerminology = sourceTerminology;
......
51 54
    public void setSourceTerminology(String sourceTerminology) {
52 55
        this.sourceTerminology = sourceTerminology;
53 56
    }
57
    public TermVocabulary getTermVocabulary() {
58
        return termVocabulary;
59
    }
60
    public void setTermVocabulary(TermVocabulary termVocabulary) {
61
        this.termVocabulary = termVocabulary;
62
    }
54 63
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)