Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 515819

Summary: Semantic cross referencer lost after drag and drop to resource.getContents()
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: CoreAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Laurent Fasani <laurent.fasani>
Severity: normal    
Priority: P3 CC: laurent.fasani
Version: 4.1.1Keywords: triaged
Target Milestone: 5.0.0M7   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/95771
https://git.eclipse.org/r/95465
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2ae0818a840c77faa776e855c4d603f7123980a4
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8a0513167dcb8a4f806b5a841c2429930db7e809
Whiteboard:
Bug Depends on: 515684    
Bug Blocks:    

Description Maxime Porhel CLA 2017-04-26 06:10:07 EDT
+++ This bug was initially created as a clone of Bug #515684 +++

In commit commit 8c5caf0cf3e82e8820afa597e3f6aade21e8e9ae done for Bug 458822, Mickael added the removeAdapterIfNecessary method in LazyCrossReferencer to avoid the removal of the cross referencer on elements that are already attached to another container with the same adapter.

Sometimes the model element contents and cross references are modified before the REMOVE notification, in this case, the cross referencer is wrongly removed as we will not get the ADD notification later.. 

If the concerned element has been drag and dropped from anywhere in the model to the resource roots, its container is null so the current behavior is to remove the adapter. 

See https://git.eclipse.org/r/#/c/95246/ to correctly handle moves of an object to resource contents.
Comment 1 Eclipse Genie CLA 2017-04-26 06:10:50 EDT
New Gerrit change created: https://git.eclipse.org/r/95771
Comment 2 Maxime Porhel CLA 2017-04-26 06:13:11 EDT
Reproduction and homologation: see SiriusCrossReferenceAdapterTests which simulates the issue.
Comment 5 Laurent Fasani CLA 2017-05-19 11:51:47 EDT
technical issue considered as validated
Comment 6 Pierre-Charles David CLA 2017-06-29 03:32:46 EDT
Available in Sirius 5.0.0, see https://wiki.eclipse.org/Sirius/5.0.0 for details.