Safe Delete Refactoring
In addition to that, to support Safe Delete, a plugin needs to implement two things:
RefactoringSupportProviderinterface, registered in the
com.intellij.lang.refactoringSupportextension point, and the
isSafeDeleteAvailable()method, which checks if the Safe Delete refactoring is available for a specific PSI element
PsiElement.delete()method for the
PsiElementsubclasses for which Safe Delete is available. Deleting PSI elements is implemented by deleting the underlying AST nodes from the AST tree (which, in turn, causes the text ranges corresponding to the AST nodes to be deleted from the document).
If needed, it's possible to further customize how Safe Delete is performed for a particular type of element (e.g., how references are searched) via