Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Plugin context menu conditions
Re: Plugin context menu conditions [message #659112] Fri, 11 March 2011 06:01 Go to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 3/11/2011 1:13 AM, ShatyUT wrote:
> I have a plugin project going. I am able to add a command to the context
> menu but I would like to be able to execute some Java code to determine
> if the item should be added to the menu. Is that possible?
>
> I've seen plenty of examples for checking for count and stuff...even if
> the element is an instandOf a specific class but I need to narrow it
> down even further. Does someone have any examples of how to point to a
> method of a Java class that will return true or false to determine
> whether to display the menu item?
>
> Thanks for any help!

You want eclipse.platform newsgroup, cc'ing.
Re: Plugin context menu conditions [message #659194 is a reply to message #659112] Fri, 11 March 2011 12:49 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/11/2011 01:01 AM, Deepak Azad wrote:
> On 3/11/2011 1:13 AM, ShatyUT wrote:
>> I have a plugin project going. I am able to add a command to the context
>> menu but I would like to be able to execute some Java code to determine
>> if the item should be added to the menu. Is that possible?

Use the org.eclipse.core.expressions.propertyTesters extension point and
a subclass of org.eclipse.core.expressions.PropertyTester. Read the
visibleWhen clause in the org.eclipse.ui.menus extension point
description for info on how to use <test/>

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Listening for events on the workbench
Next Topic:2 different editors
Goto Forum:
  


Current Time: Thu Apr 25 14:56:50 GMT 2024

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

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

Back to the top