Hook the renam/move functionality of Refactoring to find the destination/new name

Hi,

I am writing a plugin where I want to hook the rename and move functionality of Refactoring.
I want to find out the source and destination when I performing a move operation.
The old and new name of the element when I performing a rename operation.

I have implemented RefactoringElementListenerProvider interface which returns the listener and I have also implemented RefactoringElementListener interface which calls the elementRenamed and elementMoved api's.

I have added the listener RefactoringListenerManager.getInstance(project).addListenerProvider(RefactoringElementListenerProvider)

When I rename/ move an element in IDEA, elementRenamed/ elementMoved api of my class which implements RefactoringElementListener gets called. I am able to get the source element name and location from the PsiElement. But I am unable to find the destination location and the new target name for the element.

I tried implementing the RenameRefactoring and other interfaces that extend Refactoring interface. But it doesn't seem to help much as I would have to implement my custom rename/move operations.
I want IDEA to perform the default behavior for rename/move and provide me with some more information for further processing on those elements.

Can someone provide me with pointers which can help me get this information?


~Priya

Please sign in to leave a comment.