Hide/unhide a toolbar inside a coolbar [message #329065] |
Wed, 11 June 2008 18:11 |
Eclipse User |
|
|
|
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 #329190 is a reply to message #329144] |
Mon, 16 June 2008 15:57 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02522 seconds