Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2014-12-11 09:40:02 +0000
committerRemi Schnekenburger2014-12-11 09:45:57 +0000
commit2dfb34a31cee75ac704b640bf3608fbe9ef6fa64 (patch)
tree9ff1b78bf00418ec66c8604f0a33cf6068542af6 /plugins/uml
parent9aac4f3595a4e91dc73838f5f03f567b73e6fd2f (diff)
downloadorg.eclipse.papyrus-2dfb34a31cee75ac704b640bf3608fbe9ef6fa64.tar.gz
org.eclipse.papyrus-2dfb34a31cee75ac704b640bf3608fbe9ef6fa64.tar.xz
org.eclipse.papyrus-2dfb34a31cee75ac704b640bf3608fbe9ef6fa64.zip
454846: [Component Diagram] ClassCastException when creating a
Dependency on an existing dependency https://bugs.eclipse.org/bugs/show_bug.cgi?id=454846 Change-Id: If0a12cfb35cb3f5699f8f083d4fa34e59f8d6db0 Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/CustomGraphicalNodeEditPolicy.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/CustomGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/CustomGraphicalNodeEditPolicy.java
index 299ec6016bf..75c89cc896a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/CustomGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/CustomGraphicalNodeEditPolicy.java
@@ -68,7 +68,6 @@ public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
*/
@Override
protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request) {
- // return super.getConnectionAndRelationshipCompleteCommand(request);
// get the element descriptor
CreateElementRequestAdapter requestAdapter = request.getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
// get the semantic request
@@ -85,7 +84,12 @@ public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
source = sourceView;
}
// resolve the source parent (meaning graphical parent here)
- View sourceParentView = (View) request.getSourceEditPart().getParent().getModel();
+ Object sourceParentViewObject = request.getSourceEditPart().getParent().getModel();
+ if(!(sourceParentViewObject instanceof View)) {
+ // parent view is not a view (in case of a cretion of a Dependency on a Dependency link for example)
+ return super.getConnectionAndRelationshipCompleteCommand(request);
+ }
+ View sourceParentView = (View)sourceParentViewObject;
EObject sourceParent = ViewUtil.resolveSemanticElement(sourceParentView);
if (sourceParent == null) {
sourceParent = sourceParentView;
@@ -98,8 +102,13 @@ public class CustomGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
if (target == null) {
target = targetView;
}
- // resolve the source parent (meaning graphical parent here)
- View targetParentView = (View) request.getTargetEditPart().getParent().getModel();
+ // resolve the target parent (meaning graphical parent here)
+ Object targetParentViewObject = request.getSourceEditPart().getParent().getModel();
+ if(!(targetParentViewObject instanceof View)) {
+ // parent view is not a view (in case of a cretion of a Dependency on a Dependency link for example)
+ return super.getConnectionAndRelationshipCompleteCommand(request);
+ }
+ View targetParentView = (View)targetParentViewObject;
EObject targetParent = ViewUtil.resolveSemanticElement(targetParentView);
if (targetParent == null) {
targetParent = targetParentView;

Back to the top