Revision 1863bfc6
Added by Andreas Müller almost 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/termtree/e4/TermTreeDtoDropAdapter.java | ||
---|---|---|
131 | 131 |
return false; |
132 | 132 |
} |
133 | 133 |
TermNodeDto droppedNode = editor.getNodeDtoForUuid(((TermNodeDto) droppedObject).getUuid()); |
134 |
ITermTreeEditor sourceEditor = editor; |
|
134 |
ITermTreeEditor<?> sourceEditor = editor;
|
|
135 | 135 |
if (droppedNode == null){ |
136 | 136 |
//the node does not come from the same editor, need to find the source editor |
137 | 137 |
TermType type = ((TermNodeDto) droppedObject).getType(); |
... | ... | |
140 | 140 |
EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class); |
141 | 141 |
List<MPart> alreadyOpenedEditors = partService.getParts().stream() |
142 | 142 |
.filter(part->part.getObject()!=null && part.getObject() instanceof ITermTreeEditor) |
143 |
.filter(part->((ITermTreeEditor)part.getObject()).getTermType().equals(type)) |
|
143 |
.filter(part->((ITermTreeEditor<?>)part.getObject()).getTermType().equals(type))
|
|
144 | 144 |
.collect(Collectors.toList()); |
145 | 145 |
|
146 | 146 |
if(!alreadyOpenedEditors.isEmpty()){ |
147 | 147 |
//there should never be more than one already opened editor |
148 | 148 |
//so we just open the first |
149 |
sourceEditor = (ITermTreeEditor)alreadyOpenedEditors.iterator().next().getObject(); |
|
149 |
sourceEditor = (ITermTreeEditor<?>)alreadyOpenedEditors.iterator().next().getObject();
|
|
150 | 150 |
droppedNode = sourceEditor.getNodeDtoForUuid(((TermNodeDto) droppedObject).getUuid()); |
151 | 151 |
} |
152 | 152 |
} |
... | ... | |
201 | 201 |
} |
202 | 202 |
else if(droppedObject instanceof OntologyTermWrapper){ |
203 | 203 |
OntologyTermWrapper wrapper = (OntologyTermWrapper)droppedObject; |
204 |
TermVocabulary vocabulary = wrapper.getTermVocabulary(); |
|
204 |
TermVocabulary<?> vocabulary = wrapper.getTermVocabulary();
|
|
205 | 205 |
if(vocabulary==null){ |
206 | 206 |
vocabulary = TermVocabularySelectionDialog.select( |
207 | 207 |
Messages.FeatureTreeDropAdapter_CHOOSE_VOC, viewer.getControl().getShell(), null); |
... | ... | |
216 | 216 |
} |
217 | 217 |
} |
218 | 218 |
|
219 |
|
|
220 | 219 |
AddOntologyTermOperation operation = new AddOntologyTermOperation(wrapper, target.getUuid(), vocabulary, editor, editor); |
221 | 220 |
|
222 | 221 |
editor.setDirty(); |
... | ... | |
228 | 227 |
return true; |
229 | 228 |
} |
230 | 229 |
|
231 |
/** |
|
232 |
* @param droppedNode |
|
233 |
* @param target |
|
234 |
*/ |
|
235 | 230 |
private boolean checkCircle(TermNodeDto droppedNode, TermNodeDto newParent) { |
236 | 231 |
boolean result = false; |
237 | 232 |
if (droppedNode.getChildren().contains(newParent) ){ |
... | ... | |
242 | 237 |
|
243 | 238 |
} |
244 | 239 |
return result; |
245 |
|
|
246 | 240 |
} |
247 | 241 |
|
248 | 242 |
@Override |
... | ... | |
286 | 280 |
} |
287 | 281 |
|
288 | 282 |
private boolean checkDuplication(Object target, TermTreeDto rootTree, TermDto term) { |
289 |
boolean isSupported = true; |
|
290 | 283 |
TermTreeDto targetTree = null; |
291 | 284 |
if (target instanceof TermNodeDto){ |
292 | 285 |
targetTree = ((TermNodeDto)target).getTree(); |
... | ... | |
302 | 295 |
} |
303 | 296 |
return true; |
304 | 297 |
} |
305 |
|
|
306 |
|
|
307 |
|
|
308 | 298 |
} |
Also available in: Unified diff
cleanup