Bug 566375 - Disappearing 'View Menu' toolbar button in History view
Summary: Disappearing 'View Menu' toolbar button in History view
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.17   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.17 RC2   Edit
Assignee: Rolf Theunissen CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-08-25 05:45 EDT by Martin Coufal CLA
Modified: 2020-09-06 03:55 EDT (History)
7 users (show)

See Also:
Lars.Vogel: pmc_approved+


Attachments
menu_not_visible.png (85.83 KB, image/png)
2020-08-25 05:45 EDT, Martin Coufal CLA
no flags Details
menu_visible.png (87.35 KB, image/png)
2020-08-25 05:46 EDT, Martin Coufal CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Coufal CLA 2020-08-25 05:45:17 EDT
Sometimes when History view is opened, the toolbar button with the tooltip text 'View Menu' is not present.


How to reproduce:
1. run eclipse
2. create new general project
3. share the project:
  * click on project's context menu 'Team' -> 'Share Project...'
  * create new local repository if needed
4. switch to 'Git' perspective
5. select project's repository in 'Git Repositories' view

Toolbar button 'View Menu' is not visible (see menu_not_visible.png). If this does not reproduce the issue, try closing the History view, switch between other views (Synchronize, Git Staging, Git Reflog, Properties), open the History view and select project's repository in 'Git Repositories' view again.

There is an easy workaround by switching to another view (Synchronize, Git Staging) and back. After this, toolbar button suddenly appears (see menu_visible.png)


My configuration:
Eclipse Platform
Version: 2020-09 (4.17)
Build id: I20200824-0600
OS: Fedora 32 / gtk 3.24.21
Java version: 11.0.8
Comment 1 Martin Coufal CLA 2020-08-25 05:45:53 EDT
Created attachment 283959 [details]
menu_not_visible.png
Comment 2 Martin Coufal CLA 2020-08-25 05:46:14 EDT
Created attachment 283960 [details]
menu_visible.png
Comment 3 Andrey Loskutov CLA 2020-08-25 05:47:03 EDT
Sounds like a platform UI issue.
Comment 4 Martin Coufal CLA 2020-08-25 05:49:49 EDT
Forgot to mention my EGit version: 5.8.1.202007141445-r.
Comment 5 Andrey Loskutov CLA 2020-08-25 05:53:37 EDT
I can reproduce with I20200824-1900. This is not EGit issue, it is platform UI bug.

Martin - is this regression in 4.17 (I guess yes)?
Comment 6 Andrey Loskutov CLA 2020-08-25 06:24:15 EDT
Rolf, could it be the regression from recent changes on bug 90757 or bug 428697?
Comment 7 Rolf Theunissen CLA 2020-08-25 06:42:58 EDT
(In reply to Andrey Loskutov from comment #6)
> Rolf, could it be the regression from recent changes on bug 90757 or bug
> 428697?

Bug 90757 should not be related, the Toolbar and Viewmenu are created separately in the StackRenderer. Bug 428697 might be related.
More likely that it is caused by previous changes in the StackRenderer, though then I expected that the issue was already seen M3 and before. Issue could be related to Bug 564290, but I haven't been able to reproduce that while investigating the issue. Will try to do some digging tonight.
Comment 8 Andrey Loskutov CLA 2020-08-25 06:44:48 EDT
(In reply to Andrey Loskutov from comment #6)
> Rolf, could it be the regression from recent changes on bug 90757 or bug
> 428697?

If I've properly bisected that, regression seems to be already in 4.17 M1, and I can't reproduce it in 4.16.

My steps: 
1) have a project connected to git in the workspace.
2) Open Git perspective, close all other perspectives
3) Initially, History view is shown and it is empty, toolbar shows few buttons
4) Select repository in repositories view and History view shows the content - at this moment the view menu is not added to the toolbar, but many git buttons are added.
Comment 9 Andrey Loskutov CLA 2020-08-25 07:00:47 EDT
Regression is from bug 562892 commit 9b03a05a3907988a1a8f381e925471569875cba1.
Comment 10 Andrey Loskutov CLA 2020-08-25 07:05:52 EDT
(In reply to Rolf Theunissen from comment #7)
> More likely that it is caused by previous changes in the StackRenderer,

yes, I assume this change is the root cause: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/162592/10/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
Comment 11 Martin Coufal CLA 2020-08-25 08:03:30 EDT
(In reply to Andrey Loskutov from comment #8)
> (In reply to Andrey Loskutov from comment #6)
> > Rolf, could it be the regression from recent changes on bug 90757 or bug
> > 428697?
> 
> If I've properly bisected that, regression seems to be already in 4.17 M1,
> and I can't reproduce it in 4.16.
> 
> My steps: 
> 1) have a project connected to git in the workspace.
> 2) Open Git perspective, close all other perspectives
> 3) Initially, History view is shown and it is empty, toolbar shows few
> buttons
> 4) Select repository in repositories view and History view shows the content
> - at this moment the view menu is not added to the toolbar, but many git
> buttons are added.

Sorry for late reply, I see the issue in 4.17M1, but can't reproduce in 4.16 as well...
Comment 12 Rolf Theunissen CLA 2020-08-25 15:50:37 EDT
The problem is two fold:

1. The update of the top-right did not correctly respond to changes in children of a model element.
2. The childern of the menu model element are not even propagated to the menu, see Bug 543827. However, it is too risky to enable this synchronization now. I expect (and already seen) many unexpected interactions. Workaround is to call the update of the UI directly, bypassing the E4 model and renderers.
Comment 13 Eclipse Genie CLA 2020-08-25 15:51:38 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/168214
Comment 14 Lars Vogel CLA 2020-08-27 03:24:57 EDT
Thanks to Martin for the detailed steps to reproduce, Andrey for finding the related commit and Rolf for the fix.

I can confirm that the fix works for Martins scenario. Also a quick check did not show other toolbar / view related issues. But due to my personal time constrains  I'm not able to review / debug the patch in detail nor can I test a runtime Eclipse extensively. So I'm uncertain if we should merge this patch for 4.17 so shortly for the release.

Rolf, you are the best to judge how dangerous the fix is for 4.17. Would you recommend to merge the patch for 4.17? Or should we want and fix this in 4.18?
Comment 15 Rolf Theunissen CLA 2020-08-27 04:05:29 EDT
I notice that not only the History view menu is affected, also the Outline view has similar issues.

When the outline shows the view menu on startup (e.g. when a Java editor is already open) it does show. Otherwise it will not show, also not when an editor is opened. Only after switching tabs it will show. When the editors are closed, the view menu is not hidden. Only after switching tabs it will hide.

So I think that the impact of the issue is quite high. I consider the risk in the patch low, one part of the change is basically removing duplicate code (minus a bug in the duplication). 
The other part is forcing an update of the UI. This update can result in too many updates, but I don't think that will result in any issues.

I would recommend to merge this for 4.17.
Comment 17 Lars Vogel CLA 2020-08-28 05:16:38 EDT
(In reply to Rolf Theunissen from comment #12)
> 2. The childern of the menu model element are not even propagated to the
> menu, see Bug 543827. However, it is too risky to enable this
> synchronization now. I expect (and already seen) many unexpected
> interactions. Workaround is to call the update of the UI directly, bypassing
> the E4 model and renderers.

Thanks, Rolf for working on this. I assume you implemented the workaround. Shall we open a new bug for the model sync or is this handled by Bug 543827?
Comment 18 Rolf Theunissen CLA 2020-08-28 05:31:26 EDT
(In reply to Lars Vogel from comment #17)
> (In reply to Rolf Theunissen from comment #12)
> > 2. The childern of the menu model element are not even propagated to the
> > menu, see Bug 543827. However, it is too risky to enable this
> > synchronization now. I expect (and already seen) many unexpected
> > interactions. Workaround is to call the update of the UI directly, bypassing
> > the E4 model and renderers.
> 
> Thanks, Rolf for working on this. I assume you implemented the workaround.
> Shall we open a new bug for the model sync or is this handled by Bug 543827?

The sync is indeed the scope of Bug 543827. This issue again depends on the (nasty) add/remove story for toolbar and menu items. Therefore I chose for the workaround now. I do not expect a working solution for add/remove issues until late in the 4.18 cycle.
Comment 19 Rolf Theunissen CLA 2020-08-28 12:07:50 EDT
The force update call makes the toolbar in the outline view go crazy. Not all toolbar items are shown.
Without the force update the view menu is not hidden always and sometimes it never comes back after it is hidden.
Comment 20 Rolf Theunissen CLA 2020-08-29 10:02:32 EDT
(In reply to Rolf Theunissen from comment #19)
> The force update call makes the toolbar in the outline view go crazy. Not
> all toolbar items are shown.
> Without the force update the view menu is not hidden always and sometimes it
> never comes back after it is hidden.

The regression in this patch is caused by unexpected interactions with the patch for Bug 90757.

The root cause of the unexpected interaction is in ToolBarManager.update(true), the relayout method is not executed when the new number of elements is zero, even when force is requested. This corner case is missed in the patch of Bug 186800 Comment 18.
When the outline switches between tabs, it is shortly showing the default tab which doesn't have toolbar items. This together with the force layout call causes the toolbar to be rendered at a incorrect position.

The relayout method is protected, and the behavior that relayout will not execute when the new number of elements is zero is clearly on documented on the class. I am not going to patch this behavior, as I consider this an API change if changed.

Luckily, when the force layout is called after the toolbar is updated, the error-nous rendering does not occur either. The force layout does introduce another flicker, but that can be suppressed too. Patch will follow soon.
Comment 21 Eclipse Genie CLA 2020-08-29 10:12:22 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/168411
Comment 23 Wim Jongman CLA 2020-08-30 07:58:51 EDT
I verified this. I tried to provoke the symptoms but all behaves as expected. I'm running windows.
Comment 24 Martin Coufal CLA 2020-08-31 04:19:48 EDT
I just checked, it works for me as well, thanks!