Revision 12e7c169
Added by Katja Luther almost 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/termtree/e4/TermTreeDtoDropAdapter.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
@Override |
56 | 56 |
public boolean performDrop(Object data) { |
57 |
// if(StoreUtil.promptCheckIsDirty(editor)){ |
|
58 |
// return false; |
|
59 |
// } |
|
60 | 57 |
Object currentTarget = getCurrentTarget(); |
61 | 58 |
TermNodeDto target = null; |
62 | 59 |
if(currentTarget instanceof TermTreeDto){ |
... | ... | |
66 | 63 |
target = (TermNodeDto) currentTarget; |
67 | 64 |
} |
68 | 65 |
|
69 |
// if (target != null && target.getUuid() == null){ |
|
70 |
// if(StoreUtil.promptCheckIsDirty(editor)){ |
|
71 |
// return false; |
|
72 |
// } |
|
73 |
// } |
|
74 | 66 |
int position = 0; |
75 | 67 |
int location = getCurrentLocation(); |
76 | 68 |
UUID parentUuid = target.getParentUuid(); |
... | ... | |
87 | 79 |
} |
88 | 80 |
} |
89 | 81 |
|
90 |
|
|
91 |
if(target==null){ |
|
92 |
MessagingUtils.warningDialog("", this, ""); //$NON-NLS-1$ //$NON-NLS-1$ |
|
93 |
return false; |
|
94 |
} |
|
95 | 82 |
Collection<Object> droppedObjects = Collections.emptyList(); |
96 | 83 |
if(data instanceof Object[]){ |
97 | 84 |
droppedObjects = Arrays.asList((Object[])data); |
... | ... | |
165 | 152 |
AddFeatureOperation operation = new AddFeatureOperation( |
166 | 153 |
droppedFeature.getUuid(), |
167 | 154 |
target.getUuid(), position, editor, editor); |
168 |
// AbstractUtility.executeOperation(operation, sync); |
|
169 | 155 |
editor.setDirty(); |
170 | 156 |
editor.addOperation(operation); |
171 | 157 |
} |
... | ... | |
179 | 165 |
AddFeatureOperation operation = new AddFeatureOperation( |
180 | 166 |
termDto.getUuid(), |
181 | 167 |
target.getUuid(), position, editor, editor); |
182 |
// AbstractUtility.executeOperation(operation, sync); |
|
183 | 168 |
TermNodeDto newDto = new TermNodeDto(termDto, target, position, target.getTree(), null, null, null); |
184 |
// target.getChildren().add(position, newDto); |
|
185 | 169 |
|
186 | 170 |
editor.setDirty(); |
187 | 171 |
editor.addOperation(operation); |
... | ... | |
201 | 185 |
if(vocabulary == null){ |
202 | 186 |
return false; |
203 | 187 |
} |
204 |
// vocabulary = new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat()); |
|
205 |
|
|
206 | 188 |
} |
207 | 189 |
|
208 | 190 |
|
209 | 191 |
AddOntologyTermOperation operation = new AddOntologyTermOperation(wrapper, target.getUuid(), vocabulary, editor, editor); |
210 |
// AbstractUtility.executeOperation(operation, sync); |
|
192 |
|
|
211 | 193 |
editor.setDirty(); |
212 | 194 |
editor.addOperation(operation); |
213 | 195 |
|
214 | 196 |
} |
215 | 197 |
} |
216 | 198 |
editor.getViewer().refresh(); |
217 |
// viewer.refresh(); |
|
218 | 199 |
return true; |
219 | 200 |
} |
220 | 201 |
|
... | ... | |
227 | 208 |
if (droppedNode.getChildren().contains(newParent) ){ |
228 | 209 |
return true; |
229 | 210 |
} |
230 |
|
|
231 |
|
|
232 | 211 |
if (newParent.getParentUuid() != null){ |
233 | 212 |
result = checkCircle(droppedNode, editor.getNodeDtoForUuid(newParent.getParentUuid())); |
234 | 213 |
|
... | ... | |
251 | 230 |
TermNodeDto selectedNode = (TermNodeDto)getSelectedObject(); |
252 | 231 |
rootTree = selectedNode.getTree(); |
253 | 232 |
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 | 233 |
if(target instanceof TermTreeDto && getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON){ |
258 |
isSupported = false;
|
|
234 |
return false;
|
|
259 | 235 |
} |
260 | 236 |
if (target == null){ |
261 |
isSupported = false;
|
|
237 |
return false;
|
|
262 | 238 |
} |
263 | 239 |
if (target instanceof TermNodeDto && ((TermNodeDto)target).getTree().isFlat() && getCurrentLocation() == LOCATION_ON){ |
264 |
isSupported = false;
|
|
240 |
return false;
|
|
265 | 241 |
} |
266 | 242 |
TermDto term = null; |
267 | 243 |
if (getSelectedObject() instanceof TermNodeDto){ |
... | ... | |
277 | 253 |
|
278 | 254 |
} |
279 | 255 |
} |
280 |
// if (getSelectedObject() instanceof ) |
|
281 |
|
|
282 | 256 |
return isSupported; |
283 | 257 |
} |
284 | 258 |
|
... | ... | |
298 | 272 |
} |
299 | 273 |
} |
300 | 274 |
return true; |
301 |
|
|
302 |
// if ((target instanceof TermNodeDto && !((TermNodeDto)target).getTree().isAllowDuplicate() && ((TermNodeDto)target).getTree().getTerms().contains(term)) || (target instanceof TermTreeDto && !((TermTreeDto)target).isAllowDuplicate() && ((TermTreeDto)target).getTerms().contains(term))){ |
|
303 |
// TermTreeDto targetTree = null; |
|
304 |
// if (target instanceof TermNodeDto){ |
|
305 |
// targetTree = ((TermNodeDto)target).getTree(); |
|
306 |
// }else if (target instanceof TermTreeDto){ |
|
307 |
// targetTree = (TermTreeDto)target; |
|
308 |
// } |
|
309 |
// |
|
310 |
// if (!(rootTree != null && rootTree.equals(targetTree))){ |
|
311 |
// isSupported = false; |
|
312 |
// } |
|
313 |
// } |
|
314 |
// return isSupported; |
|
315 | 275 |
} |
316 | 276 |
|
317 | 277 |
|
Also available in: Unified diff
ref #8476: fix d&d in flat tree and cleanup