[513200] Tweaking code for StateMachine::isRedefinitionContextValid.
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java
index cbeb322..96387b9 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java
@@ -402,9 +402,14 @@
if (redefinedElement instanceof StateMachine) {
BehavioredClassifier context = stateMachine.getContext();
+ BehavioredClassifier parentContext = ((StateMachine) redefinedElement)
+ .getContext();
- return context != null && context.allParents()
- .contains(((StateMachine) redefinedElement).getContext());
+ return context == null
+ ? parentContext == null
+ && stateMachine.allParents().contains(redefinedElement)
+ : parentContext != null
+ && context.allParents().contains(parentContext);
}
return false;