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

Bug 452681

Summary: Representation disappears from Model Explorer on session reload
Product: [Modeling] Sirius Reporter: Esteban DUGUEPEROUX <esteban.dugueperoux>
Component: CoreAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Belqassim Djafer <belqassim.djafer>
Severity: normal    
Priority: P3 CC: belqassim.djafer, florian.barbin, laurent.redor
Version: 2.0.0Keywords: triaged
Target Milestone: 3.0.0M5   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 457265    
Attachments:
Description Flags
An example to reproduce
none
Simple Junit test that focus on the problem of crossReference broke after a reloading
none
Simple Junit test that focus on the problem of crossReference broke after a reloading
none
Simple Junit test that focus on the problem of crossReference broke after a reloading
none
Simple Junit test that focus on the problem of crossReference broke after a reloading none

Description Esteban DUGUEPEROUX CLA 2014-11-21 11:43:56 EST
Created attachment 248829 [details]
An example to reproduce

Using the attached example :

1. open My.ecore
2. Expand the My.ecore from Model Explorer to see the diagram under the root package.
3. In the My.ecore opened with the Sample Ecore Model Editor, copy and paste "c1" then save
4. Under My.ecore in Model Explorer, the root EPackage is collapsed and when you expand it the diagram does not appears. It appears only under the .aird hierarchy. We must close and reopen the Modeling Project to see again the diagram under root EPackage in Model Explorer or do another changes in the Sample Ecore Model Editor.
Comment 1 Florian Barbin CLA 2014-11-25 04:26:17 EST
Issue reproduced on Sirius master
Comment 2 Laurent Redor CLA 2015-01-09 10:58:04 EST
This regression is certainly due to bug 442337 that optimizes the DialectServices.getRepresentations(EObject, Session) by using the CrossReferencer. But in case of semantic reloading, the crossReferencer does not work.
Comment 4 Laurent Redor CLA 2015-01-09 12:11:49 EST
Created attachment 249825 [details]
Simple Junit test that focus on the problem of crossReference broke after a reloading
Comment 5 Laurent Redor CLA 2015-01-12 05:36:17 EST
Created attachment 249857 [details]
Simple Junit test that focus on the problem of crossReference broke after a reloading

This new version of test is more complete after analysis of the problem. There are:
* 2 tests with and without resolution proxy
* 2 tests with proposed solution to avoid to always do proxy resolution
Comment 6 Laurent Redor CLA 2015-01-12 05:40:29 EST
Created attachment 249858 [details]
Simple Junit test that focus on the problem of crossReference broke after a reloading
Comment 7 Laurent Redor CLA 2015-01-12 08:04:34 EST
Analysis: When a resource is unloaded and the reloaded, all cross-references that point to this resource are "KO". They are stored in crossReferencer#inverseCrossReferencer#proxyMap.

We should ask the cross-referencer to resolve the proxy (calling ECrossReferenceAdapter.getInverseReferences(EObject, boolean) with boolean set to true). This is a first option but at each use of cross-referencer, there is a resolution cost even if in most cases this is unnecessary.

Another option is to force the resolution just after the unload/reload of a resource made by Sirius.
Comment 8 Laurent Redor CLA 2015-01-12 10:45:50 EST
Proposed fix here: https://git.eclipse.org/r/39398

This fix breaks API and is not applicable on maintenance branch. I will try to adapt it for maintenance branch.
Comment 10 Laurent Redor CLA 2015-01-20 11:09:08 EST
Created attachment 250088 [details]
Simple Junit test that focus on the problem of crossReference broke after a reloading

The test has been completed for another solution that works even with target platform Kepler and Juno (see bugzilla 457265 for details)
Comment 11 Laurent Redor CLA 2015-01-21 02:50:08 EST
Another commit [1] has been necessay to fix the problem for post Juno target platfrom (see bug 457265 comment 6 and bug 457265 comment 7 for more details)

[1] http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=fb6277008e1b9f83dd4330568fe54dc3bce4e959
Comment 13 Belqassim Djafer CLA 2015-04-09 11:12:29 EDT
Verified on Sirius 3.0.0M6
Comment 14 Belqassim Djafer CLA 2015-05-22 03:22:02 EDT
Verified with Sirius 3.0.0 RC1
Comment 15 Pierre-Charles David CLA 2015-06-24 11:15:30 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.