Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Getting underlying model element for Edge view
Getting underlying model element for Edge view [message #159292] Fri, 09 November 2007 09:31 Go to next message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

The pattern we generally use when getting the underlying model element is
View.getElement(). This works fine when the view is of type Node but when
the view is of type Edge this returns null. What is the pattern for
calculating this value in the case of edges?

Thanks,

James
Re: Getting underlying model element for Edge view [message #159308 is a reply to message #159292] Fri, 09 November 2007 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Hello James,

> but when the view is of type Edge this returns null. What is the
> pattern for calculating this value in the case of edges?
edge.getElement() return null only for reference-based links. This means
- there is no underlying domain model element for such link. You can use
source/end + getType() to identify this link.

-----------------
Alex Shatalin
Re: Getting underlying model element for Edge view [message #159316 is a reply to message #159308] Fri, 09 November 2007 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

Hi Alex,

Thanks. I'm still not sure how to calculate the "link/s" and the values
underlying an edge? I can navigate to the source/target view node of an
edge from which I can calculate either the underlying type using
getType(), or the underlying value using getElement() from which I can
navigate the structural feature values of the Node view. But how can I
determine which values are rendered by the Edge view?

James
Re: Getting underlying model element for Edge view [message #159331 is a reply to message #159316] Fri, 09 November 2007 11:18 Go to previous message
Eclipse UserFriend
Hello James,

> how can I determine which values are rendered by the Edge view?
You can call edge.getType() and compare this type with the type of the edges
you have in your project. Ie if (String.valueOf(<generatedEdgePrefix>EditPart.VISUAL_ID).equals(edge.getType()))
then you can ask source for the corresponding feature and get an entry with
the corresponding target..

-----------------
Alex Shatalin
Previous Topic:multivalued PropertySection extension
Next Topic:Re-orient connection
Goto Forum:
  


Current Time: Sun Jul 13 11:42:44 EDT 2025

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

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

Back to the top