Initializing menu command checked state [message #30387] |
Fri, 31 October 2008 06:04 |
Eclipse User |
|
|
|
Hello all,
Eclipse newbie, so I'm not sure if I'm posting in the right place. I also
haven't quite got the hang of the eclipse rcp vocab so I apologize in
advance.
Anyway, I've got a menu with some commands declared in plugin.xml. The
desired function of these commands is simple enough - I have one view per
command and I want to be able to toggle these views. A first click would
display the view and a second close it... The commands are declared with a
toggle style and so I would like for the command to be checked when a view
is displayed and unchecked when a view is closed. On the surface this
seems simple enough, but it has turned out to be a 2 day nightmare at the
end of which I only have the above partially working.
I've got handlers for these commands that are able to show or hide their
respective views and also implement IElementUpdater to set the checked
state of the menu commands. Everything works fine once the command has
been clicked once by the user. Therein lies the problem, however. At
startup, none of the commands are checked whether or not their respective
views are displayed or closed.
I've tried the following code after the active page has been opened to no
avail:
ICommandService service =
(ICommandService)theActiveWindow.getService(ICommandService. class);
service.refreshElements("My.handler.id", null);
where My.command.id is of course my handler's id.
Anyone have any other ideas?
Thanks,
Matt
|
|
|
Powered by
FUDForum. Page generated in 0.05273 seconds