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 98880661f316e0f38c1fc05a5a7fc1df6b19879b..097523ba5840bab350a184efc217502615912d67 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); } }