Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Connection between nodes created in the model, don't appear in the graphical editor
Connection between nodes created in the model, don't appear in the graphical editor [message #986916] Thu, 22 November 2012 11:11 Go to next message
Spiros S is currently offline Spiros SFriend
Messages: 7
Registered: November 2012
Junior Member
Hello!
I have an issue when creating connection between some bordered nodes. These bordered nodes belong to elements that exist in different compartments.
The problem is that when I create my connection with the creation tool, it is visible and the model is updated with the new connection and its source and target properties.
But when if I close and reopen the diagram tab, then the connection is not visualized anymore although it is still in the model.
My connection has one atribute called ports with multiplicity of 2 that holds the source and target port.
I am trying to follow the path of the creation and refresh of the diagram to see what goes wrong but I have failed so far.
Any hints to where to look exactly?

I am also wondering if my meta-model makes things impossible by having source and target on the same attribute (ports[2]).
index.php/fa/12476/0/
Thanks!

[Updated on: Sun, 25 November 2012 12:15]

Report message to a moderator

Re: Connection between nodes in different compartments disappear [message #987014 is a reply to message #986916] Thu, 22 November 2012 21:19 Go to previous messageGo to next message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 73
Registered: July 2011
Member
Hi!

Do you have canonical behavior in your diagram?
Then this may be an issue with your implementation of CanonicalConnectionEditPolicy.
If one CanonicalConnectionEditPolicy does not return the semantic connection in
getSemanticConnectionList() it may think that the edge in your notation model is orphaned and deletes it. For testing, you could override shouldDeleteView() returning false and check if the edge is still deleted.

Regards,

Andreas

Re: Connection between nodes in different compartments disappear [message #987017 is a reply to message #987014] Thu, 22 November 2012 22:09 Go to previous messageGo to next message
Spiros S is currently offline Spiros SFriend
Messages: 7
Registered: November 2012
Junior Member
Thanks for the reply Andreas.

I am not entirely sure if I use CanonicalConnectionEditPolicy. I did not explicitly set it anywhere and I cannot find it if I search for it in my diagram code.
The default behaviour I have with my diagrams is that when a change is saved either in the model or the graphical representation, the other one is updated.

Another symptom of my problem is that if I create the connection directly in the model, it is not visualized either.

I still feel that my meta-model with the one attribute for both source and target is creating problems. It is not up to me to change the meta-model, but I would like to have a argument at least if I propose something like that. You think that this could be the issue?(the ports[] attribute)

Spiros
Re: Connection between nodes in different compartments disappear [message #987263 is a reply to message #987014] Sun, 25 November 2012 11:19 Go to previous message
Spiros S is currently offline Spiros SFriend
Messages: 7
Registered: November 2012
Junior Member
Andreas Muelder wrote on Thu, 22 November 2012 16:19
Hi!

Do you have canonical behavior in your diagram?
Then this may be an issue with your implementation of CanonicalConnectionEditPolicy.
If one CanonicalConnectionEditPolicy does not return the semantic connection in
getSemanticConnectionList() it may think that the edge in your notation model is orphaned and deletes it. For testing, you could override shouldDeleteView() returning false and check if the edge is still deleted.

Regards,

Andreas



I found what you said about the Canonical behaviour. My canvas element has a CanonicalEditPolicy.java file but the Link has an ItemSemanticPolicy.
Then I overridden the shouldDeleteView() in my canvas CanonicalEditPolicy to return always false and not what I create in the graphical editor stays remains there when I close and reopen it. But still, if I add a link in the model it does not get visualized in the graphical editor. And also when I delete from the model, the link stays in the graphical editor with an "X" circle on top of the link.

Then I followed the solution on this post :
http://www.eclipse.org/forums/index.php/t/204942/

and I replaced the superclass in every editpart canonical policy(not sure if needed everywhere or only in the canvas policy) from CanonicalEditPolicy to CanonicalConnectionEditPolicy and implemented the 3 needed methods(left empty as they are not called).
Now the behaviour is fine and when I delete from model they are deleted from graphical representation and vice versa.
The only problem left now is when I create in the model, they are not displayed in the graphical editor. I suppose it follows a different path.
Any ideas?
Thanks for the effort!
Spiros

[update]
I am debugging the CanonicalEditPolicy of my diagram and I see that even if I have connections in my model, the getHost().getChildren() method in the refreshOnActivate() never returns connection editparts but only node editparts. I tried to force it to return also connections so that I could activate them but I have not succeed.

[Updated on: Mon, 26 November 2012 10:23]

Report message to a moderator

Previous Topic:EEF referenced View
Next Topic:set decorators without validation
Goto Forum:
  


Current Time: Tue Apr 23 17:44:34 GMT 2024

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

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

Back to the top