[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: External label closer to object

Hello Rob,

in the Circle's Edit Part (some BorderedShapeEditPart) alter the following
method:

protected void addBorderItem(IFigure borderItemContainer,
                IBorderItemEditPart borderItemEditPart) {
        if (borderItemEditPart instanceof CircleNameEditPart) {
                BorderItemLocator locator = new BorderItemLocator(getMainFigure(),
                                PositionConstants.SOUTH);
                locator.setBorderItemOffset(new Dimension(-10, -10)); //<-- THIS LINE
                borderItemContainer.add(borderItemEditPart.getFigure(), locator);
        } else {
                super.addBorderItem(borderItemContainer, borderItemEditPart);
        }
}

Regards,
Tobias


Rob Wieringa wrote:
> Hi,
> 
> I've made a Rectange Figure with XY layout, 10x10 pixels containing a
> circle, and a corresponding external Label.
> When the figure is displayed, the label cannot be moved closer than about
> 20 pixels.
> I think this in new in GMF 2.0; when I look at the Resource picture in the
> mindmap tutorial, the distance looks OK. After loading the example, and
> migrating it to 2.0, the distance is too large.
> 
> Is there a solution that allows me to have the label external (and so
> movable), but close to the circle (5 pixels would be OK).
> 
> kind regards,
> Rob Wieringa