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

Bug 522478

Summary: Model explorer replaces Sirius item by other item in some cases.
Product: [Modeling] Sirius Reporter: Pierre Guilet <pierre.guilet>
Component: CoreAssignee: Project inbox <sirius.core-inbox>
Status: CLOSED FIXED QA Contact: Jessy Mallet <jessy.mallet>
Severity: normal    
Priority: P3 CC: pierre-charles.david
Version: 5.0.0Keywords: triaged
Target Milestone: 5.1.0   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/82625
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=d0b51dc020c3d4f4b605e9078d26278b79c42efc
https://git.eclipse.org/r/105954
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=5d5cc181ad44773d959e72d6a236bc01b2793775
https://git.eclipse.org/r/106029
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=30f16fa6d0a6eea6a05a63e826ebb2ddfa2d2887
Whiteboard:

Description Pierre Guilet CLA 2017-09-19 05:14:36 EDT
Items shown in a modeling project in the view Model Explorer are all from interface ItemWrapper.

In some contexts with decoration mechanisms activated for example, an instance of ItemWrapper with the specific type A can be replaced by another instance of ItemWrapper with the specific type B because the wrapped object is the same in A and B. 

This is problematic because each type can have for example specific actions and icons and labels.

The problem lies on org.eclipse.sirius.ui.tools.internal.views.modelexplorer.ModelExplorerItemComparer.equals(Object, Object)

An item A with supertype ItemWrapper with a wrapped object WO is considered as equals to another item B with wrapped object WO even if the specific type of A and B is different. This does not make sense.

We should check that the specific type of A and B is the same before checking equality of wrapped objects.
Comment 1 Pierre Guilet CLA 2017-09-19 05:51:25 EDT
The ItemWrapper RepresentationItemImpl is the only wrapper item that is shown in Model Explorer in addition to its semantic element DRepresentationDescriptor.

A special case should be handled in org.eclipse.sirius.ui.tools.api.views.RefreshLabelImageJob

because refreshing the DRepresentationDescriptor label and image should also refresh the corresponding item RepresentationItemImpl  containing the descriptor.
Comment 2 Pierre Guilet CLA 2017-09-20 04:35:35 EDT
Technical issue.
Comment 4 Jessy Mallet CLA 2017-09-26 10:18:18 EDT
Validated on Sirius Stable 5.1.0.201709221508
Comment 5 Eclipse Genie CLA 2017-09-28 11:26:36 EDT
New Gerrit change created: https://git.eclipse.org/r/105954
Comment 7 Eclipse Genie CLA 2017-09-29 12:39:12 EDT
New Gerrit change created: https://git.eclipse.org/r/106029
Comment 9 Pierre-Charles David CLA 2017-11-08 03:37:38 EST
Available in Sirius 5.1.0, see https://wiki.eclipse.org/Sirius/5.1.0.