Skip to content
Snippets Groups Projects
Commit 35afb7c8 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

hopefully fixing this bug

refs 318
parent e3334c6c
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ public class ConnectionCommand extends Command { ...@@ -40,6 +40,7 @@ public class ConnectionCommand extends Command {
private final ConnectionDragContext context; private final ConnectionDragContext context;
/** Reused connection (if the command is used for reconnection). */ /** Reused connection (if the command is used for reconnection). */
// TODO: do we still need this attribute?
private final EObject connection; private final EObject connection;
/** Constructor. */ /** Constructor. */
...@@ -61,10 +62,12 @@ public class ConnectionCommand extends Command { ...@@ -61,10 +62,12 @@ public class ConnectionCommand extends Command {
return false; return false;
} }
if (context.getSource().getModel() instanceof EObject 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( return IConnectionCompositorService.INSTANCE.canConnect(
(EObject) context.getSource().getModel(), (EObject) context (EObject) context.getSource().getModel(), (EObject) context
.getTarget().getModel(), connection, context); .getTarget().getModel(), (EObject) context
.getSource().getParent().getModel(), context);
} }
return false; return false;
} }
...@@ -72,8 +75,9 @@ public class ConnectionCommand extends Command { ...@@ -72,8 +75,9 @@ public class ConnectionCommand extends Command {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void execute() { public void execute() {
EObject parent = (EObject) context.getSource().getParent().getModel();
IConnectionCompositorService.INSTANCE.connect((EObject) context IConnectionCompositorService.INSTANCE.connect((EObject) context
.getSource().getModel(), (EObject) context.getTarget() .getSource().getModel(), (EObject) context.getTarget()
.getModel(), connection, context); .getModel(), parent, context);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment