Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram partitioning serialization oddities
Diagram partitioning serialization oddities [message #166713] Thu, 03 January 2008 13:38 Go to next message
Norbert  Schöpke is currently offline Norbert SchöpkeFriend
Messages: 63
Registered: July 2009
Member
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 #166835 is a reply to message #166713] Fri, 04 January 2008 11:25 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Norbert,

> I create my diagrams from some DSL and the initial diagram contains
> only nodes that can be double-clicked to open
This is a feature of GMF - all the nodes newly created by CanoicalEditPolicy
will not make your editor dirty (will not be saved to diagram + will be automatically
re-created bext time you openning diagram). Lookt like this is a reason for
bad diagram partitioning on your computer. As a work-around I suggest you
to change something on diagram and save editor (or call Diagram.persistChildren())
and submitt a bug describing your situation. Looks like transient nodes existing
on your diagram is a reason of this problem.

-----------------
Alex Shatalin
Re: Diagram partitioning serialization oddities [message #166899 is a reply to message #166713] Fri, 04 January 2008 14:29 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
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 #167276 is a reply to message #166899] Tue, 08 January 2008 09:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

This is a multi-part message in MIME format.
--------------070100030906010300050002
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Axel Guckelsberger wrote:
> 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.

Is there a way to "auto-save"? That would be great! I don't want my
users to have to click yes in the save dialog all the time...

> If you want to try out my intermediate results for diagram partitioning
> you may visit http://modulestudio.de/ and download the preview version.

I downloaded it and tried to run it, but it failed to start. I'm
attaching the log.


Best Regards,

Tomas Zijdemans

--------------070100030906010300050002
Content-Type: text/plain;
name="1199778943968.log"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="1199778943968.log"

!SESSION 2008-01-08 08:55:43.718 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_12
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.osgi 4 0 2008-01-08 08:55:44.625
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in de.guite.modulestudio.gmf.msmain was unable to load class de.guite.modulestudio.gmf.msmain.application.ModuleStudioApp lication.

at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI .throwException(RegistryStrategyOSGI.java:180)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI .createExecutableExtension(RegistryStrategyOSGI.java:164)
at org.eclipse.core.internal.registry.ExtensionRegistry.createE xecutableExtension(ExtensionRegistry.java:788)
at org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 51)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:165)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
org.eclipse.core.runtime.CoreException[1]: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.def ineClass(DefaultClassLoader.java:161)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineC lass(ClasspathManager.java:501)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findCla ssImpl(ClasspathManager.java:471)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClassImpl(ClasspathManager.java:430)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:413)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:189)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:340)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:408)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:369)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:357)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:289)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1269)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI .createExecutableExtension(RegistryStrategyOSGI.java:160)
at org.eclipse.core.internal.registry.ExtensionRegistry.createE xecutableExtension(ExtensionRegistry.java:788)
at org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 51)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:165)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)

--------------070100030906010300050002--
Re: Diagram partitioning serialization oddities [message #167421 is a reply to message #167276] Tue, 08 January 2008 19:47 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
Hi Thomas,

> Is there a way to "auto-save"? That would be great! I don't want my
> users to have to click yes in the save dialog all the time...
My first approach would be to strip out the confirmation by overriding
the corresponding XPand template. If it affects dependent plugins like
EMF or the GMF runtime, further changes are required.

> I downloaded it and tried to run it, but it failed to start. I'm
> attaching the log.
It needs Java 6, sorry for missing that information.


Greetings,

Axel
Re: Diagram partitioning serialization oddities [message #167807 is a reply to message #167421] Fri, 11 January 2008 13:03 Go to previous message
Norbert  Schöpke is currently offline Norbert SchöpkeFriend
Messages: 63
Registered: July 2009
Member
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
Previous Topic:getChildren()
Next Topic:Problem with gmfgen and multipage editors
Goto Forum:
  


Current Time: Thu Apr 25 17:36:58 GMT 2024

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

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

Back to the top