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

Bug 540056

Summary: Improve "Link Note" delete lifecycle
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Florian Barbin <florian.barbin>
Severity: enhancement    
Priority: P3 CC: aurelien.pinsonneau, felix.dorner, florian.barbin, sirius.diagram-inbox
Version: 5.1.2   
Target Milestone: 6.1.0   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/130810
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=a325e533a8f9e155784b4ffcb874546375dc7288
Whiteboard:
Bug Depends on: 535648    
Bug Blocks:    

Description Laurent Redor CLA 2018-10-11 11:49:18 EDT
+++ This bug was initially created as a clone of Bug #535648 +++

The new tool "Link Note", added in Sirius 5.1.2 (bug 533002), can be improved, especially the delete lifecycle.

Currently, as soon as a representation is deleted, all "Link Note" targeting this representation are also deleted.
This can be problematic in case of "read only" access.

The simple use case to explain this, is with ObeoDesigner Team Edition or with TeamForCapella.
Steps to reproduce with T4C:
* Export SimpleCapellaProject (from SimpleCapellaProject.zip) to a T4C server
* Connect to this project with User1
* With User1, open "[SDFB] Root System Function"
* With User1, move "SystemFunction 1"
* OK: The lock is taken on the diagram
* Connect to this project with User2
* With User2, delete diagram "[OAIB] Root Operational Activity" from "Capella Project Explorer" view
* KO: User2 can non delete "its diagram" as another as the lock on the target diagram of the "Link Note"

Anther scenario on "Team" will be to use the "user profile" mode and the fragments by defining a "read only" access on a fragment containing the diagram "[SDFB] Root System Function".
It would probably be possible to reproduce this problem in pure Sirius with fragments and read only files. I can't succeed to do it simply.

I think that the delete of a diagram should not directly modify all diagrams that have a reference through a "Link Note". I think it should be done on the next refresh, like for the mappings. Maybe a "red cross" must be added on this kind of Note, like for Node with mapping, to visually detect that it will be deleted at the next refresh.
Comment 1 Eclipse Genie CLA 2018-10-11 12:50:19 EDT
New Gerrit change created: https://git.eclipse.org/r/130810
Comment 3 Laurent Redor CLA 2018-10-12 06:04:43 EDT
Steps to validate:
* Set Sirius preferences "Do refresh on representation opening" and "Automatic Refresh" to false
* Create 2 diagrams "A" and "B"
* Open "A"
* Add a "Representation Link" in "A" with "B" as target representation
* Close "A"
* Delete "B"
* Open "A"
* Expected: The "Representation Link" is always here but with a specific label: "Broken representation link" and a red cross icon

A second scenario:
* Set Sirius preferences "Do refresh on representation opening" and "Automatic Refresh" to false
* Create 2 diagrams "A" and "B"
* Open "A"
* Add a "Representation Link" in "A" with "B" as target representation
* Rename "B" in "B1"
* Expected: The "Representation Link" is automatically renamed
* Delete "B1"
* Expected: As previous : The "Representation Link" is always here but with a specific label: "Broken representation link" and a red cross icon
Comment 4 Pierre-Charles David CLA 2018-10-19 12:49:10 EDT
Available in Sirius 6.1.0, see https://wiki.eclipse.org/Sirius/6.1.0