Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Dynamic visibility toolbar button
Dynamic visibility toolbar button [message #336317] Mon, 08 June 2009 08:58 Go to next message
Alexia Allanic is currently offline Alexia AllanicFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I use org.eclipse.ui.menus to have a dynamic menu in toolbar. I want to
have a button in the toolbar activated and visibled only when the current
editor is one of editors "save" in my extension point.
First, I try to use an Adapter with the property visibleWhen.
Next, I try to overwrite the method isVisible of ContributionItem class
but the active editor is not loading before the method call.
This two solutions don't work, someone has an other idea?

Thanks
Re: Dynamic visibility toolbar button [message #336325 is a reply to message #336317] Mon, 08 June 2009 16:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

So you have an extension point with a couple of editor IDs, and you want
your toolitem to be visible when the active editor is one of these IDs?

If that is the case, your visibleWhen would look like:


<visibleWhen>
<with variable="activeEditorId">
<test property="com.example.inMyExtension"/>
</with>
</visibleWhen>
[/xml]

then write a property tester that can compare the string ID with your
list of IDs.

If this is not your usecase, please provide more details.

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/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Dynamic visibility toolbar button [message #336341 is a reply to message #336325] Tue, 09 June 2009 08:41 Go to previous message
Eclipse UserFriend
Originally posted by: alexia.allanic.atosorigin.com

Thanks!! Use a property tester works very well.
It's the solution I tried to do.
Thanks a lot

Alexia
Previous Topic:Menu adjust
Next Topic:eclipse.ini listing very specific plugins - problem when updating ?
Goto Forum:
  


Current Time: Sun Dec 21 00:38:56 GMT 2014

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

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