Bug 480386 - Narrow views cut of menu bar instead wrapping into additional row
Summary: Narrow views cut of menu bar instead wrapping into additional row
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2015-10-22 05:12 EDT by Andreas Sewe CLA
Modified: 2020-06-08 04:43 EDT (History)
4 users (show)

See Also:


Attachments
Narrow view with (partially) wrapped menu bar (13.76 KB, image/png)
2015-10-22 05:12 EDT, Andreas Sewe CLA
no flags Details
Screenshot Windows 10 Eclipse 4.14.0 (16.33 KB, image/jpeg)
2020-02-26 05:22 EST, Alexander Nittka CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2015-10-22 05:12:18 EDT
Created attachment 257433 [details]
Narrow view with (partially) wrapped menu bar

IMHO, the menu bar's wrapping behavior could be improve when a view is made very narrow (or simply has many icons in its menu bar).

At the moment, the triangle menu wraps to a new row (see screenshot) but the rest of the menu bar does not; instead, it is cut off (also see screenshot).

It would be great if the extra space in the additional menu line created for the triangle menu would be put to good use by moving some of the icons there as well.

If you want to be really fancy, you could prefer moving entire icon groups (as grouped by separators), but not cutting off icons would be a good start already.
Comment 1 Alexander Nittka CLA 2020-02-26 05:22:16 EST
Created attachment 281932 [details]
Screenshot Windows 10 Eclipse 4.14.0

The problem persists in Version 4.14.0. In one way the screenshot shows a worse behaviour. When the view gets narrow, the view menu drop down goes to a new line (OK for me, better than disappearing completely), but if the views own items don't fit and they move to the next line, the view menu adds *a further* line, even though there is enough space in the second line.
Comment 2 Lars Vogel CLA 2020-02-26 05:30:13 EST
Looks really bad. Patches / Gerrits are very welcome.
Comment 3 Alexander Nittka CLA 2020-02-26 05:51:22 EST
Could you give me a pointer where to start investigating/debugging? Is the Oomph setup for Eclipse Platform UI the correct project (any Interface/Class...)?
This would greatly help with helping.
Comment 4 Eclipse Genie CLA 2020-02-26 10:43:24 EST
New Gerrit change created: https://git.eclipse.org/r/158414
Comment 5 Alexander Nittka CLA 2020-06-08 03:15:55 EDT
The above change is not intended to solve the problem, but to make it reproducible during development. Toolbar entries are added to the TasksView and the bckground color changed, so that the space taken up by the toolbars becomes visible.

The cause for the unwanted behaviour is that there are not one but two toolbars, one from the StackRenderer for the view menu drop down and one from the ToolBarManager. When wrapping they both claim the entire width of the second row.

Possible approaches:
* using one toolbar only, i.e. the ToolBarManager reuses the StackRenderer's toolbar; which might be complicated as both dynamically change the menu content
* prevent a toolbar to claim the entire width in its last row (in Java/Css?)
* other

I am lacking the know-how with respect to rendering internals to deal with this problem without pointers/support.
Comment 6 Rolf Theunissen CLA 2020-06-08 04:15:46 EDT
In StackRenderer#addTopRight the widget of the top-right of the CTabFolder is created. This is a Composite with a RowLayout.

The top-right is indeed used to render both the Part toolbar as well as the view menu (in a toolbar). From a E4 model point of view, it would be very difficult to combine the two items into one toolbar.

The problem should also be fixed when no CSS is used.

I think the solution should be found in either:
1) A possible (SWT) bug in how CTabFolder calculates the topright size/layout
2) How the RowLayout is applied. It seems that it is applied to the two ToolBars in the top-right, and then whatever layout is inside the toolbars (probably a row layout as well?).

Most likely the problem is in 2, how is the layout of a two nested composites handled? Can it 'ignore' the outer layout for the toolbars and consider all elements individually. But I am not really familiar in this area.
Comment 7 Rolf Theunissen CLA 2020-06-08 04:43:11 EDT
Another solution direction might be to keep the view menu always in the most top-right part, and let only the other toolbar wrap. So it will not be the last item in the toolbar, but always the most top-right one.
It might even be combined with the min/max icons, so that the view menu will never wrap. Maybe this gives even the best user experience.