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

Bug 512292

Summary: EditModeDecorator checks the semantic element lockStatus and the part broken state twice
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: DiagramAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Laurent Redor <laurent.redor>
Severity: normal    
Priority: P3 CC: laurent.redor, pierre-charles.david
Version: 4.1.0Keywords: triaged
Target Milestone: 5.0.0   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/91268
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3da308551815a35744eee1a9a44c94be0db9e22d
https://git.eclipse.org/r/93497
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=a269741e02a214930a9376d6912530966218738c
Whiteboard:
Bug Depends on:    
Bug Blocks: 512443, 512444    
Attachments:
Description Flags
Decorators.zip none

Description Maxime Porhel CLA 2017-02-16 09:54:03 EST
Steps to reproduce: 
 - launch a runtime
 - open a diagram
 - put a breakpoint in EditModeDecorator.shouldBeDecorated
 - put a breakpoint in EditModeDecorator.getDecorationImage
 - Check the calls to getPermissionAuthority(), getLockStatus(), eResource()

In several context, on a big diagram, those operations can be costly and we do them twice for each concerned edit part during decorator refresh. 

One lead would be to only check the state of the part in shouldBeDecorated and to do the complex stuff in getDecorationImage as we need to identify which image we want to return.
Comment 2 Eclipse Genie CLA 2017-03-21 07:21:39 EDT
New Gerrit change created: https://git.eclipse.org/r/93497
Comment 3 Maxime Porhel CLA 2017-03-21 07:23:45 EDT
See new patch set which reset the previous decoration image computation priority.
Comment 5 Laurent Redor CLA 2017-05-19 10:16:40 EDT
@Maxime: It is difficult with the steps to reproduce to see what is expected after the fix of this issue: 
* One many calls to getPermissionAuthority(), getLockStatus(), eResource() are expected?
* For which modifications?
Comment 6 Laurent Redor CLA 2017-05-22 06:07:04 EDT
Steps to validate:
* Install UML2 (from example from OD Ce update site "UML2 Extender SDK")
* Import project "Decorators" from Decorators.zip
* Start Yourkit
* Open diagram MappingBasedDecoration

Validation:
* org.eclipse.sirius.ecore.extender.business.internal.permission.PermissionAuthorityRegistryImpl.getPermissionAuthority(ResourceSet)
   * OD CE 9.1: 81 calls
   * OD CE 10.0: 71 calls
* org.eclipse.sirius.ecore.extender.business.internal.permission.ReadOnlyPermissionAuthority.getLockStatus(EObject)
   * OD CE 9.1: 23 calls
   * OD CE 10.0: 35 calls (12 are made with the new properties view)
* EditModeDecorator.shouldBeDecorated(EditPart) and org.eclipse.sirius.diagram.ui.tools.internal.decoration.EditModeDecorationDescriptorProvider.shouldBeDecorated(EditPart)
   * OD CE 9.1: 32 calls
   * OD CE 10.0: 20 calls
* org.eclipse.emf.ecore.EObject.eResource()
   * Time passed in this method is too short and it does not appear in Yourkit trace.
Comment 7 Laurent Redor CLA 2017-05-22 06:08:02 EDT
Created attachment 268499 [details]
Decorators.zip
Comment 8 Pierre-Charles David CLA 2017-06-29 03:32:11 EDT
Available in Sirius 5.0.0, see https://wiki.eclipse.org/Sirius/5.0.0 for details.