Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to change the caption of a button in the eclipse main toolbar
How to change the caption of a button in the eclipse main toolbar [message #697049] Fri, 15 July 2011 08:09 Go to next message
davidpfander is currently offline davidpfander
Messages: 2
Registered: July 2011
Junior Member
Hi,

I'm quite new to eclipse (and very new to this forum) and currently developing a small plugin. This plugin contributes a button to the main toolbar. Now, the actual problem is the following:
How can I change the caption of the button programmatically?

The button is already associated with a action and I can change the caption through the "setText()" method. However, I want the caption to change on activation of the MultiPageEditorPart that is a part of my plugin. I don't know how to fetch the action. I don't know how to fetch the widget, which would be an alternative.

I'd like to know as well, how this is done stylistically the right way.

Every input is appreciated.

Greetings...
Re: How to change the caption of a button in the eclipse main toolbar [message #697998 is a reply to message #697049] Mon, 18 July 2011 11:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I know how to do it with commands. You contribute your command to the main toolbar using org.eclipse.ui.menus and you make your handler implement org.eclipse.ui.commands.IElementUpdater. When an event occurs such that you need to update the UI elements that represent your command, you use org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) to request a refresh, which will cause calls to your handler's updateElement(*) method.

In the case of actions contributed to the main toolbar, especially through the now deprecated org.eclipse.ui.actionSets, you are only given a chance to change the action's UI on selection changed events.

PW


Re: How to change the caption of a button in the eclipse main toolbar [message #699788 is a reply to message #697998] Fri, 22 July 2011 06:02 Go to previous message
davidpfander is currently offline davidpfander
Messages: 2
Registered: July 2011
Junior Member
Thx a lot for your informations. I think I will have to change my actions into commands.

Thx again,
David
Previous Topic:Building Eclipse From Source
Next Topic:Howto observe external folder with IResourceChangeListener
Goto Forum:
  


Current Time: Wed Aug 27 15:24:14 EDT 2014

Powered by FUDForum. Page generated in 0.01739 seconds