Home » Modeling » GMF (Graphical Modeling Framework) » Diagram partitioning serialization oddities
Diagram partitioning serialization oddities [message #166713] |
Thu, 03 January 2008 08:38  |
Eclipse User |
|
|
|
Hi
My diagram partitioning basically works alright, but I discovered a problem.
I create my diagrams from some DSL and the initial diagram contains only nodes that can be double-clicked to open
sub-diagrams. The serialized diagram XML code looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml"
xmi:id="_mFwX0LlAEdydmZOsfHfFWA" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
<styles xmi:type="notation:DiagramStyle" xmi:id="_mFwX0blAEdydmZOsfHfFWA"/>
<element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
</notation:Diagram>
As can be seen, the nodes that represent the children of the root element "ThetaML" are not serialized. What could cause
that? The semantic children are - of course - present in the corresponding model XML (I use separate files for domain
model and diagram notation).
Now, if I open one of the nodes, a sub-diagram is opened in a new editor and added to the XML. That's fine, however, the
first editor (for the root diagram) now shows up to be dirty. Why is that? So I did a little research...
If I focus the root editor, it asks whether I want to load the changes made on the file system.
That shouldn't happen, as it completely confuses the user.
If I say yes, another problem shows up: If I now double-click the same node as before again, GMF doesn't switch to the
already open editor, but opens a completely new sub-diagram, which is - of course - a copy of the first sub-diagram.
The XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml">
<notation:Diagram xmi:id="_mFwX0LlAEdydmZOsfHfFWA" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
<styles xmi:type="notation:DiagramStyle" xmi:id="_mFwX0blAEdydmZOsfHfFWA"/>
<element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
</notation:Diagram>
<notation:Diagram xmi:id="_y8MewLlAEdydmZOsfHfFWA" type="ThetaML" measurementUnit="Pixel">
<styles xmi:type="notation:DiagramStyle" xmi:id="_y8MewblAEdydmZOsfHfFWA"/>
<element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
</notation:Diagram>
</xmi:XMI>
The XML has changed, now that the second diagram is also serialized. So that explains why the editor is dirty. But
still, shouldn't GMF suppress that? If not, how could I suppress that manually?
Now, if I move any of the nodes in the root diagram by even just one pixel and then save it (before opening any
sub-diagram), the behavior changes and GMF does the correct thing. Meaning: the children nodes get serialized in the
diagram notation, double-clicking always opens the same sub-diagram without duplicating, and the root diagram editor
never gets dirty.
The XML for completeness:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml">
<notation:Diagram xmi:id="_JEjqw7lGEdy45ZMZ1nBdRg" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_JJ2acLlGEdy45ZMZ1nBdRg" type="1001">
<children xmi:type="notation:Node" xmi:id="_JJ2adLlGEdy45ZMZ1nBdRg" type="4001"/>
<styles xmi:type="notation:ShapeStyle" xmi:id="_JJ2acblGEdy45ZMZ1nBdRg"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_JJ2acrlGEdy45ZMZ1nBdRg"
diagramLink="_TJZMwLlGEdy45ZMZ1nBdRg"/>
<element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_JJ2ac7lGEdy45ZMZ1nBdRg" x="48" y="36"/>
</children>
<children xmi:type="notation:Node" xmi:id="_JJ2adblGEdy45ZMZ1nBdRg" type="1001">
<children xmi:type="notation:Node" xmi:id="_JJ2aeblGEdy45ZMZ1nBdRg" type="4001"/>
<styles xmi:type="notation:ShapeStyle" xmi:id="_JJ2adrlGEdy45ZMZ1nBdRg"/>
<styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_JJ2ad7lGEdy45ZMZ1nBdRg"/>
<element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.1"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_JJ2aeLlGEdy45ZMZ1nBdRg" x="259" y="36"/>
</children>
...
more children nodes
...
<styles xmi:type="notation:DiagramStyle" xmi:id="_JEjqxLlGEdy45ZMZ1nBdRg"/>
<element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
</notation:Diagram>
<notation:Diagram xmi:id="_TJZMwLlGEdy45ZMZ1nBdRg" type="ThetaML" measurementUnit="Pixel">
<styles xmi:type="notation:DiagramStyle" xmi:id="_TJZMwblGEdy45ZMZ1nBdRg"/>
<element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
</notation:Diagram>
</xmi:XMI>
(This one has already one sub-diagram open, but before opening it looks practically the same.)
Could some GMF guru please shed some light onto this?
Many people use diagram partitioning in one form or another, so I wonder whether other people have seen this bugger before?
Thanks for your attention if you read this post til here ;)
Norbert Schoepke
|
|
| |
Re: Diagram partitioning serialization oddities [message #166899 is a reply to message #166713] |
Fri, 04 January 2008 09:29   |
Eclipse User |
|
|
|
Hi Norbert,
I also have to cope with some of the problems you mentioned.
For example one has to enforce that the main model gets saved once
before a sub editor is opened.
> If I focus the root editor, it asks whether I want to load the changes
made on the file system.
> That shouldn't happen, as it completely confuses the user.
This results from different editing domains, read this topic for more
information:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg09047.html
You might have a look at this bug targeted for 2.1 which relates to
this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=172480
If you want to try out my intermediate results for diagram partitioning
you may visit http://modulestudio.de/ and download the preview version.
Greetings,
Axel
Norbert Schöpke schrieb:
> Hi
>
> My diagram partitioning basically works alright, but I discovered a problem.
> I create my diagrams from some DSL and the initial diagram contains only nodes that can be double-clicked to open
> sub-diagrams. The serialized diagram XML code looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml"
> xmi:id="_mFwX0LlAEdydmZOsfHfFWA" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
> <styles xmi:type="notation:DiagramStyle" xmi:id="_mFwX0blAEdydmZOsfHfFWA"/>
> <element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
> </notation:Diagram>
>
> As can be seen, the nodes that represent the children of the root element "ThetaML" are not serialized. What could cause
> that? The semantic children are - of course - present in the corresponding model XML (I use separate files for domain
> model and diagram notation).
>
>
> Now, if I open one of the nodes, a sub-diagram is opened in a new editor and added to the XML. That's fine, however, the
> first editor (for the root diagram) now shows up to be dirty. Why is that? So I did a little research...
> If I focus the root editor, it asks whether I want to load the changes made on the file system.
> That shouldn't happen, as it completely confuses the user.
> If I say yes, another problem shows up: If I now double-click the same node as before again, GMF doesn't switch to the
> already open editor, but opens a completely new sub-diagram, which is - of course - a copy of the first sub-diagram.
>
> The XML looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml">
> <notation:Diagram xmi:id="_mFwX0LlAEdydmZOsfHfFWA" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
> <styles xmi:type="notation:DiagramStyle" xmi:id="_mFwX0blAEdydmZOsfHfFWA"/>
> <element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
> </notation:Diagram>
> <notation:Diagram xmi:id="_y8MewLlAEdydmZOsfHfFWA" type="ThetaML" measurementUnit="Pixel">
> <styles xmi:type="notation:DiagramStyle" xmi:id="_y8MewblAEdydmZOsfHfFWA"/>
> <element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
> </notation:Diagram>
> </xmi:XMI>
>
>
>
> The XML has changed, now that the second diagram is also serialized. So that explains why the editor is dirty. But
> still, shouldn't GMF suppress that? If not, how could I suppress that manually?
>
>
> Now, if I move any of the nodes in the root diagram by even just one pixel and then save it (before opening any
> sub-diagram), the behavior changes and GMF does the correct thing. Meaning: the children nodes get serialized in the
> diagram notation, double-clicking always opens the same sub-diagram without duplicating, and the root diagram editor
> never gets dirty.
>
> The XML for completeness:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:thetaml="http://www.thetae.com/thetaml">
> <notation:Diagram xmi:id="_JEjqw7lGEdy45ZMZ1nBdRg" type="ThetaML" name="fm.thetagram" measurementUnit="Pixel">
> <children xmi:type="notation:Node" xmi:id="_JJ2acLlGEdy45ZMZ1nBdRg" type="1001">
> <children xmi:type="notation:Node" xmi:id="_JJ2adLlGEdy45ZMZ1nBdRg" type="4001"/>
> <styles xmi:type="notation:ShapeStyle" xmi:id="_JJ2acblGEdy45ZMZ1nBdRg"/>
> <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_JJ2acrlGEdy45ZMZ1nBdRg"
> diagramLink="_TJZMwLlGEdy45ZMZ1nBdRg"/>
> <element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_JJ2ac7lGEdy45ZMZ1nBdRg" x="48" y="36"/>
> </children>
> <children xmi:type="notation:Node" xmi:id="_JJ2adblGEdy45ZMZ1nBdRg" type="1001">
> <children xmi:type="notation:Node" xmi:id="_JJ2aeblGEdy45ZMZ1nBdRg" type="4001"/>
> <styles xmi:type="notation:ShapeStyle" xmi:id="_JJ2adrlGEdy45ZMZ1nBdRg"/>
> <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_JJ2ad7lGEdy45ZMZ1nBdRg"/>
> <element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.1"/>
> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_JJ2aeLlGEdy45ZMZ1nBdRg" x="259" y="36"/>
> </children>
> ...
> more children nodes
> ...
> <styles xmi:type="notation:DiagramStyle" xmi:id="_JEjqxLlGEdy45ZMZ1nBdRg"/>
> <element xmi:type="thetaml:ThetaML" href="fm.thetaml#/"/>
> </notation:Diagram>
> <notation:Diagram xmi:id="_TJZMwLlGEdy45ZMZ1nBdRg" type="ThetaML" measurementUnit="Pixel">
> <styles xmi:type="notation:DiagramStyle" xmi:id="_TJZMwblGEdy45ZMZ1nBdRg"/>
> <element xmi:type="thetaml:ThetaModel" href="fm.thetaml#//@models.0"/>
> </notation:Diagram>
> </xmi:XMI>
>
>
> (This one has already one sub-diagram open, but before opening it looks practically the same.)
>
>
>
> Could some GMF guru please shed some light onto this?
> Many people use diagram partitioning in one form or another, so I wonder whether other people have seen this bugger before?
>
> Thanks for your attention if you read this post til here ;)
> Norbert Schoepke
|
|
| | |
Re: Diagram partitioning serialization oddities [message #167807 is a reply to message #167421] |
Fri, 11 January 2008 08:03  |
Eclipse User |
|
|
|
Failed to run for me too, since i don't use Java 6 (Why do you need it anyway?).
None the less, I tried to work around the "two editing domains" problem...but failed.
What did I try?
I tried to plug in a custom document provider that - upon empty document creation - checks, if the needed editing domain
is registered already.
(As a side note to the GMF devs: it was rather hard to plug this in, in contrast to the other XYZProvider classes that
one can override using priorities in the plugin.xml this is not possible for the XYZDocumentProvider.)
Sadly, this approach doesn't work (unless I forgot something). The existing editing domain is not found (null), even
though I create a sub-diagram in an already open diagram editor.
Is this a confirmed bug? If so, was it fixed in 2.1M4?
greets
Norbert Schöpke
|
|
|
Goto Forum:
Current Time: Sun Jul 06 14:02:33 EDT 2025
Powered by FUDForum. Page generated in 0.03323 seconds
|