Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Creating dynamic tooltips on a views toolbar
Creating dynamic tooltips on a views toolbar [message #516655] Wed, 24 February 2010 16:59 Go to next message
Andy Coleman is currently offline Andy ColemanFriend
Messages: 33
Registered: September 2009
Member
Hi,

I have a view which contains a table and have declared a menu on the toolbar which allows us to filter the contents of the table. I would like to provide a tooltip on the button generated on the toolbar which describes the current state of the filter but it seems that I am not able to modify the tooltip.

The menu on the toolbar is declared in the plugin.xml as follows

<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="toolbar:com.mycompany.MyView">
<command
commandId="com.mycompany.ui.filters.menu"
icon="icons/filter.gif"
label="Filter Menu"
style="pulldown"
tooltip="Filter Menu"
</command>
</menuContribution>
</extension>

The pull down menu is generated and functions correctly. But it does seem that the tooltip text ('Filter Menu') cannot be changed programatically.

Any help in how to solve this would be appreciated

Thanks
Andy
Re: Creating dynamic tooltips on a views toolbar [message #516686 is a reply to message #516655] Wed, 24 February 2010 18:58 Go to previous messageGo to next message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

Hello Andy

I had a similar problem; the only difference with your situation was that my pull-down menu was in the main toolbar not in the view toolbar. I assume that the solution will work also for a view toolbar (not tested this).

My solution was to create a dynamic contribution to the main toolbar and in the code of the dynamic contribution I was able to change the tooltip (actually I changed the image but I could change also the tooltip if I needed to).

I started from this example http://eclipsesource.com/blogs/2009/03/31/replacing-the-pers pective-switcher-in-rcp-apps/ and I needed that my toolbar contribution to be a pull-down menu containing the existing perspectives. When the perspective was changed I needed that image of the icon of the pull-down contribution to be changed to the image of the new perspective. Also another change was to make the menu appear also when the image was clicked (the default implementation is to have the menu appear only when the arrow is clicked).

HTH
Catalin


Time is what you make of it.
Re: Creating dynamic tooltips on a views toolbar [message #516918 is a reply to message #516655] Thu, 25 February 2010 14:10 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you make your handler an IElementUpdater then you can use
org.eclipse.ui.menus.UIElement.setTooltip(String) to change the tooltip.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:IFolder.move() gives exception on windows machine
Next Topic:Common Navigator Framework: avoid showing file
Goto Forum:
  


Current Time: Fri Apr 19 04:04:12 GMT 2024

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

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

Back to the top