Removing concurrent delete
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.instancediagram.diagram/src/org/eclipse/tigerstripe/workbench/ui/instancediagram/diagram/edit/policies/InstanceMapCanonicalEditPolicy.java b/plugins/org.eclipse.tigerstripe.workbench.ui.instancediagram.diagram/src/org/eclipse/tigerstripe/workbench/ui/instancediagram/diagram/edit/policies/InstanceMapCanonicalEditPolicy.java
index fef31f2..6b98880 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.instancediagram.diagram/src/org/eclipse/tigerstripe/workbench/ui/instancediagram/diagram/edit/policies/InstanceMapCanonicalEditPolicy.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.instancediagram.diagram/src/org/eclipse/tigerstripe/workbench/ui/instancediagram/diagram/edit/policies/InstanceMapCanonicalEditPolicy.java
@@ -542,26 +542,28 @@
// Class instance, so need to remove the other Association from the
// model
InstanceMap map = (InstanceMap) event.getNotifier();
- EList assocInstances = map.getAssociationInstances();
- for (Object obj : assocInstances) {
- AssociationInstance newInstance = (AssociationInstance) obj;
- if (newInstance != assocInstance) {
- String newInstanceName = newInstance.getArtifactName();
- if (otherAssocInstanceName.equals(newInstance
+ EList<AssociationInstance> assocInstances = map
+ .getAssociationInstances();
+ AssociationInstance[] assocIArray = (AssociationInstance[]) assocInstances
+ .toArray(new AssociationInstance[assocInstances.size()]);
+ for (AssociationInstance instance : assocIArray) {
+ if (instance != assocInstance) {
+ if (otherAssocInstanceName.equals(instance
.getArtifactName())) {
// have found the other association instance that is
// linked to this
// association instance by artifact name (they are both
// part of the
// same association class artifact)
- map.getAssociationInstances().remove(newInstance);
+ map.getAssociationInstances().remove(instance);
break;
}
}
}
- EList classInstances = map.getClassInstances();
- for (Object obj : classInstances) {
- ClassInstance classInstance = (ClassInstance) obj;
+ EList<ClassInstance> classInstances = map.getClassInstances();
+ ClassInstance[] classIArray = (ClassInstance[]) classInstances
+ .toArray(new ClassInstance[classInstances.size()]);
+ for (ClassInstance classInstance : classIArray) {
if (classInstance.isAssociationClassInstance()
&& classInstance.getArtifactName().equals(
classInstanceName)) {