| CommandContributionItem does not set checkedState for radio styles [message #789502] |
Thu, 02 February 2012 22:40  |
Kevin Pfarr Messages: 5 Registered: July 2009 |
Junior Member |
|
|
I'm using the RCP version 3.7.1 and ran into an issue with menu contributions having a radio style.
I have a view with commands contributed to the view's toolbar using the org.eclipse.ui.menus extension point. The menu contributions have a radio style. The command handlers implement IElementUpdater so it can call setChecked on the element. Here is the problem. The setChecked method in the CommandContributionItem class is not getting past the first if block. That is because the checkedState field is getting set in the handleWidgetSelection method for styles SWT.TOGGLE or SWT.CHECK but not SWT.RADIO. If you include SWT.RADIO it works as expected.
I have a work around by calling setChecked twice; first is the inverse followed by the actual value. But I think this is a bug that should be looked into further.
I have attached a sample plug-in to demonstrate the issue. Open the Radio Toolbar view. Click the Radio 2 button, then click the Toggle Toolbar state button. The selection listener of the button will refresh the commands, calling the setChecked method on the elements.
-Kevin
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04963 seconds