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

Bug 501515

Summary: Open menu entry is available on a deleted diagram
Product: [Modeling] Sirius Reporter: Axel RICHARD <axel.richard>
Component: DiagramAssignee: Laurent Fasani <laurent.fasani>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: major    
Priority: P3 CC: julien.dupont, laurent.fasani, maxime.porhel, pierre-charles.david
Version: 4.0.0Keywords: triaged
Target Milestone: 4.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/81990
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=83f70b06681b67b36fd4a2cb1c1ac7974249ae56
Whiteboard: backport
Bug Depends on: 494766    
Bug Blocks:    

Description Axel RICHARD CLA 2016-09-15 11:44:09 EDT
When a diagram is deleted, it is still available in the Open context menu on the background of a diagram
Comment 1 Maxime Porhel CLA 2016-09-19 05:24:03 EDT
Reproduced on master branch for Sirius 4.1.
Comment 2 Maxime Porhel CLA 2016-09-19 05:27:21 EDT
Steps to reproduce: 
* Create a modeling project with an ecore model. 
* Activate the Design viewpoint from EcoreTools. 
* Create 2 diagram named A and B on the root EPackage. 
* Open A, 
* Create a subPackage on the diagram A
* Create 3 diagrams C and D on the sub package. 
* From the model explorer, delete B and D diagrams
* From the A editor, select the diagram background: B should not appear anymore in the Open menu.
* From the A editor, select the subPackage, D should not appear in the Open menu.
Comment 3 Maxime Porhel CLA 2016-09-19 05:39:25 EDT
The bug currently also impact the corresponding Open menu in table and tree. And maybe also the Navigate menu. 

DialectManager.INSTANCE.getRepresentations(semantic, session) return deleted diagrams because the cross reference still find them.

Note that DialectManager.INSTANCE.getRepresentationDescriptors(semantic, session) is ok. 


I see two corrections to do: 
 . Correct the delete action/command and ensure that DialectManager.getRepresentations does not return deleted representations. We might need to complete the DanglingRefRemovalTrigger or to introduce/imporve the current DRepresentation/DRepresentationDescriptor mecanism
 . Improve the OpenMenuContribution/MenuHelper/DTableMenuListener/DTreeMenuListener/SubDiagramDecorator/ to use the DialectManger.getRepresentatonDescriptors api.
Comment 4 Laurent Fasani CLA 2016-09-27 09:15:06 EDT
The problem is that the ECrossreferenceAdapter is not removed from the deleted DRepresentation because the Drep is a root object of the resource.
See #445761 that corresponds to that subject

The proposal is to overload the selfAdapt method to removeAdapter when the notifier is a Resource
Comment 5 Eclipse Genie CLA 2016-09-27 09:20:22 EDT
New Gerrit change created: https://git.eclipse.org/r/81990
Comment 6 Pierre-Charles David CLA 2016-10-03 14:41:08 EDT
(In reply to Maxime Porhel from comment #2)
> Steps to reproduce: 
> * Create a modeling project with an ecore model. 
> * Activate the Design viewpoint from EcoreTools. 
> * Create 2 diagram named A and B on the root EPackage. 
> * Open A, 
> * Create a subPackage on the diagram A
> * Create 3 diagrams C and D on the sub package. 
> * From the model explorer, delete B and D diagrams
> * From the A editor, select the diagram background: B should not appear
> anymore in the Open menu.
> * From the A editor, select the subPackage, D should not appear in the Open
> menu.

Additional steps: undo the diagrams' removal, and make sure they ara available again in the "Open" menus.
Comment 8 Pierre-Charles David CLA 2016-10-18 11:08:53 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.