Search in sources :

Example 1 with MoveConnTraceCommand

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;
}
Also used : MoveConnTextCommand(org.talend.designer.core.ui.editor.cmd.MoveConnTextCommand) Element(org.talend.core.model.process.Element) List(java.util.List) Point(org.eclipse.draw2d.geometry.Point) MoveConnTraceCommand(org.talend.designer.core.ui.editor.cmd.MoveConnTraceCommand) Figure(org.eclipse.draw2d.Figure)

Aggregations

List (java.util.List)1 Figure (org.eclipse.draw2d.Figure)1 Point (org.eclipse.draw2d.geometry.Point)1 Element (org.talend.core.model.process.Element)1 MoveConnTextCommand (org.talend.designer.core.ui.editor.cmd.MoveConnTextCommand)1 MoveConnTraceCommand (org.talend.designer.core.ui.editor.cmd.MoveConnTraceCommand)1