Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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: Tue Jul 01 13:53:31 EDT 2025

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

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

Back to the top