Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-03-11 19:32:40 +0000
committerChristian W. Damus2016-03-11 20:10:06 +0000
commit7f74f3419f36897b0a6c5f708dd7b2436eb55622 (patch)
treec4b14feaa3786c2273b26827453bf37fb41f2deb
parent8d7be4c75fa024082c667df079fcbec112abfb87 (diff)
downloadorg.eclipse.papyrus-7f74f3419f36897b0a6c5f708dd7b2436eb55622.tar.gz
org.eclipse.papyrus-7f74f3419f36897b0a6c5f708dd7b2436eb55622.tar.xz
org.eclipse.papyrus-7f74f3419f36897b0a6c5f708dd7b2436eb55622.zip
Bug 489457: [Composite Diagram] NPE in BehaviorPortEditPolicy when port deleted
https://bugs.eclipse.org/bugs/show_bug.cgi?id=489457 Ensure that the edit-policy doesn't react to changes after its host edit-part is deactivated. (cherry picked from commit ec4bb1c7aa4b8be21521b33ff9d6fef874ee1dbe on Mars maintenance) Change-Id: I5bd9ee21a4f2d7a24690cab9370e4b33e609c4ab
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
index 120fdb5b38e..85f6fddb10d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2014 CEA LIST and others.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Patrick Tessier (CEA LIST) - Initial API and implementation
* Christian W. Damus (CEA) - bug 323802
+ * Christian W. Damus - bug 489457
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
@@ -54,14 +55,17 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
@Override
public void notifyChanged(Notification notification) {
- if (UMLPackage.eINSTANCE.getPort_IsBehavior().equals(notification.getFeature())) {
+ // Don't react to notifications for unvisualized ports
+ if (UMLPackage.eINSTANCE.getPort_IsBehavior().equals(notification.getFeature())
+ && getHost().isActive()) {
+
udaptePortBehavior();
}
}
public void udaptePortBehavior() {
GraphicalEditPart parentEditPart = (GraphicalEditPart)((GraphicalEditPart) getHost()).getParent();
- ShapeCompartmentEditPart targetEditPart = getPossibleCompartment(parentEditPart);
+ ShapeCompartmentEditPart targetEditPart = (parentEditPart == null) ? null : getPossibleCompartment(parentEditPart);
if (targetEditPart != null) {
// remove old BehaviorPort presentation
View behaviorPort = getBehaviorPortNode();

Back to the top