Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Hiding commands' UI elements
Hiding commands' UI elements [message #491154] Tue, 13 October 2009 13:31 Go to next message
Joel is currently offline JoelFriend
Messages: 16
Registered: October 2009
Junior Member
Hello. I have a toggle Command that must toggle the visibility of four other Commands. They are all contributed to a view's toolbar as toolbar buttons. Does anyone know how to do this? Please help.

It sounds like it would be so simple, but I've been researching this and trying things for about 9 hours total now without any success. One thing I tried was having a static member variable in the toggle command's IHandler, which the other commands use in their isEnabled() methods to decide whether they should be enabled or not. The problem with this is that isEnabled() is only called at initialization (not to mention that the member having to be static means that it will toggle the commands in all instances of the view, but i'm desperate at this point.)
Re: Hiding commands' UI elements [message #491242 is a reply to message #491154] Tue, 13 October 2009 18:54 Go to previous messageGo to next message
Lars Vogel - out of office until 16.03.2020 is currently offline Lars Vogel - out of office until 16.03.2020Friend
Messages: 1094
Registered: July 2009
Senior Member

Hi,

I believe you are looking for activities in combination with your own
source provider.

This might help:

http://www.vogella.de/blog/2009/07/13/eclipse-activities/
http://www.vogella.de/articles/EclipseCommands/article.html# commmands_sourceprovider

Best regards, Lars


joel.becker@21csi.com wrote:
> Hello. I have a toggle Command that must toggle the visibility of four
> other Commands. They are all contributed to a view's toolbar as toolbar
> buttons. Does anyone know how to do this? Please help.
> It sounds like it would be so simple, but I've been researching this and
> trying things for about 9 hours total now without any success. One thing
> I tried was having a static member variable in the toggle command's
> IHandler, which the other commands use in their isEnabled() methods to
> decide whether they should be enabled or not. The problem with this is
> that isEnabled() is only called at initialization (not to mention that
> the member having to be static means that it will toggle the commands in
> all instances of the view, but i'm desperate at this point.)
>
Re: Hiding commands' UI elements [message #495431 is a reply to message #491242] Wed, 04 November 2009 20:21 Go to previous message
Joel is currently offline JoelFriend
Messages: 16
Registered: October 2009
Junior Member
Activities apparently only work on the whole workbench-scope; is there something that can show/hide UI elements depending on which view? For example, show them in one view, but hide them in another instance of the view (same view id).

<edit>Is there a way to do it with "contexts"? (org.eclipse.ui.context) </edit>

Thanks so much for that helpful information. This was a huge step. The SourceProvider came in useful for something too.

[Updated on: Wed, 04 November 2009 20:37]

Report message to a moderator

Re: Hiding commands' UI elements [message #603098 is a reply to message #491242] Wed, 04 November 2009 20:21 Go to previous message
Joel is currently offline JoelFriend
Messages: 16
Registered: October 2009
Junior Member
Activities apparently only work on the whole workbench-scope; is there something that can show/hide UI elements depending on which view? For example, show them in one view, but hide them in another instance of the view (same view id).

Thanks so much for that helpful information. This was a huge step. The SourceProvider came in useful for something too.
Previous Topic:Some inter-plug-in dependencies have not been satisfied
Next Topic:Adding multiple dynamic menus
Goto Forum:
  


Current Time: Tue Aug 04 21:12:29 GMT 2020

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

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

Back to the top