Revision 9e550198
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateTermVocabularyOperation.java | ||
---|---|---|
15 | 15 |
import org.eclipse.core.runtime.IStatus; |
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
18 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
19 |
import eu.etaxonomy.cdm.model.common.OrderedTermBase; |
|
20 |
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary; |
|
21 |
import eu.etaxonomy.cdm.model.common.TermType; |
|
18 | 22 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
19 | 23 |
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput; |
20 | 24 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
... | ... | |
50 | 54 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
51 | 55 |
throws ExecutionException { |
52 | 56 |
|
53 |
TermVocabulary termVocabulary = |
|
54 |
TermVocabulary.NewInstance(definedEditorInput.getTermType(), |
|
55 |
null, |
|
56 |
"Untitled", |
|
57 |
null, |
|
58 |
null); |
|
57 |
TermType type= definedEditorInput.getTermType(); |
|
58 |
DefinedTermBase test = type.getEmptyDefinedTermBase(); |
|
59 |
TermVocabulary termVocabulary = null; |
|
60 |
if (test instanceof OrderedTermBase){ |
|
61 |
termVocabulary = OrderedTermVocabulary.NewInstance(definedEditorInput.getTermType(), |
|
62 |
null, |
|
63 |
"Untitled", |
|
64 |
null, |
|
65 |
null); |
|
66 |
} |
|
67 |
|
|
68 |
if (termVocabulary == null){ |
|
69 |
termVocabulary = |
|
70 |
TermVocabulary.NewInstance(definedEditorInput.getTermType(), |
|
71 |
null, |
|
72 |
"Untitled", |
|
73 |
null, |
|
74 |
null); |
|
75 |
} |
|
59 | 76 |
|
60 | 77 |
termVocabulary = CdmStore.getService(IVocabularyService.class).save(termVocabulary); |
61 | 78 |
definedEditorInput.getVocabularies().add(termVocabulary); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java | ||
---|---|---|
102 | 102 |
// method is determined by the compare method in the |
103 | 103 |
// DefinedTermEditor's ViewerSorter (DefinedTermSorter) class |
104 | 104 |
if(currentLocation == ViewerDropAdapter.LOCATION_BEFORE) { |
105 |
otVoc.addTermBelow((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary); |
|
106 |
((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term); |
|
105 |
otVoc.addTermAbove((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary); |
|
106 |
if (((DefinedTermBase) targetTermOrVocabulary).getPartOf() != null){ |
|
107 |
((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term); |
|
108 |
} |
|
107 | 109 |
} |
108 | 110 |
|
109 | 111 |
if(currentLocation == ViewerDropAdapter.LOCATION_AFTER) { |
110 |
otVoc.addTermAbove((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary); |
|
111 |
((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term); |
|
112 |
otVoc.addTermBelow((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary); |
|
113 |
if (((DefinedTermBase) targetTermOrVocabulary).getPartOf() != null){ |
|
114 |
((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term); |
|
115 |
} |
|
112 | 116 |
} |
113 | 117 |
if(currentLocation == ViewerDropAdapter.LOCATION_ON) { |
114 | 118 |
targetDefinedTerm.addIncludes(term); |
... | ... | |
119 | 123 |
targetDefinedTerm.addIncludes(term); |
120 | 124 |
targetDefinedTerm.getVocabulary().addTerm(term); |
121 | 125 |
} |
122 |
|
|
126 |
|
|
123 | 127 |
} |
124 | 128 |
|
125 | 129 |
} |
Also available in: Unified diff
fix #4821: create OrderedTermvoc for OrderedTerms