Add something to default delete action.
Hi,
I'm writing my first plugin and I'm wondering if i could add my message and/or methods from my class to default delete action. I want to ask user if he wants to delete class from xml file as well and if yes call my method, but i don't know if it is possible.
Any clues or other ideas how to do it?
请先登录再写评论。
Hi John,
I would inherit `com.intellij.refactoring.safeDelete.JavaSafeDeleteProcessor` and register my processor before java's default one. Then, I would wrap usages inside xml with dedicated usage infos and then in `preprocessUsages` (like it's done for overriding methods), will check also specific usages. Please, don't forget to delegate to super, not to break the rest of the functionality.
Anna
Thanks Anna,
I had vacation whole week, sorry for late answer. I'm almost done with my plugin but still have some problems with delete action. I can delete related java class in xml but i need to make it for directory/files as well, my plugin have action that generates directory with js and css files in it (i work on community edition so it doesn't have js support as i know) and insert information about them in xml file. I would like to have access to what's deleted (e.g. PSIDirectory:directoryname or PSIFile:filename) but i don't if I should i look for "universal" delete processor or try to override delete default action somehow.
EDIT: I used Application Component and ActionListener and i listen $Delete action. I don't know how to get information what file is deleted. Any Ideas?
public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event){