Revision adacf42f
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java | ||
---|---|---|
77 | 77 |
MessagingUtils.warningDialog(Messages.FeatureNodeDropAdapter_INVALID_TARGET, this, Messages.FeatureNodeDropAdapter_INVALID_TARGET_MESSAGE); |
78 | 78 |
return false; |
79 | 79 |
} |
80 |
|
|
81 | 80 |
Collection<Object> droppedObjects = Collections.emptyList(); |
82 | 81 |
if(data instanceof Object[]){ |
83 | 82 |
droppedObjects = Arrays.asList((Object[])data); |
... | ... | |
89 | 88 |
|
90 | 89 |
// cannot drop a feature node onto itself |
91 | 90 |
for (Object droppedObject : droppedObjects) { |
91 |
if(droppedObject==null){ |
|
92 |
MessagingUtils.warningDialog("Move failed", this.getClass(), |
|
93 |
"Moving the feature node failed. Try saving before."); |
|
94 |
return false; |
|
95 |
} |
|
92 | 96 |
if (droppedObject.equals(target)) { |
93 | 97 |
return false; |
94 | 98 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java | ||
---|---|---|
218 | 218 |
operations.forEach(operation->AbstractUtility.executeOperation(operation, sync)); |
219 | 219 |
operations.clear(); |
220 | 220 |
|
221 |
// List<FeatureTree> trees = (List<FeatureTree>) viewer.getInput(); |
|
222 |
// CdmStore.getService(IFeatureTreeService.class).merge(trees); |
|
221 |
/* |
|
222 |
* reload feature trees is needed to update i.e. |
|
223 |
* temporarily created feature nodes by adding features. |
|
224 |
* This is related to the current saving strategy which |
|
225 |
* emulates all changes on the visible feature tree but |
|
226 |
* the actual change is done when saving via executeOperation() |
|
227 |
*/ |
|
228 |
Object[] expandedElements = viewer.getExpandedElements(); |
|
229 |
viewer.getTree().removeAll(); |
|
230 |
List<FeatureTree> trees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null); |
|
231 |
viewer.setInput(trees); |
|
232 |
viewer.setExpandedElements(expandedElements); |
|
223 | 233 |
|
224 | 234 |
this.setDirty(false); |
225 | 235 |
} |
Also available in: Unified diff
Fix NPE for editing newly added feature nodes