Search in sources :

Example 1 with AssociationCreateCommand

use of org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand in project dbeaver by serge-rider.

the class EntityConnectionEditPolicy method getConnectionCompleteCommand.

@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    AssociationCreateCommand cmd = (AssociationCreateCommand) request.getStartCommand();
    NodePart part = (NodePart) request.getTargetEditPart();
    cmd.setTargetEntity(part.getElement());
    return cmd;
}
Also used : AssociationCreateCommand(org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand) NodePart(org.jkiss.dbeaver.erd.ui.part.NodePart)

Example 2 with AssociationCreateCommand

use of org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand in project dbeaver by serge-rider.

the class AttributeConnectionEditPolicy method getAddCommand.

@Override
protected Command getAddCommand(GroupRequest request) {
    List srcParts = request.getEditParts();
    if (srcParts.size() != 1) {
        // Can drop only one attribute
        return null;
    }
    if (!(srcParts.get(0) instanceof AttributePart)) {
        // Not attribute
        return null;
    }
    AttributePart srcPart = (AttributePart) srcParts.get(0);
    if (srcPart.getParent() == part.getParent()) {
        // Can't drop attribute to the same parent
        return null;
    }
    AssociationCreateCommand command = new AssociationCreateCommand();
    command.setSourceEntity(srcPart.getEntity());
    command.setTargetEntity(part.getEntity());
    command.setAttributes(srcPart.getAttribute(), part.getAttribute());
    return command;
}
Also used : AttributePart(org.jkiss.dbeaver.erd.ui.part.AttributePart) AssociationCreateCommand(org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand) List(java.util.List)

Example 3 with AssociationCreateCommand

use of org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand in project dbeaver by dbeaver.

the class EntityConnectionEditPolicy method getConnectionCreateCommand.

@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    AssociationCreateCommand cmd = makeCreateCommand();
    NodePart part = (NodePart) getHost();
    cmd.setSourceEntity(part.getElement());
    request.setStartCommand(cmd);
    return cmd;
}
Also used : AssociationCreateCommand(org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand) NodePart(org.jkiss.dbeaver.erd.ui.part.NodePart)

Example 4 with AssociationCreateCommand

use of org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand in project dbeaver by dbeaver.

the class AttributeConnectionEditPolicy method getAddCommand.

@Override
protected Command getAddCommand(GroupRequest request) {
    List srcParts = request.getEditParts();
    if (srcParts.size() != 1) {
        // Can drop only one attribute
        return null;
    }
    if (!(srcParts.get(0) instanceof AttributePart)) {
        // Not attribute
        return null;
    }
    AttributePart srcPart = (AttributePart) srcParts.get(0);
    if (srcPart.getParent() == part.getParent()) {
        // Can't drop attribute to the same parent
        return null;
    }
    AssociationCreateCommand command = new AssociationCreateCommand();
    command.setSourceEntity(srcPart.getEntity());
    command.setTargetEntity(part.getEntity());
    command.setAttributes(srcPart.getAttribute(), part.getAttribute());
    return command;
}
Also used : AttributePart(org.jkiss.dbeaver.erd.ui.part.AttributePart) AssociationCreateCommand(org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand) List(java.util.List)

Example 5 with AssociationCreateCommand

use of org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand in project dbeaver by dbeaver.

the class EntityConnectionEditPolicy method getConnectionCompleteCommand.

@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    AssociationCreateCommand cmd = (AssociationCreateCommand) request.getStartCommand();
    NodePart part = (NodePart) request.getTargetEditPart();
    cmd.setTargetEntity(part.getElement());
    return cmd;
}
Also used : AssociationCreateCommand(org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand) NodePart(org.jkiss.dbeaver.erd.ui.part.NodePart)

Aggregations

AssociationCreateCommand (org.jkiss.dbeaver.erd.ui.command.AssociationCreateCommand)6 NodePart (org.jkiss.dbeaver.erd.ui.part.NodePart)4 List (java.util.List)2 AttributePart (org.jkiss.dbeaver.erd.ui.part.AttributePart)2