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

Bug 466233

Summary: Toolbar items are rendered into a "drop-down" even though there is space for them
Product: [Eclipse Project] Platform Reporter: Marc-André Laperle <malaperle>
Component: UIAssignee: Marc-André Laperle <malaperle>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, Lars.Vogel, loskutov, tom.schindl
Version: 4.5Flags: loskutov: review+
Lars.Vogel: review+
Target Milestone: 4.5 RC1   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/46994
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=eeb7a74f1699f48df5de1ced578ff14e8f05ca08
Whiteboard:
Attachments:
Description Flags
Sample plugin
none
Drop-down in toolbar screenshot none

Description Marc-André Laperle CLA 2015-05-03 13:09:59 EDT
Created attachment 253108 [details]
Sample plugin

Using Eclipse 4.5-I20150502-1500

1. Import the attached sample plugin
2. Open the toolbar.target file with the Target Platform Editor. Set as target platform (top-right corner of the editor)
3. Run as Eclipse Application. Make sure the product selected in the launch is org.eclipse.sdk.ide because this affects the initial perspective (Java).

The debug toolbar has a large empty space followed by a drop-down button containing some commands. I will attach a screenshot to show the result.

This only happens the first time, when the welcome screen is shown. To reproduce the issue again, you can edit your launch configuration to have the workspace cleared automatically.
Comment 1 Marc-André Laperle CLA 2015-05-03 13:11:09 EDT
Created attachment 253109 [details]
Drop-down in toolbar screenshot
Comment 2 Marc-André Laperle CLA 2015-05-03 13:14:10 EDT
I should add that switching to the Debug perspective fixes the problem, the toolbar items are drawn properly.
Comment 3 Eclipse Genie CLA 2015-05-03 15:20:31 EDT
New Gerrit change created: https://git.eclipse.org/r/46994
Comment 4 Marc-André Laperle CLA 2015-05-03 15:22:09 EDT
In the sample plugin, there are two commands in the toolbar of interest: "Test command" and Skip breakpoints. Test Command is added to the toolbar first. Then the toolbar and the toolbar's parent are packed in ToolBarManagerRenderer.subscribeTopicUpdateToBeRendered. At that point, the TrimBarLayout has a cache filled with the toolbar's size accounting only for the size of the Test Command. Then the Skip breakpoints is added but the TrimBarLayout's cache is never flushed or refreshed. This is similar to what I mentioned in bug 463245 comment 20. This layout does not adhere to the computeSize/layout methods contract to flush the cache when the flushCache == true. I tried this and it fixes this issue. In bug 463245 comment 20, I mentioned that this broke dragging the toolbars but I do not see any problem on GTK2/GTK3. I will test it on Windows and Mac to make sure.
Comment 5 Andrey Loskutov CLA 2015-05-10 17:26:07 EDT
+1 from me to include in 4.5. I can reproduce the bug on GTK3 only (GTK2 is not affected), the fix makes sense, works on GTK3 and has no visible impact on GTK2. 

@Tom, Lars - can you please review if you have time, we need a second +1?
Comment 6 Lars Vogel CLA 2015-05-11 05:37:03 EDT
(In reply to Andrey Loskutov from comment #5)
> +1 from me to include in 4.5. I can reproduce the bug on GTK3 only (GTK2 is
> not affected), the fix makes sense, works on GTK3 and has no visible impact
> on GTK2. 
> 
> @Tom, Lars - can you please review if you have time, we need a second +1?

I suggested a minor change in the review, but if that is adjusted +1 from me.
Comment 7 Lars Vogel CLA 2015-05-12 04:25:27 EDT
(In reply to Andrey Loskutov from comment #5)
> @Tom, Lars - can you please review if you have time, we need a second +1?

Done, feel free to merge.
Comment 9 Andrey Loskutov CLA 2015-05-12 14:53:26 EDT
Thanks Marc-Andre.