Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Hide/unhide a toolbar inside a coolbar
Hide/unhide a toolbar inside a coolbar [message #329065] Wed, 11 June 2008 18:11 Go to next message
Eclipse UserFriend
Originally posted by: rth_morpheus.web.de

Hi,
I have a problem with the visibility of coolbars in an rcp-project. I
have several toolbars inside the main coolbar, for which I want to
implement a functionality to hide/unhide them (quite similar to the
standard eclipse functionality window -> customize perspective). I use
the extension org.eclipse.ui.menu to add a number of toolbars to the
default one:

<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar id="com.dcx.ivkmds.application.rcs.toolbar.edit">
...
</toolbar>
<toolbar id=...
...
</toolbar>
</menuContribution>

I tried several approaches to set the visibility of each single toolbar,
but none of them seems to work properly.
First, I tried to set the visibility programatically:

ApplicationWindow window = (ApplicationWindow)
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ICoolBarManager coolbarManager = window.getCoolBarManager2();

coolbarManager.getItems() returns the correct list of ContributionItems,
but calling setVisible() on any of them doesn't change anything.

My second approach was a property tester. Though I can't seem to hide
the toolbar itself, I can hide its commands. But when I try to change
the visibility back to true, again nothing happens (as far as I know the
property tester only reacts on events, when I set the focus on another
window and back to the application, the toolbar is shown again).

I would appreciate any help, I'm quite desperate and I don't want to
change it all back to actionSets, although this might be working.


Thanks for your help.

Regards,

Robert
Re: Hide/unhide a toolbar inside a coolbar [message #329144 is a reply to message #329065] Fri, 13 June 2008 17:14 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The toolbars should hide when all of their contained items are not
visible. While the menuContribution/toolbar element takes a visibleWhen
clause it doesn't work in 3.3/3.4 -
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201589

The commands will respond correctly to the visibleWhen. If you use a
property tester, then you will need to ask the IEvaluationService to
re-evaluate for that particular property (which is only available in 3.4)

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


Re: Hide/unhide a toolbar inside a coolbar [message #329190 is a reply to message #329144] Mon, 16 June 2008 15:57 Go to previous message
Eclipse UserFriend
Originally posted by: rth_morpheus.web.de

Paul Webster schrieb:
> The toolbars should hide when all of their contained items are not
> visible. While the menuContribution/toolbar element takes a visibleWhen
> clause it doesn't work in 3.3/3.4 -
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=201589
>
> The commands will respond correctly to the visibleWhen. If you use a
> property tester, then you will need to ask the IEvaluationService to
> re-evaluate for that particular property (which is only available in 3.4)
>
> PW
>
>

Thanks Paul, hiding the items the toolbar contains just worked. Though I
have no idea, why it didn't before. However, this solution should be
sufficient.

Regards


Robert
Previous Topic:Text Editor | composite
Next Topic:Update jars of "Plug-in for existing Jar archives"
Goto Forum:
  


Current Time: Fri Aug 16 11:21:35 GMT 2024

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

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

Back to the top