[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Change location on creation

Hello,

these are the possible solutions I found when working with similar problems:

1- Handling the position of the new element in the NewElementViewFactory, using layout constraint on the View:
Node node = getViewService().createNode(...)
BoundsImpl bi = (BoundsImpl) node.getLayoutConstraint();
bi.setY(5);
bi.setX(250);


2- Modifying the CreationEditPolicy installed in the EditPart in which you insert that new element. It implements this method: protected Command getCreateElementAndViewCommand(
CreateViewAndElementRequest request)


3- Listening for the notification of the new addition in the handleNotificationEvent() method of the parent EditPart

Hope this helps,

Javier.