Search in sources :

Example 1 with ReconnectConnectionCommand

use of org.knime.workbench.editor2.commands.ReconnectConnectionCommand in project knime-core by knime.

the class PortGraphicalRoleEditPolicy method getReconnectTargetCommand.

/**
 * {@inheritDoc}
 */
@Override
protected Command getReconnectTargetCommand(final ReconnectRequest req) {
    // only connect to inports
    if (!(getHost() instanceof NodeInPortEditPart || getHost() instanceof WorkflowOutPortEditPart)) {
        return null;
    }
    // get new target in port
    AbstractPortEditPart target = (AbstractPortEditPart) req.getTarget();
    ReconnectConnectionCommand reconnectCmd = new ReconnectConnectionCommand((ConnectionContainerEditPart) req.getConnectionEditPart(), (AbstractPortEditPart) req.getConnectionEditPart().getSource(), target);
    return reconnectCmd;
}
Also used : ReconnectConnectionCommand(org.knime.workbench.editor2.commands.ReconnectConnectionCommand) AbstractPortEditPart(org.knime.workbench.editor2.editparts.AbstractPortEditPart) WorkflowOutPortEditPart(org.knime.workbench.editor2.editparts.WorkflowOutPortEditPart) NodeInPortEditPart(org.knime.workbench.editor2.editparts.NodeInPortEditPart)

Aggregations

ReconnectConnectionCommand (org.knime.workbench.editor2.commands.ReconnectConnectionCommand)1 AbstractPortEditPart (org.knime.workbench.editor2.editparts.AbstractPortEditPart)1 NodeInPortEditPart (org.knime.workbench.editor2.editparts.NodeInPortEditPart)1 WorkflowOutPortEditPart (org.knime.workbench.editor2.editparts.WorkflowOutPortEditPart)1