Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2016-06-16 06:53:29 -0400
committerGerrit Code Review @ Eclipse.org2016-06-17 08:32:08 -0400
commit6a7d6f70fa43fc592fac80525a6472cb7f87f3d2 (patch)
tree33b3a3dbbe80ad387bef2f8ce1d208926ea63367
parent1b59801d998020b11758b2a2e520173549bb5e94 (diff)
downloadorg.eclipse.papyrus-6a7d6f70fa43fc592fac80525a6472cb7f87f3d2.tar.gz
org.eclipse.papyrus-6a7d6f70fa43fc592fac80525a6472cb7f87f3d2.tar.xz
org.eclipse.papyrus-6a7d6f70fa43fc592fac80525a6472cb7f87f3d2.zip
bug 496252: [Composite Diagram] NPE in BehaviorPortEditPolicy when port
is not available vie getUMLElement() - adding a check for getUMLElement() not to be null. Change-Id: I3a3f909b4907b4c43242a5131aa79fe3db99989e Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java20
1 files changed, 11 insertions, 9 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 85f6fddb10d..0ac0b7e4364 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
@@ -64,7 +64,7 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
}
public void udaptePortBehavior() {
- GraphicalEditPart parentEditPart = (GraphicalEditPart)((GraphicalEditPart) getHost()).getParent();
+ GraphicalEditPart parentEditPart = (GraphicalEditPart) ((GraphicalEditPart) getHost()).getParent();
ShapeCompartmentEditPart targetEditPart = (parentEditPart == null) ? null : getPossibleCompartment(parentEditPart);
if (targetEditPart != null) {
// remove old BehaviorPort presentation
@@ -75,16 +75,18 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
if (getHost() instanceof PortEditPart) {
IFigure hostFigure = ((PortEditPart) getHost()).getContentPane();
if (hostFigure instanceof PortFigure) {
- PortFigure port = (PortFigure) hostFigure;
-
- if (getUMLElement().isBehavior()) {
- if (parentEditPart.resolveSemanticElement() instanceof Classifier || targetEditPart != null) {
- port.restoreBehaviorFigure();
+ PortFigure portFigure = (PortFigure) hostFigure;
+ Port port = getUMLElement();
+ if (port != null) {
+ if (port.isBehavior()) {
+ if (parentEditPart.resolveSemanticElement() instanceof Classifier || targetEditPart != null) {
+ portFigure.restoreBehaviorFigure();
+ } else {
+ portFigure.removeBehavior();
+ }
} else {
- port.removeBehavior();
+ portFigure.removeBehavior();
}
- } else {
- port.removeBehavior();
}
}
}

Back to the top