score:1

Accepted answer

the solution involves having the command handler implement the ielementupdater interface. the ui element can then be updated as so:

public void updateelement(uielement element, map parameters) 
{
    element.setchecked(isselected);     
}

updateelement is called as part of a ui refresh which can be invoked from the handler's execute command as so:

     icommandservice service = (icommandservice) handlerutil
       .getactiveworkbenchwindowchecked(event).getservice(
           icommandservice.class);
   service.refreshelements(event.getcommand().getid(), null);

lots more info here (see radio button command and update checked state entries)

score:1

maybe things have changed, maybe there's a difference between rcp and an eclipse plug-in, but i just set the style of my action to toggle, and it handled the toggling automatically. you can see the source code on github.com.

     <action
           class="live_py.enableaction"
           id="live-py.enable.action"
           label="li&amp;ve coding"
           menubarpath="pygeneralmenu/pynavigategroup"
           state="false"
           style="toggle">

to see whether the feature is currently enabled, i just look up the action by its id, and then call ischecked().


Related Query

More Query from same tag