Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Accessing model classes/objects from their Graphical Elements
Accessing model classes/objects from their Graphical Elements [message #197477] Wed, 16 July 2008 17:43 Go to next message
Eclipse UserFriend
Originally posted by: wayneage.gmail.com

Hi,
I'm using GMF, and I would like to know how to access the underlying Model
class from the graphical element.
For example I have a UserEditPart object and would like to get UserImpl.
I've searched for solutions and found this
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg12739.html
but I am told I have an access restriction as follws:
The method resolveSemanticElement() from the type GraphicalEditPart is
not accessible due to restriction on required library C:\Program
Files\eclipse\plugins\org.eclipse.gmf.runtime.diagram.ui_1.1 .0.v20080610-1132.jar

I get a similar restriction when I try to use getModel()

Any help and/or feedback would be grrrreatly appriciated.

Thanks,
Wayne
Re: Accessing model classes/objects from their Graphical Elements [message #197510 is a reply to message #197477] Thu, 17 July 2008 03:14 Go to previous messageGo to next message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
Try this

Ep is user graphical editpart

View view = (View)ep.getAdapter(View.class);
EObject semantic = ViewUtil.resolveSemanticElement(view);
Re: Accessing model classes/objects from their Graphical Elements [message #197619 is a reply to message #197477] Thu, 17 July 2008 09:45 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Wayne,

Do not see any problems in using getModel() method - it is defined in org.eclipse.gef.EditPart
....

-----------------
Alex Shatalin
Re: Accessing model classes/objects from their Graphical Elements [message #197658 is a reply to message #197510] Thu, 17 July 2008 10:01 Go to previous message
Eclipse UserFriend
Originally posted by: wayneage.gmail.com

Cool that worked, thanks!
Previous Topic:value of EAttribute not updated on the canvas
Next Topic:How to make a Class and an Interface read-only?
Goto Forum:
  


Current Time: Mon May 25 06:12:50 GMT 2020

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

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

Back to the top