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

Bug 466566

Summary: Diagram not visible in model explorer after pull from Git
Product: [Modeling] Sirius Reporter: Stéphane Thibaudeau <stephane.thibaudeau>
Component: CoreAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Belqassim Djafer <belqassim.djafer>
Severity: normal    
Priority: P3 CC: belqassim.djafer, jessy.mallet, laurent.redor, maxime.porhel
Version: 2.0.3Keywords: triaged
Target Milestone: 2.0.6   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/49444
https://git.eclipse.org/r/50092
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=eac75d2ba2fb6204f5439d09c86dce3f4d969a2a
https://git.eclipse.org/r/50114
Whiteboard:
Bug Depends on: 467508    
Bug Blocks: 470083, 470141    
Attachments:
Description Flags
Initial project
none
Manual test none

Description Stéphane Thibaudeau CLA 2015-05-06 07:45:56 EDT
Created attachment 253218 [details]
Initial project

N.B. : This problem was first encountered using RTC but I was able to reproduce it using Git and even by just copying files into the project.

Steps to reproduce (with Git) :

1) Import the provided project. This project contains a main semantic resource and a controlled one. There is one aird file.
This project should be committed into a Git repository

2) Clone the Git repository to another place. Open a new workspace and import the project from Git

3) In the first workspace, create a representation (class diagram) on the sub-package (contained in the controlled semantic resource).

4) Extract this new diagram into a new aird file

5) Commit the modifications (1 modified aird and 1 new aird)

6) In the second workspace, pull the modifications.
=> the diagram is not visible in the tre under My.ecore. Though it is visible when unfolding the new aird file.

7) Close/Open the modeling project => the diagram is now visible in the semantic tree.


Steps to reproduce (without Git)

1) Import the provided projects in 2 different workspaces.

2) Execute steps (3) and (4) from above in the first workspace

3) Copy the 2 aird files (1 modified and 1 new) into the second workspace

4) You should face the same problem.
Comment 1 Stéphane Thibaudeau CLA 2015-05-06 07:52:10 EDT
It can be reproduced using 2 different workspaces pointing on a same project.
Once the new diagram has been created and extractoed to a new aird, just refresh the project in the second workspace.
Comment 2 Maxime Porhel CLA 2015-05-06 10:20:25 EDT
The new aird is loaded (because the main aird is reloaded) but the cross referencer is not added to it -> the DialectManager.Instance.getAllRepresentation will be able to find the representations stored in this new aird. 


It seems that org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesSynchronizer.getImpactingNewStatuses(Collection<ResourceStatusChange>) detect thaht the main aird is impacted by the change.
Then the reload policy says ok reload it.

The new aird is unknown from the session in wkp2, so the SessionResourceSynchronizer does not detect it as impact. 
Then the reload of the main aird does nothing to init the new analyses: it appears in sessionResources and allAnalyses, and even in mainAnalysis.getReferencedAnalysis, but this semantic cross referencer has not been added on it.



Additional issue: it seems that sometimes a ControlledRoot item wrapper is displayed instead of the EObject in the semantic resource tree, but this will have to be checked after the main correction.
Comment 3 Maxime Porhel CLA 2015-06-04 09:15:38 EDT
Reproduce on Sirius 2.0.x and 3.0.x streams. 


In DAnalysisSessionImpl.reloadResource(Resource), DAnalysisRefresher.addAutomaticalyLoadedResourcesToSemanticResources is call. It compare the list of known resource before reload to the list of resources after reload (and resolve). 

We should modify this method (and rename it) to also detect new added referenced session resources (aird): the session.getReferencedSessionResources() is computed on each call from the allAnalyses() result and the newly referenced session resource do not have the aird resource specific adapters nor the semantic cross referencer after reload. This causes the issues observed by Stéphane. 

After reload the missing adapters are: 
 . semantic cross referencer
 . representationsChangeAdapter
 . semanticResourcesUpdater

Another issue also participate to the observed problem on 2.0.x (Bug 467508): the AirdCrossReferencer is not added to the main aird after reload.


Closing and reopening the session/modeling project allows to display the diagram created in wkp1 as the Session.open(à method adds the expected adapters on the referenced session resource during the opening (see initLocalTriggers())
Comment 4 Eclipse Genie CLA 2015-06-04 10:46:38 EDT
New Gerrit change created: https://git.eclipse.org/r/49444
Comment 5 Eclipse Genie CLA 2015-06-12 08:46:59 EDT
New Gerrit change created: https://git.eclipse.org/r/50092
Comment 7 Eclipse Genie CLA 2015-06-12 10:57:35 EDT
New Gerrit change created: https://git.eclipse.org/r/50114
Comment 8 Belqassim Djafer CLA 2015-06-12 11:27:47 EDT
Verified with Sirius 2.0.6-S20150612-092529
Comment 9 Maxime Porhel CLA 2015-06-15 11:16:36 EDT
Test Gerrit patchset has been abandoned.

The proposed test was unreliable: the workspace does not always the change on the main aird and ecore file. The IResourceDelta of the IResourceChangeEvent often contains only the delta for the added fragments and not for the modified files (modified using the test api EclipseTestsSupportHelper). In debug, the delta is often ok and then the reload behavior is correct.

The test will be replaced by a manual scenario : see reproduction case.
Comment 10 Maxime Porhel CLA 2015-06-15 11:23:25 EDT
Additional steps to reproduce (without Git)

1) Import the manual test project in your workspace.

2) open the base/main.aird session

3) Copy the files from the controlled folder into the base folder. 

4) Without the correction, you will face the same problem. With the correction, a third representation should be visible, the root content of the fragment should be marqued as controlled, you should see the new fragment file under the aird. 


5) clean you workspace and replay the scenario but open rmain.aird in step2. 

6) see 4)
Comment 11 Maxime Porhel CLA 2015-06-15 11:29:33 EDT
Created attachment 254442 [details]
Manual test
Comment 12 Laurent Redor CLA 2015-06-16 02:40:06 EDT
See comment 8
Comment 13 Maxime Porhel CLA 2015-06-16 03:29:54 EDT
Proposed test has been stabilized and merged on 2.0.x.
Comment 14 Laurent Redor CLA 2015-06-17 05:34:52 EDT
Available in Sirius 2.0.6.
Comment 15 Jessy Mallet CLA 2015-09-28 10:19:44 EDT
Validated with Sirius 3.1.0.201509241504