Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Get a command id from within a handler?
Get a command id from within a handler? [message #645197] Wed, 15 December 2010 21:42 Go to next message
Stefan Ruzitschka is currently offline Stefan RuzitschkaFriend
Messages: 16
Registered: December 2010
Junior Member
Hi Folks,

we use the command id plus a suffix for the translation of our GUI.

For example:

commandId = "com.company.package.commands.mycommand"
suffix1 = ".label"
suffix2 = ".tooltip"

So we concatenate the commandId and several suffixes to get an unique translationId.

The handler implements IElementUpdater and extends AbstractHandler

The idea is to get the commandId from within a handler to set the text to an UIElement in the updateElement method.

For example:

String commandId = commandIdGettingMechanism(this);
String tooltipText = translationMechanism(commandId + suffix1);

element.setTooltip(tooltipText);

The question now is:
Is there a way to do it?

Is a registry of all handlers with their commands a good way to implement this? Any ideas?

Greetings
Stefan R.
Re: Get a command id from within a handler? [message #645223 is a reply to message #645197] Thu, 16 December 2010 05:13 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
You can get the command from the ExecutionEvent passed as a parameter
to the handler.execute() method

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Get a command id from within a handler? [message #645244 is a reply to message #645197] Thu, 16 December 2010 08:48 Go to previous messageGo to next message
Stefan Ruzitschka is currently offline Stefan RuzitschkaFriend
Messages: 16
Registered: December 2010
Junior Member
Hmm yeah I know, but the problem is, that the handler.execute() method is called, when you fire the command and normally it's done by an user interaction. I want to decorate the UIElement before the command is fired...
Re: Get a command id from within a handler? [message #645352 is a reply to message #645244] Thu, 16 December 2010 17:16 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 16/12/10 2:18 PM, Stefan R. wrote:
> Hmm yeah I know, but the problem is, that the handler.execute() method
> is called, when you fire the command and normally it's done by an user
> interaction. I want to decorate the UIElement before the command is
> fired...

May be this would work. Make your handler implement
IExecutableExtension and in the plugin.xml when you declare the handler,
pass on the command id as the data.

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:Embarrassingly basic Eclipse-on-Mac q
Next Topic:Exception while performing file search
Goto Forum:
  


Current Time: Tue Apr 23 15:30:43 GMT 2024

Powered by FUDForum. Page generated in 0.03520 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top