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

Bug 515684

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:
Severity: normal    
Priority: P3 CC: julien.dupont
Version: 4.1.1Keywords: triaged
Target Milestone: 4.1.5   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/95246
https://git.eclipse.org/r/95764
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=12bb6f0bda400e040c855c658f7f5a2ec55718d6
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=33963583ce09dff817b290d8e05b1eafdc353d12
Whiteboard:
Bug Depends on:    
Bug Blocks: 515819    

Description Maxime Porhel CLA 2017-04-24 09:58:46 EDT
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 Maxime Porhel CLA 2017-04-24 09:59:53 EDT
There is no reproductible scenario in Sirius but only in a non open source tools for the moment. 
I should be able to provide a junit test.
Comment 2 Eclipse Genie CLA 2017-04-26 05:50:22 EDT
New Gerrit change created: https://git.eclipse.org/r/95764
Comment 3 Maxime Porhel CLA 2017-04-26 05:53:08 EDT
Reproduction and homologation: see SiriusCrossReferenceAdapterTests which simulates the issue.
Comment 6 Pierre-Charles David CLA 2017-06-15 05:24:23 EDT
Available in Sirius 4.1.5, see https://wiki.eclipse.org/Sirius/4.1.5.