|Re: How to update the checked state of a command per window? [message #336469 is a reply to message #336465]
||Mon, 15 June 2009 15:58
Originally posted by: eclipse-newsgroups.scharf.gr|
thank you for the answer! (I'll try this out
How would I figure all this out without asking the
newsgroup? I feel really stupid and I don't know
how to figure out all the complexity of commands.
Maybe a set of relatively simple examples would help a lot.
It turns out that the actual code that gets executed int
the handler is not the problem. The problem is hooking
the handlers and commands into the application which
includes plugin.xml and window.getService(IHandlerService.class)
all things that are very hard to figure out.
> Your handler would be updating the state after implementing
> IElementUpdater. But ...
> You would need to use
> org.eclipse.ui.commands.ICommandService.refreshElements(Stri ng, Map) to
> request that the command update its checked state when the active window
> changes, so it can reflect the correct state.
> Commands in 3.x run off of a global application context. There is also
> only one global command (backed by the currently active handler), so
> within one window it becomes impossible to show different states for one
> command. Between windows, it might just be possible assuming you are
> updating your state to the correctly active window.
> Or instead of one handler that needs to manage the state for the
> application, programmaticly activate a handler when creating each
> separate window using window.getService(IHandlerService.class) to get
> the IHandlerService in each case (since that will scope the handler to
> that window only).
Wind River Systems GmbH
Powered by FUDForum
. Page generated in 0.02080 seconds