Search in sources :

Example 36 with Insets

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;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 37 with Insets

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;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 38 with Insets

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);
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Bounds(org.eclipse.gmf.runtime.notation.Bounds) Rectangle(org.eclipse.draw2d.geometry.Rectangle) GraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 39 with Insets

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;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) MarginBorder(org.eclipse.draw2d.MarginBorder) CompoundBorder(org.eclipse.draw2d.CompoundBorder) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Insets (org.eclipse.draw2d.geometry.Insets)39 Rectangle (org.eclipse.draw2d.geometry.Rectangle)17 Dimension (org.eclipse.draw2d.geometry.Dimension)14 IFigure (org.eclipse.draw2d.IFigure)10 Graphics (org.eclipse.draw2d.Graphics)5 List (java.util.List)4 AbstractBorder (org.eclipse.draw2d.AbstractBorder)4 MarginBorder (org.eclipse.draw2d.MarginBorder)3 PrintDialog (org.eclipse.swt.printing.PrintDialog)3 Printer (org.eclipse.swt.printing.Printer)3 PrinterData (org.eclipse.swt.printing.PrinterData)3 ExtendedViewportAutoexposeHelper (com.archimatetool.editor.diagram.util.ExtendedViewportAutoexposeHelper)2 Border (org.eclipse.draw2d.Border)2 PrintFigureOperation (org.eclipse.draw2d.PrintFigureOperation)2 Node (org.eclipse.draw2d.graph.Node)2 RootEditPart (org.eclipse.gef.RootEditPart)2 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 EntityPart (org.jkiss.dbeaver.ext.erd.part.EntityPart)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1