Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to override behaviour of "delete" in popup menu of project explorer?
How to override behaviour of "delete" in popup menu of project explorer? [message #1042232] Tue, 16 April 2013 02:39 Go to next message
Eclipse UserFriend
I would like to use my own logic to delete a selected file. So far I have used my own Handler class by extending "org.eclipse.ui.handlers" for commandId "org.eclipse.ui.edit.delete".

Now the accelerator DELETE works. So does the "Edit"-"Delete" in the menu bar. However, this solution does not change the behaviour "delete" in popup menu.

Anyone knows the solution for the popup menu? Thanks.
Re: How to override behaviour of "delete" in popup menu of project explorer? [message #1738483 is a reply to message #1042232] Wed, 20 July 2016 05:33 Go to previous message
Eclipse UserFriend
Hi,

you can override the entire Project Explorer org.eclipse.ui.edit.delete command delete behavior by providing a handler not for command Id org.eclipse.ui.edit.delete but for command id "org.eclipse.ltk.ui.refactoring.commands.deleteResources". Make sure to add a good activeWhen expression, i.e a Handler activation expression specific to your needs,. Something like this:

<handler
	class="class that extends org.eclipse.core.commands.AbstractHandler"
	commandId="org.eclipse.ltk.ui.refactoring.commands.deleteResources">
	<activeWhen>
		<and>
			<with variable="activePartId">	
				<equals
            				value="org.eclipse.ui.navigator.ProjectExplorer">
				</equals>
			</with>
                        <!-- Add your element selection criteria here, if any  -->
			<with variable="selection">
			</with>
		</and>
	</activeWhen>
</handler>


This works for me. I'm using Eclipse Mars.2 on my target platform. Be aware that this will override the entire default behavior of the Project Explorer edit.delete command in the pop-up menu.

Best regards,
Luis Mendes
Previous Topic:Localizing Splash Screen on AIX
Next Topic:Using local web content for Help System
Goto Forum:
  


Current Time: Sun Jul 06 21:27:39 EDT 2025

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

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

Back to the top