Replies: 13 comments
-
Hi, unfortunately I'm not able to reproduce this issue. For me bidirectional references are always reliably saved and there no unintended edges in the annotation file. I had a quick look at your code as well and theoretically this should work just fine and the first reference defined in the .ecore should be used. Maybe you have some instructions for me on how to reproduce this? |
Beta Was this translation helpful? Give feedback.
-
[Jonas Ebel] Hey Tobias I could recreate this with the following steps:
|
Beta Was this translation helpful? Give feedback.
-
[Jonas Ebel] Hey @tortmayr have you been able to recreate this issue? |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I'm still not able to recreate this. The only way I was able to achieve a (somewhat) similar result was by deleting a bireference and recreating it. However this is probably caused by eclipsesource/ecore-glsp#71 |
Beta Was this translation helpful? Give feedback.
-
You could try to sort the collection of references in the GModelFactory before creating the corresponding GEdge. |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Ok so we were able to solve this problem. The enotation always generated 2 elements, when the SourceClass was created after the TargetClass, since the ModelIndex finds the Nodes that are at the top of the enotation earlier than the ones at the bottom. To fix this we made it so the edges are always created from the 'older' to the 'newer' Node.
Is this an acceptable solution or is this technically wrong because the edges were originally created the other way around by the user? Graphically this is not visible only in the enotation. |
Beta Was this translation helpful? Give feedback.
-
@eneufeld @camille-letavernier what do you think about this? |
Beta Was this translation helpful? Give feedback.
-
Stable UUIDs would provide more reliable/deterministic IDs and wouldn't require relying on positions or undeterministic values. Unfortunately, Ecore doesn't use UUIDs by default, and we can't enforce them either (Otherwise we would partially lose compatibility with external Ecore models). |
Beta Was this translation helpful? Give feedback.
-
Then we could have a much more explicitly relationship between Notation Elements (1 Edge + 2 Labels) and the corresponding EReferences (Source and Target, corresponding to each Label in the notation model) |
Beta Was this translation helpful? Give feedback.
-
And then positions/ids wouldn't matter anymore (Worst case would be: if the reference is renamed in the Ecore file outside of the Diagram Editor, the notation would reference an element that no longer exists; but we could clean it up & generate a new valid edge. We'd just lose serialized positions for that specific edge) |
Beta Was this translation helpful? Give feedback.
-
But... That's not the way it is, and this requires significant changes to the persisted enotation... So, I'm fine with position-based workarounds :) |
Beta Was this translation helpful? Give feedback.
-
They're certainly more stable/reliable than hashcodes and Ecore URI Fragments |
Beta Was this translation helpful? Give feedback.
-
(In terms of code though, that loop is quite expensive and can easily be optimized: moving |
Beta Was this translation helpful? Give feedback.
-
We are currently working on integrating the bidirectional feature into the persistence of the edge's layout.
The problem with the bidirectional feature is, that we render only one of the
eReferences
as aGEdge
. The GmodelFactory decides, based on a set of the eReference's hashCode, which object should be rendered and which one not. I have not found a better way to decide which eReference to take. This approach is similar to the Eclipse's Ecore Editor.The problem now is that when the index object is newly created, and bidirecitonal Reference exists between Class A and B, sometimes the Reference A->B is used and sometime B->A. Now when the Edges are persisted on save, there might be two different Edges in the Enotation File.
The question is how the edge can be reliably saved to the enotations. (And how we can assure to always use the same Edge.
The above mentioned features are already merged on the branch of our fork at review/sprintChristmas
original thread by Jonas Ebel
Beta Was this translation helpful? Give feedback.
All reactions