Search in sources :

Example 1 with ConnectionReconnectCommand

use of org.csstudio.opibuilder.commands.ConnectionReconnectCommand in project yamcs-studio by yamcs.

the class WidgetNodeEditPolicy method getReconnectTargetCommand.

@Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
    var connection = (ConnectionModel) request.getConnectionEditPart().getModel();
    var newTarget = getWidgetEditPart().getWidgetModel();
    var anchor = getWidgetEditPart().getTargetConnectionAnchor(request);
    var newTerminal = getWidgetEditPart().getTerminalNameFromAnchor(anchor);
    var cmd = new ConnectionReconnectCommand(connection);
    cmd.setNewTarget(newTarget);
    cmd.setNewTargetTerminal(newTerminal);
    // clear point list
    return cmd.chain(new SetWidgetPropertyCommand(connection, ConnectionModel.PROP_POINTS, new PointList()));
}
Also used : SetWidgetPropertyCommand(org.csstudio.opibuilder.commands.SetWidgetPropertyCommand) PointList(org.eclipse.draw2d.geometry.PointList) ConnectionModel(org.csstudio.opibuilder.model.ConnectionModel) ConnectionReconnectCommand(org.csstudio.opibuilder.commands.ConnectionReconnectCommand)

Example 2 with ConnectionReconnectCommand

use of org.csstudio.opibuilder.commands.ConnectionReconnectCommand in project yamcs-studio by yamcs.

the class WidgetNodeEditPolicy method getReconnectSourceCommand.

@Override
protected Command getReconnectSourceCommand(ReconnectRequest request) {
    var connection = (ConnectionModel) request.getConnectionEditPart().getModel();
    var newSource = getWidgetEditPart().getWidgetModel();
    var anchor = getWidgetEditPart().getTargetConnectionAnchor(request);
    var newTerminal = getWidgetEditPart().getTerminalNameFromAnchor(anchor);
    var cmd = new ConnectionReconnectCommand(connection);
    cmd.setNewSource(newSource);
    cmd.setNewSourceTerminal(newTerminal);
    // clear point list
    return cmd.chain(new SetWidgetPropertyCommand(connection, ConnectionModel.PROP_POINTS, new PointList()));
}
Also used : SetWidgetPropertyCommand(org.csstudio.opibuilder.commands.SetWidgetPropertyCommand) PointList(org.eclipse.draw2d.geometry.PointList) ConnectionModel(org.csstudio.opibuilder.model.ConnectionModel) ConnectionReconnectCommand(org.csstudio.opibuilder.commands.ConnectionReconnectCommand)

Aggregations

ConnectionReconnectCommand (org.csstudio.opibuilder.commands.ConnectionReconnectCommand)2 SetWidgetPropertyCommand (org.csstudio.opibuilder.commands.SetWidgetPropertyCommand)2 ConnectionModel (org.csstudio.opibuilder.model.ConnectionModel)2 PointList (org.eclipse.draw2d.geometry.PointList)2