views:

293

answers:

2

I have a menu drop down action in the coolbar. It has 3 sub items that form a radio group. I would like to change the icon shown in the coolbar when the user selects one of these options.

I've googled and seen that I should look at: org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) and org.eclipse.ui.commands.IElementUpdater

Its probably the right thing to look at exception its not enough information. One or two small code snippets will be excellent.

Thanks in advance.

+1  A: 

Every update to the Coolbar points to the specialization of the WorkbenchWindowControlContribution class.

This bug 186800 has some code example in it which can be of interest.

VonC
Thanks for this ... but i found a way to do it without having to create my own control via the workbenchWindowControlContribution... Although i'm going to use this in the future for when i need to add different type of widgets to the toolbar/coolbar...
Craig
+1  A: 

Ok basically if you don't want to use a "custom" control the what to do it is to have your handler (handler that is linked to the specific command) implement IElementUpdater. When every the toolbar item gets shown or clicked on (i.e if the user selects on the the radio buttons) the method: updateElement(UIElement element, Map parameters) gets called. The element has a setIcon() method and this is what i used to change the icon of the menu drop down action.

Craig
Very interesting feedback. Thank you. +1
VonC