use of org.eclipse.gef.requests.AlignmentRequest in project statecharts by Yakindu.
the class TreeLayoutEditPolicy method getConstraintFor.
@Override
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
if (request instanceof AlignmentRequest) {
return super.getConstraintFor(request, child);
}
final Rectangle rect = (Rectangle) super.getConstraintFor(request, child);
final Rectangle cons = getCurrentConstraintFor(child);
final int newTreePosition = TreeLayoutUtil.getNewTreeNodePosition(request.getLocation(), TreeLayoutUtil.getSiblings((IGraphicalEditPart) child));
if (cons instanceof TreeLayoutConstraint) {
final TreeLayoutConstraint treeLayoutConstraint = (TreeLayoutConstraint) cons;
return new TreeLayoutConstraint(rect, treeLayoutConstraint.isRoot(), newTreePosition);
}
return new TreeLayoutConstraint(rect, false, newTreePosition);
}
use of org.eclipse.gef.requests.AlignmentRequest in project archi by archimatetool.
the class AlignmentAction method createAlignmentCommand.
private Command createAlignmentCommand() {
AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
request.setAlignmentRectangle(calculateAlignmentRectangle(request));
request.setAlignment(alignment);
List editparts = getOperationSet(request);
if (editparts.size() < 2)
return null;
CompoundCommand command = new CompoundCommand();
command.setDebugLabel(getText());
for (int i = 0; i < editparts.size(); i++) {
EditPart editpart = (EditPart) editparts.get(i);
command.add(editpart.getCommand(request));
}
return command;
}
use of org.eclipse.gef.requests.AlignmentRequest in project archi by archimatetool.
the class NonResizableEditPolicy method getAlignCommand.
/**
* Returns the command contribution to an alignment request
*
* @param request
* the alignment request
* @return the contribution to the alignment
*/
protected Command getAlignCommand(AlignmentRequest request) {
AlignmentRequest req = new AlignmentRequest(REQ_ALIGN_CHILDREN);
req.setEditParts(getHost());
req.setAlignment(request.getAlignment());
req.setAlignmentRectangle(request.getAlignmentRectangle());
return getHost().getParent().getCommand(req);
}
Aggregations