Search in sources :

Example 1 with LabelLocator

use of org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator in project tdi-studio-se by Talend.

the class BusinessExtNodeLabelEditPart method refreshBounds.

/**
     * @generated
     */
public void refreshBounds() {
    IFigure refFigure = ((GraphicalEditPart) getParent()).getFigure();
    int dx = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
    int dy = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
    Point offset = new Point(dx, dy);
    getFigure().getParent().setConstraint(getFigure(), new LabelLocator(refFigure, offset, getKeyPoint()) {

        public void relocate(IFigure target) {
            Point location = getReferencePoint().getTranslated(getOffset());
            location.translate(-target.getBounds().width / 2, 0);
            target.setLocation(location);
            target.setSize(new Dimension(target.getPreferredSize().width, target.getPreferredSize().height));
        }

        protected Point getReferencePoint() {
            return getLabelLocation(parent);
        }
    });
}
Also used : LabelLocator(org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator) Point(org.eclipse.draw2d.geometry.Point) Dimension(org.eclipse.draw2d.geometry.Dimension) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Point (org.eclipse.draw2d.geometry.Point)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 LabelLocator (org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator)1