Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » getHost method returns parent edit part
getHost method returns parent edit part [message #216083] Thu, 22 January 2009 01:57 Go to next message
Eclipse UserFriend
I am trying to create an editor with components and connections, but I
want my component to get created only when I drop (on my create request)
it on a connection. I tried to override getTargetEditPart method of
CreationEditPolilcy of my DiagramEditPart.

public EditPart getTargetEditPart(Request request) {
Object model = getHost().getModel();
if(model instanceof Connection){
return understandsRequest(request) ? getHost() : null;
}
return null;
}
But the problem is I always getHost() always returns the parent model
(DiagramImpl) instance and I never get the Connection model though I drop
the component on the Connection.

Am I missing something? Thanks for any help.

Lavanya.
Re: getHost method returns parent edit part [message #216202 is a reply to message #216083] Fri, 23 January 2009 01:15 Go to previous message
Eclipse UserFriend
Sorry for not explaining my requirement properly if it is not making sense.
I want to develop a simple editor where there are two types of elements,
components(nodes) and connections. But I don't want the components placed
anywhere on the canvas except for on the connection and component.
So my requirement is
1. Do not create a component which is placed anywhere else than connection.
2. If I drop it on connection, I want to get the target connection edit
part to reconnect the connections to the newly added component.

Hope this is clear. Can someone came across such requirement or any help
is appreciated.

Thanks
Lavanya.
Previous Topic:DirectedGraphLayout
Next Topic:OffScreenEditPartFactory
Goto Forum:
  


Current Time: Sat Jul 12 21:05:58 EDT 2025

Powered by FUDForum. Page generated in 0.45052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top