Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Popup Menu "Test" definition not working
Popup Menu "Test" definition not working [message #327704] Tue, 29 April 2008 13:12 Go to next message
Eclipse UserFriend
Originally posted by: outkastman.hotmail.com

I am having a bit of trouble getting a popup menu on a tree view to work
correctly. The TreeViewer is populated with "Reference" objects. Each
Reference contains a public "referenceId", once of which is "123". I have
debugged the tree and tripple checked to make sure the objects and id's
are correct. Here is a portion of my plugin xml :

My command:

<extension point="org.eclipse.ui.commands">
<category id ="category.edit" name="edit commands">
</category>
<command categoryId="category.edit" id="edit.task" name="Edit Task">
</command>
</extension>

My Handler:

<extension point="org.eclipse.ui.handlers">
<handler class="EditTaskHandler" commandId="edit.task">
</handler>
</extension>

My Popup :

<extension point="org.eclipse.ui.menus">
<menuContribution locationURI ="popup:TaskTreeView">
<command commandId="edit.task"
icon="icons/edit_task.png"
label="Edit Task">
<visibleWhen>
<reference definitionId="isReferenceCheck">
</reference>
</visibleWhen>
</command>
</extension>

My definition :

<extension point="org.eclipse.core.expressions.definitions">
<definition id="isReferenceCheck">
<iterate>
<adapt type="Reference">
<test property ="referenceId" value="123">
</test>
</adapt>
</iterate>
</definition>
</extension>

The problem is, I get the "Edit Task" popup option anytime I right click
on the tree, even for items whose id is not 123 (I've debugged and
confirmed this). The menu option also always appears even when I do not
have anything selected. Can someone help me out?

Regards

Ps. Note : for simplicity I took out full package names in the plugin xml.
Re: Popup Menu "Test" definition not working [message #327771 is a reply to message #327704] Wed, 30 April 2008 23:21 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The test element isn't a reflective property tester, it links to a
PropertyTester defined by org.eclipse.core.expressions.propertyTesters.
Are you getting your property tester test(*) method called?

As for the menu item showing up when there's nothing selected, you need
to add ifEmpty="false" to the iterate element.

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


Previous Topic:Bind a hot key combination without contributing to menus
Next Topic:Problem creating image from a file in a bundle
Goto Forum:
  


Current Time: Sat Oct 05 05:04:29 GMT 2024

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

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

Back to the top