Summary: | JFace Action should support drop-down AND checkbox | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | ian mayo <ian> | ||||||||
Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> | ||||||||
Status: | NEW --- | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P3 | CC: | ian, laeubi, lshanmug, wim.jongman | ||||||||
Version: | 4.9 | ||||||||||
Target Milestone: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
ian mayo
2018-10-08 06:48:06 EDT
(In reply to ian mayo from comment #0) Thanks for filing. Can you describe a use case? Created attachment 276158 [details]
Toggle button with drop-down menu
Created attachment 276159 [details]
SWT Example of drop-down menu, missing checkbox
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. 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 Moving to Platform UI. 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. 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). |