Bug 423864: OperationRecorder should only clear allocated caches if
command is not runnin
diff --git a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/impl/OperationRecorder.java b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/impl/OperationRecorder.java
index 92f6e5c..bd69e0a 100644
--- a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/impl/OperationRecorder.java
+++ b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/impl/OperationRecorder.java
@@ -661,13 +661,7 @@
final CreateDeleteOperation deleteOperation = OperationsFactory.eINSTANCE.createCreateDeleteOperation();
deleteOperation.setClientDate(new Date());
deleteOperation.setModelElement(copiedElement);
-
- if (!commandIsRunning) {
- deleteOperation.setModelElementId(collection.getDeletedModelElementId(deletedElement));
- } else {
- deleteOperation
- .setModelElementId(ModelUtil.clone(removedElementsCache.getRemovedElementId(deletedElement)));
- }
+ deleteOperation.setModelElementId(getDeletedModelElementId(deletedElement));
// sync IDs into Map
for (int i = 0; i < allContainedModelElements.size(); i++) {
@@ -693,6 +687,13 @@
}
}
+ private ModelElementId getDeletedModelElementId(EObject deletedElement) {
+ if (!commandIsRunning) {
+ return collection.getDeletedModelElementId(deletedElement);
+ }
+ return ModelUtil.clone(removedElementsCache.getRemovedElementId(deletedElement));
+ }
+
@SuppressWarnings("unchecked")
private List<ReferenceOperation> extractReferenceOperationsForDelete(EObject deletedElement,
List<CompositeOperation> compositeOperationsToDelete) {
@@ -991,7 +992,7 @@
}
private void clearAllocatedCaches(ESLocalProject project) {
- if (((ESLocalProjectImpl) project).toInternalAPI().getProject().equals(collection)) {
+ if (((ESLocalProjectImpl) project).toInternalAPI().getProject().equals(collection) && !commandIsRunning) {
collection.clearAllocatedCaches();
}
}