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

Bug 350044

Summary: ToolItem.setWidth(SWT.SEPARATOR_FILL) does not do what the JavaDoc promises
Product: [Eclipse Project] Platform Reporter: Thomas Singer <eclipse>
Component: SWTAssignee: Carolyn MacLeod <carolynmacleod4>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, Silenio_Quarti
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Thomas Singer CLA 2011-06-22 08:48:41 EDT
Build Identifier: 3.7.0.v3735b

Create a toolbar separator using following code:

final ToolItem separator = new ToolItem(toolBar, SWT.SEPARATOR);
separator.setWidth(SWT.SEPARATOR_FILL);

It will not work (on Windows), because the SWT.SEPARATOR_FILL = -2 but the code returns if width < 0.

Reproducible: Always
Comment 1 Felipe Heidrich CLA 2011-06-22 10:14:17 EDT
Silenio, isn't SEPARATOR_FILL a hint ?
If so we need to say it in the doc.
Comment 2 Silenio Quarti CLA 2011-06-22 10:35:07 EDT
Yes, it is a hint currently. It only works for Mac/Cocoa shell toolbar (i. e. Shell.getToolBar()).

Car, could you update the java doc?
Comment 3 Thomas Singer CLA 2011-06-22 11:04:26 EDT
So there is currently no possibility to provide stretching separators on non-OSX systems, except of rewriting the whole toolbar stuff?
Comment 4 Silenio Quarti CLA 2011-06-23 10:21:23 EDT
I believe it is possible to implement it on top of the toolbar by adding a resize listener to the toolbar and dynamically changing the size (ToolItem.setWidth()) of a SWT.SEPARATOR item (as long as the toolbar is not wrappable).

Currently, SWT.SEPARATOR_FILL items are treated the same as if they were SWT.SEPARATOR items in non MacOSX systems and on MacOSX for normal toolbars (toolbars other then Shell.getToolBar()).
Comment 5 Lars Vogel CLA 2019-11-14 03:21:57 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.