Search in sources :

Example 1 with SetConnectionBendpointsAndLabelCommmand

use of org.yakindu.sct.ui.editor.commands.SetConnectionBendpointsAndLabelCommmand in project statecharts by Yakindu.

the class InitialPointsConnectionBendpointEditPolicy method getBendpointsChangedCommand.

@Override
protected Command getBendpointsChangedCommand(BendpointRequest request) {
    PointList originalPoints = InitialPointsOfRequestDataManager.getOriginalPoints(request);
    Command result = super.getBendpointsChangedCommand(request);
    if (result instanceof ICommandProxy) {
        ICommand iCommand = ((ICommandProxy) result).getICommand();
        if (iCommand instanceof SetConnectionBendpointsAndLabelCommmand) {
            ((SetConnectionBendpointsAndLabelCommmand) iCommand).setLabelsToUpdate((org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) getHost(), originalPoints);
        }
    }
    return result;
}
Also used : PointList(org.eclipse.draw2d.geometry.PointList) ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) ICommand(org.eclipse.gmf.runtime.common.core.command.ICommand) Command(org.eclipse.gef.commands.Command) ICommand(org.eclipse.gmf.runtime.common.core.command.ICommand) SetConnectionBendpointsAndLabelCommmand(org.yakindu.sct.ui.editor.commands.SetConnectionBendpointsAndLabelCommmand)

Example 2 with SetConnectionBendpointsAndLabelCommmand

use of org.yakindu.sct.ui.editor.commands.SetConnectionBendpointsAndLabelCommmand in project statecharts by Yakindu.

the class InitialPointsConnectionBendpointEditPolicy method getBendpointsChangedCommand.

@Override
protected Command getBendpointsChangedCommand(Connection connection, Edge edge) {
    Point ptRef1 = connection.getSourceAnchor().getReferencePoint();
    getConnection().translateToRelative(ptRef1);
    Point ptRef2 = connection.getTargetAnchor().getReferencePoint();
    getConnection().translateToRelative(ptRef2);
    TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
    SetConnectionBendpointsAndLabelCommmand sbbCommand = new SetConnectionBendpointsAndLabelCommmand(editingDomain);
    sbbCommand.setEdgeAdapter(new EObjectAdapter(edge));
    sbbCommand.setNewPointList(connection.getPoints(), ptRef1, ptRef2);
    return new ICommandProxy(sbbCommand);
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) SetConnectionBendpointsAndLabelCommmand(org.yakindu.sct.ui.editor.commands.SetConnectionBendpointsAndLabelCommmand) Point(org.eclipse.draw2d.geometry.Point) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)

Aggregations

ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)2 SetConnectionBendpointsAndLabelCommmand (org.yakindu.sct.ui.editor.commands.SetConnectionBendpointsAndLabelCommmand)2 Point (org.eclipse.draw2d.geometry.Point)1 PointList (org.eclipse.draw2d.geometry.PointList)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 Command (org.eclipse.gef.commands.Command)1 ICommand (org.eclipse.gmf.runtime.common.core.command.ICommand)1 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)1 EObjectAdapter (org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)1