Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Shorcut disappears from diagram
Shorcut disappears from diagram [message #734416] Fri, 07 October 2011 16:56 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hello,

I have got a problem experimenting the Jevon Drag & Drop tutorial.
I defined the simple following model (see attached file) :
ModelA (container) -has-> 1..* ElementA
ElementA has a 'name' attribute and -references-> 0..1 ElementA (itself).

I generated the corresponding GMF plugin after setting the following parameters in the ModelA.gmfgen file as requested in the Jevon 'Drag and Drop' tutorial :

Contains Shortcuts To : modela (ecore file extension)
Shorcuts Provided For : modela.diagram.part.ModelADiagramEditorID

Then I created two diagrams, the first one containing a single 'My A' element.
In the second one, I created a 'My B' element.
Then I drag and drop the 'My A' element from the navigator on the second diagram.
It works fine. I also can link both the element and the created shortcut.

But, when I save all this, the second ecore file contains only "My B". No reference to the shortcut !

And, when I refresh the second diagram (F5), shortcut and link disappear !
After debugging, it appears that GMF removes the shortcut and the link from the diagram because the shortcut is indeed not persisted in the corresponding ecore file.

I don't understand this behaviour and I found no way to modify it neither in the ModelA.ecore file, nor in the ModelA.genmodel.
Modifying 'Containment proxies' and 'Resolve Proxies' properties changed nothing.

Any help would be highly appreciated !

Laurent
  • Attachment: ModelA.ecore
    (Size: 0.84KB, Downloaded 285 times)
Re: Shorcut disappears from diagram [message #735441 is a reply to message #734416] Tue, 11 October 2011 19:52 Go to previous messageGo to next message
Svyatoslav Kovalsky is currently offline Svyatoslav KovalskyFriend
Messages: 12
Registered: October 2011
Junior Member
Hello,

I tried to reproduce it and the described use case works fine for me.
Note that shortcuts are the notions from the diagram resource, they are not expected to be persisted in the semantic model. Please check that the diagram file contains the node for shortcutted element after D&D.
I would suggest you to debug with breakpoints in the XXXDiagramCanonicalEditPolicy#isOrphaned(...)
and, if it does not help, then in the ViewImpl#removeChild(View) - you may post the stack trace at the latter one here.
You may also post your diagram plugin here for me to take a look.

Regards,
Svyatoslav Kovalsky
at Montages Think Tank, Prague, Czech Republic
Montages AG, Zurich, Switzerland
Re: Shorcut disappears from diagram [message #748121 is a reply to message #735441] Mon, 24 October 2011 13:58 Go to previous messageGo to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hello,

Sorry for my late answer. I was quite busy on other subjects...
I fully agree shortcuts are to be persisted only in the diagram file.
And the "My A" shorcut is actually there.
The problem occurs when I refresh my diagram editor (F5).
Then the shortcut disappears and the diagram is marked as modified.
If I press the save button, the shorcut is then removed from the file.

I wanted to try your suggestions but I couldn't find the ViewImpl#removeChild(View) and - after setting a breakpoint - it seems that XXXDiagramCanonicalEditPolicy#isOrphaned is not called.

So I started to study refreshSemantic.
It builds a childDescriptors list by calling getModelA_1000SemanticChildren on the DIAGRAM view. I was suprised to see that the resulting list contains only "My B" and no reference to "My A" shortcut...

After some processing, "My A" shortcut is set elsewhere in refreshSemantic in an orphaned list and removed...

I hope you'll be able to explain to me this strange behaviour and why it works fine for you.

You'll find the plug-in attached and the diagram file (before the shortcut removal).

Many thanks for your help.

Laurent
Re: Shorcut disappears from diagram [message #754599 is a reply to message #748121] Thu, 03 November 2011 13:07 Go to previous messageGo to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hello again,

Sorry to insist but I'm still stucked... Sad .
Could anyone send a tip or Svyatoslav send me his working exemple so that I can study it ?
Any help would be highly appreciated !

Kind regards,

Laurent
Re: Shorcut disappears from diagram [message #772341 is a reply to message #754599] Thu, 29 December 2011 14:51 Go to previous messageGo to next message
Tim Schaefer is currently offline Tim SchaeferFriend
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Laurent,
I am having the same problem, did you solve it?
I followed the mindmap tutorial
http://wiki.eclipse.org/Graphical_Modeling_Framework/Tutorial/Part_1
and shortcuts don't work there, as you described in this thread.

Does nobody have an answer? Sad

Regards,
Tim

edit: I solved the problem by commenting out the line
orphaned.addAll(knownViewChildren);
in XXCanonicalEditPolicy.refreshSemantic() and now shortcuts work!
However this is not really a good fix.
I think the templates for canonical editpolicies should definitely be revised.
Hope this helps anyone encountering this issue.

[Updated on: Thu, 29 December 2011 16:01]

Report message to a moderator

Re: Shorcut disappears from diagram [message #776880 is a reply to message #772341] Mon, 09 January 2012 13:01 Go to previous message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
Hi Tim,

I agree with you and I'll try submit this issue in a bug (?) report.
However, in order not to comment out "orphaned.addAll(knownViewChildren);", I added the following lines just before :

for (Iterator<View> shortcutsIterator = knownViewChildren.iterator(); shortcutsIterator.hasNext()Wink {
View next = shortcutsIterator.next();
if (next.getEAnnotation("Shortcut") != null) {
shortcutsIterator.remove();
}
}

Regards,

Laurent
Previous Topic:GMF on Eclipse 3.7
Next Topic:compartment background transparent
Goto Forum:
  


Current Time: Thu Apr 18 12:19:41 GMT 2024

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

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

Back to the top