how to intercept and handle 'rename canceled' event ?

Is there a way to intercept and handle 'rename canceled' events for ordinary java methods ?
The RefactoringElementListener contains only two methods : 'elementMoved' and 'elementRenamed' which trigger AFTER an element has been moved or renamed. But even when I commit a rename pressing 'Enter' (without altering the name itself) - if the name has not been altered, it's not considered a 'rename' and the event is not triggered.
I need to plug into the rename process to mitigate the side effects produced by a canceled refactoring : even a canceled rename modifies the PSI tree (the original PsiMethod element is replaced with its copy..), invalidating the 'original' and breaking my custom references targetting the method being refactored. I somehow managed to update these references after a successful rename but I don't know how to intercept and handle a 'rolled-back' rename (pressing Esc twice after triggering 'inline rename' on a method / clicking 'Cancel' button on the rename dialog).

Please sign in to leave a comment.