use of org.eclipse.gef.GraphicalEditPart in project yamcs-studio by yamcs.
the class ArrayLayoutEditPolicy method getResizeChildrenCommand.
/**
*The behavior of resizing children in an array will be determined by its editpart.
*
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#
* getResizeChildrenCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
*/
@Override
protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
if (request.getType().equals(REQ_MOVE_CHILDREN) || request.getType().equals(REQ_ALIGN_CHILDREN)) {
return null;
}
CompoundCommand resize = new CompoundCommand();
Command c;
List<?> children = getHostArrayEditPart().getChildren();
GraphicalEditPart child = (GraphicalEditPart) request.getEditParts().get(0);
Object contraint = translateToModelConstraint(getConstraintForResize(request, child));
c = createChangeConstraintCommand(request, (EditPart) children.get(0), contraint);
resize.add(c);
return resize.unwrap();
}
use of org.eclipse.gef.GraphicalEditPart in project yamcs-studio by yamcs.
the class ArrayLayoutEditPolicy method getAddCommand.
/* Override super method because array widget only allows adding one child.
* (non-Javadoc)
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#getAddCommand(org.eclipse.gef.Request)
*/
@Override
protected Command getAddCommand(Request generic) {
ChangeBoundsRequest request = (ChangeBoundsRequest) generic;
List<?> editParts = request.getEditParts();
CompoundCommand command = new CompoundCommand();
// $NON-NLS-1$
command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");
GraphicalEditPart child;
if (editParts.size() > 0) {
child = (GraphicalEditPart) editParts.get(0);
command.add(createAddCommand(request, child, translateToModelConstraint(getConstraintFor(request, child))));
}
return command.unwrap();
}
use of org.eclipse.gef.GraphicalEditPart in project yamcs-studio by yamcs.
the class AbstractBaseEditPart method doRefreshVisuals.
/**
* Resizes the figure. Use {@link AbstractBaseEditPart} to implement more complex refreshing behavior.
*
* @param refreshableFigure
* the figure
*/
protected synchronized void doRefreshVisuals(final IFigure refreshableFigure) {
super.refreshVisuals();
AbstractWidgetModel model = getWidgetModel();
GraphicalEditPart parent = (GraphicalEditPart) getParent();
if (parent != null) {
parent.setLayoutConstraint(this, refreshableFigure, new Rectangle(model.getLocation(), model.getSize()));
}
}
Aggregations