Getting Mapped Model [message #89935] |
Fri, 05 January 2007 23:01 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
I am trying to write my own "tool" with GMF that affects elements in my
EMF model. I have created a Generic Tool, and set the class to a
subclass of a GEF tool. Now this works well, and I get the proper GEF
requests, etc...
Now when I button is pressed I need to get the EMF model element mapped
to that editpart. The edit part is correct, but getModel() returns a
NodeImpl (an GMF class) not the EMF model element I have mapped to this
edit part. Is there a way to get the EMF model element that was mapped
to a particular edit part? There must be a way since GMF is doing it
all over the place.
cheers,
ian
|
|
|
Re: Getting Mapped Model [message #89951 is a reply to message #89935] |
Sat, 06 January 2007 01:20 |
Eclipse User |
|
|
|
Originally posted by: reneschm.cs.tu-berlin.de
Hi Ian,
maybe this is what you are looking for?
/**
* Gets the semantic element associated to this editpart's view.
* @return the semantic element or <code>null</code> if the semantic
element was
* <code>null</code> or unresolvable
*/
public EObject resolveSemanticElement();
its from the IGraphicalEditPart Interface in
oeg.runtime.diagram.ui.editparts
cheers,
Rene Schmutzler
TU Berlin - Tiger Team
Ian Bull schrieb:
> I am trying to write my own "tool" with GMF that affects elements in my
> EMF model. I have created a Generic Tool, and set the class to a
> subclass of a GEF tool. Now this works well, and I get the proper GEF
> requests, etc...
>
> Now when I button is pressed I need to get the EMF model element mapped
> to that editpart. The edit part is correct, but getModel() returns a
> NodeImpl (an GMF class) not the EMF model element I have mapped to this
> edit part. Is there a way to get the EMF model element that was mapped
> to a particular edit part? There must be a way since GMF is doing it
> all over the place.
>
> cheers,
> ian
|
|
|
Re: Getting Mapped Model [message #89966 is a reply to message #89951] |
Sat, 06 January 2007 04:36 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Thanks so much!
I also found getElement on the node model.
((View)getTargetEditPart().getModel()).getElement())
Not sure what the difference is. The one you found seems to do a few
more checks.
Cheers,
Ian
Threne schmutzler wrote:
> Hi Ian,
> maybe this is what you are looking for?
> /**
> * Gets the semantic element associated to this editpart's view.
> * @return the semantic element or <code>null</code> if the semantic
> element was
> * <code>null</code> or unresolvable
> */
> public EObject resolveSemanticElement();
>
> its from the IGraphicalEditPart Interface in
> oeg.runtime.diagram.ui.editparts
>
> cheers,
>
> Rene Schmutzler
> TU Berlin - Tiger Team
>
> Ian Bull schrieb:
>> I am trying to write my own "tool" with GMF that affects elements in
>> my EMF model. I have created a Generic Tool, and set the class to a
>> subclass of a GEF tool. Now this works well, and I get the proper GEF
>> requests, etc...
>>
>> Now when I button is pressed I need to get the EMF model element
>> mapped to that editpart. The edit part is correct, but getModel()
>> returns a NodeImpl (an GMF class) not the EMF model element I have
>> mapped to this edit part. Is there a way to get the EMF model element
>> that was mapped to a particular edit part? There must be a way since
>> GMF is doing it all over the place.
>>
>> cheers,
>> ian
|
|
|
|
Powered by
FUDForum. Page generated in 0.03605 seconds