Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to use IElementUpdater
How to use IElementUpdater [message #986253] Mon, 19 November 2012 11:15 Go to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

I have an editor with a context menu. This menu contains a command. I would like to change the command label in that menu based on the editor's selection, so my handler for that command implements IElementUpdater.

The problem is that the IElementUpdater.update() is not called until the handler is first executed. This is because eclipse wraps the handler into HandlerProxy object.

It swallows all update calling until the real handler is loaded (when first time executed).

How can I force the HandlerProxy load my handler?? Is there any other workaround for this?

Thanks
Re: How to use IElementUpdater [message #986310 is a reply to message #986253] Mon, 19 November 2012 15:52 Go to previous messageGo to next message
Simon Scholz is currently offline Simon Scholz
Messages: 73
Registered: April 2012
Location: Germany
Member
Hello Jan,

I would suggest you to use a dynamic menuContribution and use a subclass of a org.eclipse.ui.actions.CompoundContributionItem for it.
Inside that CompoundContributionItem you could build a org.eclipse.ui.menus.CommandContributionItem with your desired label.

Best regards,

Simon
Re: How to use IElementUpdater [message #986383 is a reply to message #986310] Tue, 20 November 2012 05:01 Go to previous message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Amazing, thanks a lot!
Previous Topic:Prodouct files all my icons are gone
Next Topic:Database layer via ExtensionPoint, classloading issues
Goto Forum:
  


Current Time: Wed Aug 27 19:15:41 EDT 2014

Powered by FUDForum. Page generated in 0.03718 seconds