use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.
the class EllipseStyledBorder method getInsets.
@Override
public Insets getInsets(IFigure figure) {
Insets result = super.getInsets(figure);
Rectangle bounds = figure.getBounds();
if (bounds.width > 0 && bounds.height > 0) {
int rectWidth = (int) (bounds.width / Math.sqrt(2));
int rectHeight = (int) (bounds.height / Math.sqrt(2));
int dw = (bounds.width - rectWidth) / 2;
int dh = (bounds.height - rectHeight) / 2;
result.top += dh;
result.bottom += dh;
result.left += dw;
result.right += dw;
}
return result;
}
use of org.eclipse.draw2d.geometry.Insets in project jbosstools-hibernate by jbosstools.
the class EditableLabel method getSelectionRectangle.
private Rectangle getSelectionRectangle() {
Rectangle bounds = getTextBounds().getCopy();
bounds.expand(new Insets(2, 2, 0, 0));
translateToParent(bounds);
bounds.intersect(getBounds());
return bounds;
}
use of org.eclipse.draw2d.geometry.Insets in project statecharts by Yakindu.
the class GroupStatesIntoCompositeRefactoring method setCompositeStateLayoutConstraint.
/**
* Iterates through all {@link StateEditPart}s of the current selection and
* computes layout constraints for the composite node.
*
* @param compositeStateNode
* node of the composite state
*/
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {
Rectangle newbounds = null;
for (GraphicalEditPart editPart : getContextObjects()) {
Rectangle childBounds = editPart.getFigure().getBounds();
if (newbounds == null)
newbounds = childBounds.getCopy();
newbounds.union(childBounds);
}
newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));
Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setX(newbounds.x);
bounds.setY(newbounds.y);
bounds.setWidth(newbounds.width);
bounds.setHeight(newbounds.height);
compositeStateNode.setLayoutConstraint(bounds);
}
use of org.eclipse.draw2d.geometry.Insets in project statecharts by Yakindu.
the class XtextDirectEditManager method getCellEditorFrame.
/**
* Overridden to enlarge the cell editor frame for a control decorator
*/
protected IFigure getCellEditorFrame() {
IFigure cellEditorFrame = super.getCellEditorFrame();
cellEditorFrame.setBorder(new CompoundBorder(new MarginBorder(new Insets(0, 10, 0, 0)), BORDER_FRAME));
return cellEditorFrame;
}
Aggregations