From 35afb7c885ce9d8cf8585b69f70581e8826934b8 Mon Sep 17 00:00:00 2001
From: Daniel Ratiu <ratiu@fortiss.org>
Date: Wed, 23 Nov 2011 11:15:37 +0000
Subject: [PATCH] hopefully fixing this bug refs 318

---
 .../tooling/base/ui/command/ConnectionCommand.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/command/ConnectionCommand.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/command/ConnectionCommand.java
index 98880661f..097523ba5 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/command/ConnectionCommand.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/command/ConnectionCommand.java
@@ -40,6 +40,7 @@ public class ConnectionCommand extends Command {
 	private final ConnectionDragContext context;
 
 	/** Reused connection (if the command is used for reconnection). */
+	// TODO: do we still need this attribute?
 	private final EObject connection;
 
 	/** Constructor. */
@@ -61,10 +62,12 @@ public class ConnectionCommand extends Command {
 			return false;
 		}
 		if (context.getSource().getModel() instanceof EObject
-				&& context.getTarget().getModel() instanceof EObject) {
+				&& context.getTarget().getModel() instanceof EObject
+				&& context.getSource().getParent().getModel() instanceof EObject) {
 			return IConnectionCompositorService.INSTANCE.canConnect(
 					(EObject) context.getSource().getModel(), (EObject) context
-							.getTarget().getModel(), connection, context);
+							.getTarget().getModel(), (EObject) context
+							.getSource().getParent().getModel(), context);
 		}
 		return false;
 	}
@@ -72,8 +75,9 @@ public class ConnectionCommand extends Command {
 	/** {@inheritDoc} */
 	@Override
 	public void execute() {
+		EObject parent = (EObject) context.getSource().getParent().getModel();
 		IConnectionCompositorService.INSTANCE.connect((EObject) context
 				.getSource().getModel(), (EObject) context.getTarget()
-				.getModel(), connection, context);
+				.getModel(), parent, context);
 	}
 }
-- 
GitLab