Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 06:39 Go to next message
CB Liu is currently offline CB LiuFriend
Messages: 3
Registered: April 2013
Junior Member
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 09:33 Go to previous message
Luis Mendes is currently offline Luis MendesFriend
Messages: 7
Registered: August 2015
Location: Denmark
Junior Member

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:

	class="class that extends org.eclipse.core.commands.AbstractHandler"
			<with variable="activePartId">	
                        <!-- Add your element selection criteria here, if any  -->
			<with variable="selection">

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: Fri Dec 04 06:05:56 GMT 2020

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

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

Back to the top