use of org.jkiss.dbeaver.erd.ui.part.NodePart 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.part.NodePart 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;
}
use of org.jkiss.dbeaver.erd.ui.part.NodePart in project dbeaver by dbeaver.
the class DiagramXYLayoutPolicy method createChangeConstraintCommand.
/**
* Creates command to move table. Does not allow table to be resized
*/
@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
if (!(child instanceof NodePart))
return null;
if (!(constraint instanceof Rectangle))
return null;
NodePart nodePart = (NodePart) child;
Figure figure = (Figure) nodePart.getFigure();
Rectangle oldBounds = figure.getBounds();
Rectangle newBounds = (Rectangle) constraint;
// Restrict resize for entities
if (!ALLOW_ENTITY_RESIZE && nodePart instanceof EntityPart) {
if (oldBounds.width != newBounds.width && newBounds.width != -1)
return null;
if (oldBounds.height != newBounds.height && newBounds.height != -1)
return null;
}
return new NodeMoveCommand(nodePart, oldBounds.getCopy(), newBounds.getCopy());
}
use of org.jkiss.dbeaver.erd.ui.part.NodePart in project dbeaver by dbeaver.
the class ChangeZOrderAction method createReorderCommand.
private Command createReorderCommand(final Object[] objects) {
return new Command() {
@Override
public void execute() {
for (Object item : objects) {
if (item instanceof NodePart) {
IFigure child = ((NodePart) item).getFigure();
final IFigure parent = child.getParent();
final List children = parent.getChildren();
if (children != null) {
children.remove(child);
if (front) {
children.add(child);
} else {
children.add(0, child);
}
child.repaint();
}
// ((NodePart) item).getDiagram().
}
}
}
@Override
public boolean canUndo() {
return false;
}
};
}
use of org.jkiss.dbeaver.erd.ui.part.NodePart in project dbeaver by dbeaver.
the class EntityConnectionEditPolicy method getReconnectTargetCommand.
@Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
AssociationReconnectTargetCommand cmd = makeReconnectTargetCommand();
cmd.setRelationship((ERDAssociation) request.getConnectionEditPart().getModel());
NodePart entityPart = (NodePart) getHost();
cmd.setTargetEntity(entityPart.getElement());
return cmd;
}
Aggregations