|
@@ -82,6 +82,8 @@ public class TransitionPriorityDecorationProvider extends AbstractDecoratorProvi
|
|
|
|
|
|
public static class PriorityDecorator extends BaseDecorator {
|
|
|
|
|
|
+ private Vertex owningElement;
|
|
|
+
|
|
|
public PriorityDecorator(IDecoratorTarget decoratorTarget) {
|
|
|
super(decoratorTarget);
|
|
|
}
|
|
@@ -101,20 +103,23 @@ public class TransitionPriorityDecorationProvider extends AbstractDecoratorProvi
|
|
|
|| !(((Transition) semanticElement).eContainer() instanceof Vertex)) {
|
|
|
return;
|
|
|
}
|
|
|
- Vertex owningElement = (Vertex) ((Transition) semanticElement).eContainer();
|
|
|
- DiagramEventBroker.getInstance(gep.getEditingDomain()).addNotificationListener(owningElement,
|
|
|
- transitionPriorityChangeListener);
|
|
|
+ if (((Transition) semanticElement).eContainer() != null) {
|
|
|
+ owningElement = (Vertex) ((Transition) semanticElement).eContainer();
|
|
|
+ DiagramEventBroker.getInstance(gep.getEditingDomain()).addNotificationListener(owningElement,
|
|
|
+ transitionPriorityChangeListener);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void deactivate() {
|
|
|
- if (!(semanticElement instanceof Transition)
|
|
|
- || !(((Transition) semanticElement).eContainer() instanceof Vertex)) {
|
|
|
+ if (!(semanticElement instanceof Transition)) {
|
|
|
return;
|
|
|
}
|
|
|
- Vertex owningElement = (Vertex) ((Transition) semanticElement).eContainer();
|
|
|
- DiagramEventBroker.getInstance(gep.getEditingDomain()).removeNotificationListener(owningElement,
|
|
|
- transitionPriorityChangeListener);
|
|
|
+ if (owningElement != null) {
|
|
|
+ DiagramEventBroker.getInstance(gep.getEditingDomain()).removeNotificationListener(owningElement,
|
|
|
+ transitionPriorityChangeListener);
|
|
|
+ owningElement = null;
|
|
|
+ }
|
|
|
super.deactivate();
|
|
|
}
|
|
|
|