Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Hiding MenuContributions based Command ID
Hiding MenuContributions based Command ID [message #479603] Tue, 11 August 2009 16:53 Go to next message
stuart pond is currently offline stuart pondFriend
Messages: 11
Registered: July 2009
Junior Member
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 17:58 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:Wait for async
Next Topic:Re: Building tables made easy: TableViewerBuilder
Goto Forum:
  


Current Time: Sat Apr 27 03:03:33 GMT 2024

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

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

Back to the top