Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-03-11 19:32:40 +0000
committerGerrit Code Review @ Eclipse.org2016-03-11 20:09:35 +0000
commitec4bb1c7aa4b8be21521b33ff9d6fef874ee1dbe (patch)
tree19e2c2eeff74a2a3189e675645da8678f884a60d
parent0876851843b19e9ed5d57b565daf7e43d8c3872c (diff)
downloadorg.eclipse.papyrus-ec4bb1c7aa4b8be21521b33ff9d6fef874ee1dbe.tar.gz
org.eclipse.papyrus-ec4bb1c7aa4b8be21521b33ff9d6fef874ee1dbe.tar.xz
org.eclipse.papyrus-ec4bb1c7aa4b8be21521b33ff9d6fef874ee1dbe.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.
-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