Overriding delete command of the project explorer [message #502801] |
Wed, 09 December 2009 17:53 |
VincentL Messages: 88 Registered: July 2009 |
Member |
|
|
Hi,
I'm developing an rcp application that uses the standard project explorer view. My
application also provides project nature.
I want to replace the default "delete" handler provided by the project explorer view when
a project contains my nature.
My plugim.xml file contains the following handler:
<handler
class="com.opalrt.livelab.ui.action.DeleteHandler"
commandId="org.eclipse.ui.edit.delete">
<activeWhen>
<and>
<iterate>
<or>
<adapt
type="org.eclipse.core.resources.IProject">
<test
property="org.eclipse.core.resources.projectNature"
value="myNature">
</test>
</adapt>
</or>
</iterate>
</and>
</activeWhen>
</handler>
The handler works correctly :
1- in the Edit/Delete menu
2- or when I press the Delete key (key binding)
However, when I right click on a IProject and click on the Delete popup menu item, my
handler is ignored and the default handler is called...
Why my handler is ignored when the delete command is called from the context menu of the
project explorer and works correctly from menu and key binding?
Moreover, If I had a second Delete contribution item in contextual menu of the project
explorer view, my handler work correctly...
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?before=group.edit ">
<command
commandId="org.eclipse.ui.edit.delete"
style="push">
<visibleWhen
checkEnabled="false">
<and>
<iterate>
<adapt
type="org.eclipse.core.resources.IProject">
<test
property="org.eclipse.core.resources.projectNature"
value="myNature">
</test>
</adapt>
</iterate>
</and>
</visibleWhen>
</command>
</menuContribution>
Any help will be appreciate...
Thanks
Vincent
|
|
|
Powered by
FUDForum. Page generated in 0.02319 seconds