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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations