Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Why edges are not persisted when nodes are? How to change it?
icon5.gif  Why edges are not persisted when nodes are? How to change it? [message #655492] Mon, 21 February 2011 07:28 Go to next message
Vitaly Savickas is currently offline Vitaly Savickas
Messages: 61
Registered: March 2010
Member
Hi everyone,

Could you please help me to understand why connections are not persisted when the diagram changes from purely canonical to semantic i.e. when nodes are becoming persisted.

I have a big problem with this as after reopening a diagram I don't see connections. This is due to the fact that connections in my case can be from top level nodes to nested nodes inside compartments and when a connection is created not all the views are available yet. But persisting everything solves this issue. Of course if someone can offer a better solution I'll be very happy.

Anyway, how to tell the editor to persist not just nodes but also edges when it starts to persist children?

Regards,
Vitaly

[Updated on: Mon, 21 February 2011 07:29]

Report message to a moderator

Re: Why edges are not persisted when nodes are? How to change it? [message #656969 is a reply to message #655492] Tue, 01 March 2011 03:34 Go to previous messageGo to next message
Thomas Buchmann is currently offline Thomas Buchmann
Messages: 53
Registered: November 2010
Member
I'm facing a very similar problem: After i initially created a graphical representation on top of an existing semantic model (by invoking the appropriate auto generated action) and moving the nodes afterwards only the nodes are persisted. Closing and reopening the diagram file causes the links to disappear from the graphical representation. Although they're still present in the semantic model.

How can this be fixed??
Re: Why edges are not persisted when nodes are? How to change it? [message #657692 is a reply to message #656969] Thu, 03 March 2011 11:24 Go to previous messageGo to next message
Michael Golubev is currently offline Michael Golubev
Messages: 373
Registered: July 2009
Senior Member
Vitaly,

First of all, you can always use PersistElementCommand / PersistViewsCommand to manually persist everything you like.

But I am not that sure that problems of missing links are related to the persisting status. And the fact that the link source is top-level element while the destination is inside the compartment, to my understanding, should not lead to what you described as "when a connection is created not all the views are available yet".

I tried to imitate the same use case with U2T Activity diagram and it works fine, with or without the edges being persisted at the time of the diagram opening.

Could you please provide more details on your diagram structure, or may be the representative parts of your generated editor.

Regards,
Michael
Re: Why edges are not persisted when nodes are? How to change it? [message #658291 is a reply to message #657692] Mon, 07 March 2011 12:43 Go to previous messageGo to next message
Vitaly Savickas is currently offline Vitaly Savickas
Messages: 61
Registered: March 2010
Member
Hi Michael,

First of all thanks for reply and apologies for my late reaction - I was out of work for a week.

Quote:
And the fact that the link source is top-level element while the destination is inside the compartment, to my understanding, should not lead to what you described as "when a connection is created not all the views are available yet".

I was thinking the same, but when debugging the thing it showed that the map of elements to notation has no views created for all elements when they are required. So what I experience is when opening a diagram connections are not shown. When I press F5 they appear.

I agree that forcing to persist everything is not a solution. I even tried it, but have problems when working with multiple diagrams based on same diagram file - they don't synchronise properly.

But what I'd like experts to explain me at first is why nodes are persisted and edges are not? I don't claim it's wrong, there must be a reason for that. I'm just thinking maybe the reason is only domain specific and in my case it can be ignored.

Regards,
Vitaly
Re: Why edges are not persisted when nodes are? How to change it? [message #658346 is a reply to message #658291] Mon, 07 March 2011 21:43 Go to previous messageGo to next message
Thomas Spall is currently offline Thomas Spall
Messages: 29
Registered: July 2009
Junior Member
Could this maybe be related to the issue linked below?

http://www.eclipse.org/forums/index.php?t=msg&goto=64823 6&S=b1bf850f8c85634002a7da5ba5893630
Re: Why edges are not persisted when nodes are? How to change it? [message #658394 is a reply to message #658346] Tue, 08 March 2011 05:45 Go to previous messageGo to next message
Vitaly Savickas is currently offline Vitaly Savickas
Messages: 61
Registered: March 2010
Member
Thomas, I'm so glad you replied!

This indeed is very very similar and the solution proposed works well! I have no idea why, as implemented methods don't even get called. I have changed the supertype only for the CanonicalPolicy of the diagram root edit part. Do you think it's necessary to do the same for the remaining edit parts?

Thanks for your help!

Regards,
Vitaly

[Updated on: Tue, 08 March 2011 05:46]

Report message to a moderator

Re: Why edges are not persisted when nodes are? How to change it? [message #658524 is a reply to message #658394] Tue, 08 March 2011 15:15 Go to previous message
Thomas Spall is currently offline Thomas Spall
Messages: 29
Registered: July 2009
Junior Member
Hi Vitaly,
glad it works for you.

> I have no idea why, as implemented methods don't even get called.
I pretty much had the same effect: it wasn't actually necessary to implement the three additional methods (I just left them blank) as they never get called. It seems that merely extending that different parent class already does the job of changing the code path somewhere to do the right thing.

> I have changed the supertype only for the CanonicalPolicy of the diagram root edit part. Do you think it's necessary to do the same for the remaining edit parts?
I would think you need to change it in every XxxCanonicalEditPolicy which you have in your diagram editor, but of course NOT for the other policies (like e.g. the SemanticEditPolicies).
Previous Topic:Custom movement with arrow keys
Next Topic:No Application is generated
Goto Forum:
  


Current Time: Fri Apr 18 10:09:19 EDT 2014

Powered by FUDForum. Page generated in 0.03774 seconds