Skip to main content


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 12:09 Go to next message
davidpfander is currently offline davidpfanderFriend
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 15:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
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 10:02 Go to previous message
davidpfander is currently offline davidpfanderFriend
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: Fri Apr 26 19:46:55 GMT 2024

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

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

Back to the top