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

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?

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:

<with variable="activeEditorId">
<test property="com.example.inMyExtension"/>

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.


Paul Webster 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:

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

Previous Topic:getWebBrowser returns null
Next Topic:CNF: Eclipse copy/cut/paste override
Goto Forum:

Current Time: Mon Apr 23 05:27:19 GMT 2018

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

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