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

Bug 495859

Summary: "Wrong pattern" for AbstractLayoutProvider.CommandWrapper
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: normal    
Priority: P3 CC: julien.dupont, pierre-charles.david, steve.monnier
Version: unspecifiedKeywords: triaged
Target Milestone: 4.1.0   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/75043
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=00392405793fe522b104537cd28e05250f00fcd3
Whiteboard:

Description Laurent Redor CLA 2016-06-10 05:12:44 EDT
The class org.eclipse.sirius.diagram.ui.tools.api.layout.provider.AbstractLayoutProvider.CommandWrapper uses a "wrong pattern".
The canExecute method  uses getWrappedCommand().canExecute(). But when the CommandWrapper is really executed, the getWrappedCommand() is called again and the 2 commands, one for canExecute() and one for execute(), can be different.

We can store the result of the getWrappedCommand method from canExecute call to reuse it in execute method. But there is also a risk to execute a command that is not the expected one.
Comment 1 Eclipse Genie CLA 2016-06-10 05:25:35 EDT
New Gerrit change created: https://git.eclipse.org/r/75043
Comment 2 Laurent Redor CLA 2016-06-10 05:26:32 EDT
The above gerrit corresponds to the "solution" proposed in description.
Comment 4 Julien Dupont CLA 2016-09-08 03:54:46 EDT
Technical issue
Comment 5 Pierre-Charles David CLA 2016-10-18 11:07:46 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.