Hiding MenuContributions based Command ID [message #479603] |
Tue, 11 August 2009 12:53  |
Eclipse User |
|
|
|
All,
I have an RCP application whose Menus/Toolbars are all contributed via the
MenuContribution extension points. I need a way to be able to "dynamically"
be able to hide/unhide menu contributions via command ID.
I do not what to have to manually add an additional expression to all my
visibleWhen clauses. This needs to be a final override where I can veto the
display menuContributions from a list of commands to be suppressed from an
external data source.
Any suggestions?
I am using Eclipse RCP 3.5.
-Stu Pond
|
|
|
Re: Hiding MenuContributions based Command ID [message #479621 is a reply to message #479603] |
Tue, 11 August 2009 13:58  |
Eclipse User |
|
|
|
Using the visibleWhen is the system supported method of managing visibility correctly. Especially if are contributing the commands, you can provide your own ISourceProvider (the list of command ids to show or not show) using org.eclipse.ui.services or provide a property tester and call org.eclipse.ui.services.IEvaluationService.requestEvaluation (String) and have the system update appropriately for all of the menus, toolbars, and popups.
Other than that, there are static ways to remove commands from plugin.xmls, but it involves hackery.
In 3.5 there was extra support added for the CustomizePerspectiveDialog to remove specific menu and toolbar items from the main menu and main toolbar. It is statically available from the IPerspectiveFactory and org.eclipse.ui.perspectiveExtensions EP, but there is no dynamic, programmatic API (it is really an experimental feature).
PW
|
|
|
Powered by
FUDForum. Page generated in 0.02134 seconds