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

Bug 324946

Summary: [Model Browser] loss of context when editing
Product: [Modeling] MoDisco Reporter: Nicolas Bros <nicolas.bros>
Component: InfrastructureAssignee: Nicolas Bros <nicolas.bros>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fabien.giquel, gdupe, hugo.bruneliere, modisco.web-inbox
Version: 0.9.0Flags: nicolas.bros: indigo+
Target Milestone: 0.9.0 M2   
Hardware: All   
OS: All   
Whiteboard:

Description Nicolas Bros CLA 2010-09-10 06:49:43 EDT
With Bug 324629 (editing feedback), the model browser was made to select the affected element after each editing action.

But the thing is, each model element (EObject) can appear several times in the model browser. Each such appearance corresponds to an instance of a ModelElementItem.
When the browser selects the affected element, it switches to its metaclass in the "types" panel, and selects the instance which is at the root of the "instances" tree.
This results in a loss of context (because the tree changes) if the user had gone down several model elements by successively expanding them before editing the element.

This problem stems from the fact that the affected element we get from an EMF.edit command is an EObject, and we can't find the tree node back from the EObject. So, the solution would be to not pass EObjects to commands, but instead ModelElementItems. And then make the commands themselves know how to unwrap the ModelElementItems to retrieve the EObject on which to operate.
Comment 1 Nicolas Bros CLA 2010-09-10 13:17:46 EDT
Fixed in revision 3017.
I didn't change the commands, because this would have required too many changes, with a lot of copy/pasting from EMF.edit.
Instead, I associated the editor selection with each command at its creation, in order to be able to handle the selection of the affected element in the tree (which is related to the selection).
Comment 2 Hugo Bruneliere CLA 2010-10-05 05:02:11 EDT
Bug fixed.