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

Bug 481811

Summary: For DNodeListElement the direct edit does not seem to call into the permission authority
Product: [Modeling] Sirius Reporter: Daria Tioc-Deac <daria.tioc-deac>
Component: DiagramAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Florian Barbin <florian.barbin>
Severity: normal    
Priority: P3 CC: daria.tioc-deac, florian.barbin, maxime.porhel, niels.brouwers, pierre-charles.david
Version: 3.0.0Keywords: triaged
Target Milestone: 4.1.2   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/85468
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=da487adcd31c6ce3777cf8733964b22897847889
Whiteboard: needtest

Description Daria Tioc-Deac CLA 2015-11-10 04:21:00 EST
For elements represented on the diagram using a DNodeListElement, direct edit does not seem to call into the permission authority to check whether a node is editable. Specifically, for DNodeListElementEditPart, isEditable() only checks whether there is a parser available and returns true if there is. Thus editing is allowed in cases when it should not be.
Comment 1 Maxime Porhel CLA 2015-11-18 16:21:15 EST
Step to reproduce:
 . launch a runtime
 . open/create an EcoreTools class diagram with at least one EClass and one EAttribute
 . put a breakpoint in org.eclipse.sirius.ecore.extender.business.internal.permission.ReadOnlyPermissionAuthority.isReadOnly()
 . change the activation field to true
 . try to direct edit the EClass label and the EAttribute label (F2 or selection and keyboard)

> The direct edit seems enabled but produce no change on the list element

> The direct edit is disabled on the list label


Other elements (edit parts) will have to be checked: container (1,2), list (1,2), node and border nodes (1,2,3,4), edges.
Comment 2 Maxime Porhel CLA 2015-11-18 16:24:08 EST
I add a dependency link to Bug 481812 as the issue might be in the same area
Comment 3 Maxime Porhel CLA 2015-11-18 16:37:58 EST
org.eclipse.sirius.diagram.ui.internal.edit.parts.AbstractGeneratedDiagramNameEditPart.isEditable()  make the permission authority check

DNodeListElementEditPart inherits from AbstractGeneratedDiagramNameEditPart but override isEditable() by  "return getParser() != null;" without calling the super method. 

The other subclasses of AbstractGeneratedDiagramNameEditPart are not impacted.
Comment 4 Niels Brouwers CLA 2016-11-21 08:04:13 EST
Concluding from the comments added by Obeo, the fix seems trivial. Any chance it can come with the next release of Sirius?
Comment 5 Eclipse Genie CLA 2016-11-22 05:10:04 EST
New Gerrit change created: https://git.eclipse.org/r/85468
Comment 6 Eclipse Genie CLA 2016-11-22 05:10:09 EST
New Gerrit change created: https://git.eclipse.org/r/85468
Comment 7 Pierre-Charles David CLA 2016-11-22 05:17:41 EST
Thanks for reactivating this. Indeed, the patch seems trivial. The hardest part will probably be to write the non-regression test.

I'm putting this for consideration in the next maintenance release (4.1.2).
Comment 8 Niels Brouwers CLA 2016-11-22 06:49:22 EST
Great, thanks a lot!
Comment 10 Pierre-Charles David CLA 2016-11-24 09:22:09 EST
Fixed but needs a non-regression test before we close the ticket.
Comment 11 Florian Barbin CLA 2016-12-02 03:32:25 EST
Verified on Sirius 4.1.2.201612011000.
Comment 12 Pierre-Charles David CLA 2016-12-08 11:12:42 EST
Available in Sirius 4.1.2 (see https://wiki.eclipse.org/Sirius/4.1.2 for details).