Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368154 - GMF : Shorcut disappears from diagram
Summary: GMF : Shorcut disappears from diagram
Status: CLOSED DUPLICATE of bug 327389
Alias: None
Product: GMF-Tooling
Classification: Modeling
Component: Generation / Templates (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.0M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 08:24 EST by Laurent Le Moux CLA
Modified: 2012-01-18 13:13 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Le Moux CLA 2012-01-09 08:24:18 EST
Build Identifier: Version: 3.7.1 Build id: M20110909-1335

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.

I then save the files but, when I refresh the second diagram (F5), shortcut and link disappear !

In XXCanonicalEditPolicy.refreshSemantic(), it appears that the shortcut is added to an 'orphaned' list and removed.

Here's a workaround to filter out the shortcut from the 'orphaned' list :

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

I added these few lines just before 'orphaned.addAll(knownViewChildren);'.

However, I believe something should be done at GMF code generation level to prevent from behaviour.

Kind regards,

Laurent

Reproducible: Always

Steps to Reproduce:
See description.
Comment 1 Michael Golubev CLA 2012-01-09 11:08:01 EST
Could you please post the generated canonical EditPolicy here?
Comment 2 Laurent Le Moux CLA 2012-01-10 03:50:30 EST
Hi,

All necessary files can be downloaded from the corresponding forum entry :

http://www.eclipse.org/forums/index.php/t/244954/

Regards,

Laurent
Comment 3 Michael Golubev CLA 2012-01-18 13:13:46 EST
Duplicate to Bugzilla #327389 which is now fixed.

*** This bug has been marked as a duplicate of bug 327389 ***