Bug 539914 - JFace Action should support drop-down AND checkbox
Summary: JFace Action should support drop-down AND checkbox
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.9   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-08 06:48 EDT by ian mayo CLA
Modified: 2020-03-08 03:04 EDT (History)
4 users (show)

See Also:


Attachments
Toggle button with drop-down menu (36.73 KB, image/png)
2018-10-08 08:07 EDT, ian mayo CLA
no flags Details
SWT Example of drop-down menu, missing checkbox (18.19 KB, image/png)
2018-10-08 08:14 EDT, ian mayo CLA
no flags Details
Split button custom implementation (35.76 KB, image/png)
2018-10-08 13:51 EDT, Wim Jongman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ian mayo CLA 2018-10-08 06:48:06 EDT
The style bit supplied to the JFace Action widget only supports a single one of the available styles.

But, I wish to provide my users with a toggle-button that has a built-in drop-down menu. This drop down is to modify the behaviour of the state that is being switched on and off.

This is typical of the UI element called a Split Button.

I believe the current drop-down behaviour also implicitly supports Push behaviour.

It would be logical to allow one of Push, Radio, Checkbox, optionally OR'd with a Drop-Down style bit. This would allow the drop-down capability to be added to any of the three styles of button.
Comment 1 Wim Jongman CLA 2018-10-08 07:26:52 EDT
(In reply to ian mayo from comment #0)

Thanks for filing. Can you describe a use case?
Comment 2 ian mayo CLA 2018-10-08 08:07:05 EDT
Created attachment 276158 [details]
Toggle button with drop-down menu
Comment 3 ian mayo CLA 2018-10-08 08:14:46 EDT
Created attachment 276159 [details]
SWT Example of drop-down menu, missing checkbox
Comment 4 ian mayo CLA 2018-10-08 08:17:08 EDT
Here's a use case.  In our UI we have a record button.  The button has a toggle behaviour, controlling whether recording is happening.

The button also has a drop-down menu, that indicates where the audio stream should come from, once recording starts.

See attachment titled "Toggle button with drop-down menu" for detail.

For an example in the Eclipse context, see the second attachment, titled "SWT Example of drop-down menu, missing checkbox". In the second example the button should have a toggle behaviour to control whether a grid is rendered in the graphical editor. The drop-down menu is used to quickly/interactively control the separation of the grid lines on the graphical editor.
Comment 5 Wim Jongman CLA 2018-10-08 13:51:32 EDT
Created attachment 276172 [details]
Split button custom implementation

It looks like you know what you are doing. Would you mind submitting a patch through Gerrit? [1]

Alternatively, this is really easy implemented yourself. Just make a composite with any button and a drop-down icon (v).

I have recently implemented this on the tip of the day framework. See [2] for inspiration.


[1] https://wiki.eclipse.org/Platform_UI/How_to_Contribute#Creating_a_Gerrit_review_or_a_patch

[2] https://github.com/eclipse/eclipse.platform.ua/blob/master/org.eclipse.tips.ui/src/org/eclipse/tips/ui/internal/TipComposite.java#L187
Comment 6 Lakshmi P Shanmugam CLA 2018-10-11 02:11:05 EDT
Moving to Platform UI.
Comment 7 ian mayo CLA 2018-11-20 01:58:08 EST
Wim, I don't think the provision of a new SWT Widget is the solution here.

In an RCP Toolbar, only JFace Actions are defined. The framework then controls how to realise that Action.

The existing JFAce action constants don't allow for a control to have both Toggle _and_ drop-down behaviour.

That seems to be the first challenge, with rendering the multi-state behaviour in SWT being the follow-up challenge.
Comment 8 Christoph Laeubrich CLA 2020-03-08 03:04:23 EDT
I think the main problem is that SWT-Button itself does not allow to mix styles, does anyone know if this is a restriction of the native widgets itself?

Nebula already provides such a button: https://wiki.eclipse.org/Nebula_NebulaSplitButton but native SWT support would be nice as it e.g. allows for the e4-render to use that, currently it is possible to define a toolitem of type radio with a menu, this is then rendered as a "plain" button because of this so the user does not see the "checked" state (even though it works as expected).