Skip to content
Snippets Groups Projects
Commit 494b4a43 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

fixed

refs 2750
parent 8fe78025
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,9 @@ package org.fortiss.tooling.base.ui.editpart.policy;
import static org.fortiss.tooling.base.ui.utils.DragAndDropBaseUtils.createConnectionDragContext;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
......@@ -81,7 +83,7 @@ import org.fortiss.tooling.base.ui.editpart.command.ReconnectCommand;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: DE2453742ED5A786A15BEFD4EA79DB53
* @ConQAT.Rating YELLOW Hash: 6756B9E77E054DDEDA7D39B5A51BD2BE
*/
public class DirectConnectionAndReconnectionEditPolicy extends GraphicalNodeEditPolicy {
......@@ -89,8 +91,10 @@ public class DirectConnectionAndReconnectionEditPolicy extends GraphicalNodeEdit
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
if(request.getStartCommand() instanceof ConnectCommand) {
Point location = new Point(request.getLocation());
((GraphicalEditPart)getHost()).getFigure().translateToRelative(location);
ConnectCommand cmd = (ConnectCommand)request.getStartCommand();
cmd.setTarget(getHost(), request.getLocation());
cmd.setTarget(getHost(), location);
return cmd;
}
return UnexecutableCommand.INSTANCE;
......@@ -99,9 +103,12 @@ public class DirectConnectionAndReconnectionEditPolicy extends GraphicalNodeEdit
/** {@inheritDoc} */
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
// Here we need to create a new point, otherwise the translation on the next line will
// *modify* the request which brings problems later on.
Point location = new Point(request.getLocation());
((GraphicalEditPart)getHost()).getFigure().translateToRelative(location);
ConnectionDragContext context =
createConnectionDragContext(getHost(), getHost(), request.getLocation(),
request.getLocation());
createConnectionDragContext(getHost(), getHost(), location, null);
ConnectCommand cmd = new ConnectCommand(context);
request.setStartCommand(cmd);
return cmd;
......
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