Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Note gets model element after load
Note gets model element after load [message #513763] Thu, 11 February 2010 03:20
Markus Franz is currently offline Markus FranzFriend
Messages: 38
Registered: July 2009
Hi all,

i am using GMF (2.2.1) with Teneo and Hibernate. If i understand
correctly, Notes are not supposed to have a model element attached,
which makes sense as they are not corresponding to any model element. I
now have a problem (i will describe it using the well-known Mindmap examle):
When adding some Note to the diagram, everything seems to be in order
(i.e. no element is attached). The i am persisting the diagram (and the
model) via teneo and hibernate into a database. When manually connecting
to the database, i can verify, that there is no "element" feature
persisted for the Note EObject (i.e. it is correct as far as i can see).
After loading however, the Note suddenly has the Mindmap set as its
model element. This is quite bad, as if i am e.g. trying to delete the
note, i won't be able to persist/save anymore, as the Mindmap is marked
to be deleted (because of the Note) but "would be resaved by cascade"
as it obviously it is also the element of the Diagram.
The problematic piece of code is in the ViewImpl.getElement() method,
the following sets the element (if not set) to the parent's model element:

if (!isSetElement()) {
EObject container = eContainer();
if (container instanceof View) {
View view = (View) container;
element = view.getElement();

Now i wanted to know, why this makes sense (setting the "element" to the
parent's "element") and if anybody has any dea on how i could fix my

gr. Markus
Previous Topic:resize element by listening to model changes
Next Topic:removing the hover popup / bar
Goto Forum:

Current Time: Tue Apr 20 05:12:36 GMT 2021

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

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

Back to the top