Search code examples
javaeclipseeclipse-rcprcp

Overriding default delete action in eclipse navigator view


I am working on an RCP application that has eclipse navigator viewer with ID org.eclipse.ui.navigator.ProjectExplorer. I want to override delete action (DeleteResourceAction) in order to do something before my resources are deleted from workspace/file system. Is it possible and how?


Solution

  • You can use the org.eclipse.ltk.core.refactoring.deleteParticipants extension point to add a participant that is called whenever resources are deleted.

    Your code extends the org.eclipse.ltk.core.refactoring.participants.DeleteParticipant class.

    Some more details in this article

    The delete participant is called before the delete is performed to check that the delete can be performed. It then provides a set of Change objects that are called during the actual delete. There are also rename, copy and move participants.

    For building you can add builders to a project description to get code run during the build.