Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Revol2016-09-21 07:52:34 +0000
committerPatrick Tessier2016-09-21 08:33:03 +0000
commit15471a8051a912fe6d3eb19996e07dd74aecd5b4 (patch)
tree775791f98eb626b094812e2c0f1ee51cc496f980 /plugins/infra/gmfdiag
parent05129b2045a8c0f15f5431fdabf54a567c7e0512 (diff)
downloadorg.eclipse.papyrus-15471a8051a912fe6d3eb19996e07dd74aecd5b4.tar.gz
org.eclipse.papyrus-15471a8051a912fe6d3eb19996e07dd74aecd5b4.tar.xz
org.eclipse.papyrus-15471a8051a912fe6d3eb19996e07dd74aecd5b4.zip
Bug 476628 - [All Diagrams] CreateRelationshipRequest of type
"connection start" should provide source view Fixed NPE exception Change-Id: I23557f907bdf44da821129f401ba5e9f816679a7 Signed-off-by: Sebastien Revol <sebastien.revol@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultGraphicalNodeEditPolicy.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultGraphicalNodeEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultGraphicalNodeEditPolicy.java
index d807c9c2ba0..a8c43cb80a3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultGraphicalNodeEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/DefaultGraphicalNodeEditPolicy.java
@@ -110,10 +110,18 @@ public class DefaultGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
protected Command getConnectionAndRelationshipCreateCommand(CreateConnectionViewAndElementRequest request) {
// Add parameter (source view to the CreateRelationshipRequest)
CreateElementRequestAdapter requestAdapter = request.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
- CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
-
- View sourceView = (View) request.getTargetEditPart().getModel();
- createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW, sourceView);
+ if (requestAdapter != null){
+ CreateRelationshipRequest createElementRequest = (CreateRelationshipRequest) requestAdapter.getAdapter(CreateRelationshipRequest.class);
+
+ if (createElementRequest != null && request.getTargetEditPart()!= null){
+ View sourceView = (View) request.getTargetEditPart().getModel();
+ if( sourceView != null){
+ createElementRequest.setParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW, sourceView);
+ }
+ }
+
+ }
+
return super.getConnectionAndRelationshipCreateCommand(request);
}

Back to the top