Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Commands and Context Menus
Commands and Context Menus [message #335327] Wed, 01 April 2009 15:59 Go to next message
Bryan Coon is currently offline Bryan CoonFriend
Messages: 5
Registered: July 2009
Junior Member
I am using the eclipse commands and menus to generate a context menu.
This works fine.

The context menu is dynamic, so I have implemented the appropriate classes
derived from AbstractHandler, this is also fine.

The problem is that based on the user right click selection I want to
remove items from the context menu. Not disable, but completely remove.

The command expressions do not seem to be sufficient, since I can only use
a selection event variable. I am using a generic object as the selection,
and I need to examine a member variable to check if the context item
should be displayed. No way to do this with expressions that I have found.

So, is there any way from the updateElement() method in AbstractHandler to
really remove a context menu item?
Re: Commands and Context Menus [message #335333 is a reply to message #335327] Wed, 01 April 2009 18:58 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You would use a visibleWhen on your selection, and then a property
tester to test a specific member variable of your selection object. See
org.eclipse.core.expressions.propertyTesters.

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


Previous Topic:global action (registration) listener
Next Topic:Enable Disable a version of plugin progamatically
Goto Forum:
  


Current Time: Thu Dec 26 12:41:37 GMT 2024

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

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

Back to the top