use of org.talend.designer.core.ui.editor.cmd.MoveConnTraceCommand in project tdi-studio-se by Talend.
the class ConnTextMovePolicy method getMoveCommand.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.NonResizableEditPolicy#getMoveCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
*/
public Command getMoveCommand(ChangeBoundsRequest request) {
if (((Connection) getHost().getParent().getModel()).isReadOnly()) {
return null;
}
if (getHost().getModel() instanceof ConnectionTrace) {
ConnectionTrace model = (ConnectionTrace) getHost().getModel();
Point delta = request.getMoveDelta();
ConnectionPart edge = (ConnectionPart) getHost().getParent();
MoveConnTraceCommand command = new MoveConnTraceCommand(model, (Figure) edge.getFigure(), delta);
return command;
} else if (getHost().getModel() instanceof ConnectionLabel) {
ConnectionLabel model = (ConnectionLabel) getHost().getModel();
Point delta = request.getMoveDelta();
ConnectionPart edge = (ConnectionPart) getHost().getParent();
List<Element> elements = edge.getModelChildren();
for (Element e : elements) {
if (e instanceof ConnectionResuming) {
MoveConnTextCommand command = new MoveConnTextCommand(model, (ConnectionResuming) e, (Figure) edge.getFigure(), delta);
return command;
}
}
MoveConnTextCommand command = new MoveConnTextCommand(model, null, (Figure) edge.getFigure(), delta);
return command;
}
return null;
}
Aggregations