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

Bug 505858

Summary: Drow down menus of tabbar are sometimes shifted.
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Pierre Guilet <pierre.guilet>
Severity: normal    
Priority: P3 CC: julien.dupont, pierre-charles.david
Version: 4.0.0Keywords: triaged
Target Milestone: 4.1.1   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/83193
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=0d9122b0915061d4d74642e9d7794adb77ff2851
Whiteboard:
Attachments:
Description Flags
ModelingProject.zip
none
WrongMenuLocation.png
none
CorrectMenuLocation.png
none
Stacktrace under Juno
none
Stacktrace under Kepler none

Description Laurent Redor CLA 2016-10-13 05:50:19 EDT
Created attachment 264809 [details]
ModelingProject.zip

Steps to reproduce:
* Import the project ModelingProject from ModelingProject.zip
* Open the diagram "new Diag"
* Expand the filters menu of the tabbar
* *KO: The list of 2 filters name is not just behind the button.* (see WrongMenuLocation.png)
* Select the node C1 and the select again the diagram.
* Expand the filters menu of the tabbar
* *OK: The list of 2 filters name is now just behind the button.* (see CorrectMenuLocation.png)
Comment 1 Laurent Redor CLA 2016-10-13 05:51:02 EDT
Created attachment 264810 [details]
WrongMenuLocation.png
Comment 2 Laurent Redor CLA 2016-10-13 05:51:19 EDT
Created attachment 264811 [details]
CorrectMenuLocation.png
Comment 3 Laurent Redor CLA 2016-10-13 05:56:50 EDT
This problem does not exist on Sirius 3.1.x.
Comment 4 Laurent Redor CLA 2016-10-13 06:32:41 EDT
(In reply to Laurent Redor from comment #3)
> This problem does not exist on Sirius 3.1.x.

The previous comment is not exact. The problem is already here before (at least in 3.1.3) but not exactly the same. The location is shifted to the left instead of to the right. The behavior changes is probably linked to bug 481573.

But with Sirius 3.1.6 and Eclipse Juno, there is no problem. So there is probably also a link to the Eclipse platform.
Comment 5 Laurent Redor CLA 2016-10-13 10:50:51 EDT
In fact, the problem exists with Sirius under Kepler 4.0.0 but does not exist with the same Sirius in Juno.
So there is probably something that has been changed in platform and has broke the tabbar.
Comment 6 Laurent Redor CLA 2016-10-13 12:21:40 EDT
The main difference is explained by "e4". The classes involved (ToolBarManager, ToolBar, IContributionItemà have not really changed but the events is managed differently with e4.

The main difference seems that the AbstractTabbarFiller.addTabbarContributions() indirectly triggers the TabbarToolBarManager.update(boolean) instead of firstly be cleaned with TabbarFillerWithContributions.update(ISelection).

See both stackTrace that triggers AbstractMenuContributionItem$TabbarContributionItem.fill(ToolBar, int) with a good index for Juno and a wrong index for Kepler.
Comment 7 Laurent Redor CLA 2016-10-13 12:22:16 EDT
Created attachment 264826 [details]
Stacktrace under Juno
Comment 8 Laurent Redor CLA 2016-10-13 12:22:35 EDT
Created attachment 264827 [details]
Stacktrace under Kepler
Comment 9 Laurent Redor CLA 2016-10-14 04:55:16 EDT
To details, since e4, the stack is like this:
* TabbarFillerWithContributions.doFill()
* --> AbstractTabbarFiller.addTabbarContributions()
*     --> SlaveMenuService.populateContributionManager(ContributionManager, String)
...
*     --> SlaveMenuService.reconcileManagerToModel(IToolBarManager menuManager, MToolBar toolBar)
*         --> and the for each items of the menu manager, an update of the TabbarToolBarManager, TabbarToolBarManager.update(boolean), is triggered.

The first TabbarToolBarManager.update(boolean) is called with a wrong visibility for "static" items and so they are created with a wrong index (AbstractMenuContributionItem.TabbarContributionItem.fill(ToolBar, int index)).

Before e4, the fill method was called after having refreshed the visibility of items with TabbarFillerWithContributions.update(ISelection).

So, to fix the problem, the visibility refresh of "static" items must be done before calling addTabbarContributions().
Comment 10 Eclipse Genie CLA 2016-10-14 05:09:45 EDT
New Gerrit change created: https://git.eclipse.org/r/83193
Comment 12 Pierre-Charles David CLA 2016-10-26 04:29:08 EDT
Available in Sirius 4.1.1, see https://wiki.eclipse.org/Sirius/4.1.1