org.eclipse.gef.requests.AlignmentRequest Java Examples

The following examples show how to use org.eclipse.gef.requests.AlignmentRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ERDiagramAlignmentAction.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private Command createAlignmentCommand() {
    final AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
    request.setAlignmentRectangle(calculateAlignmentRectangle(request));
    request.setAlignment(alignment);
    final List editparts = getOperationSet(request);
    if (editparts.size() < 2)
        return null;

    final CompoundCommand command = new CompoundCommand();
    command.setDebugLabel(getText());
    for (int i = 0; i < editparts.size(); i++) {
        final EditPart editpart = (EditPart) editparts.get(i);
        command.add(editpart.getCommand(request));
    }
    return command;
}
 
Example #2
Source File: TreeLayoutEditPolicy.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@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);
}
 
Example #3
Source File: ERDiagramAlignmentAction.java    From erflute with Apache License 2.0 6 votes vote down vote up
private Command createAlignmentCommand() {
    final AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
    request.setAlignmentRectangle(calculateAlignmentRectangle(request));
    request.setAlignment(alignment);
    final List<?> editparts = getOperationSet(request);
    if (editparts.size() < 2)
        return null;

    final CompoundCommand command = new CompoundCommand();
    command.setDebugLabel(getText());
    for (int i = 0; i < editparts.size(); i++) {
        final EditPart editpart = (EditPart) editparts.get(i);
        command.add(editpart.getCommand(request));
    }
    return command;
}
 
Example #4
Source File: ERDiagramAlignmentAction.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
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;
}