Refactor Listener
Hi
Is there is any way to catch source code changes (refactoring) inside idea plugin like ProjectListener and ModuleListener ?
Mainly I want to listen for the follwoing events:
- Renaming class
- Renaming class member
- Renaming local variable
- Moving class
- Renaming package
I'll need also a way to get a list of all files that were affected by the refactoring.
Regards,
Mahmoud
Please sign in to leave a comment.
Hi there,
I am not sure of a way to do this unfortunately.
However I would be interested to hear your use case, perhaps a different solution could be used? :)
Alan
Rename and move refactorings can be observed via com.intellij.refactoring.listeners.RefactoringElementListener
How can i use com.intellij.refactoring.listeners.RefactoringElementListener ?
I tried to register a provider using RefactoringListenerManager.addListenerProvider(..) but i found that it is deprecated, what is the correct way to register my RefactoringElementListener in the plugin.
You need to provide an implementation of com.intellij.refactoring.listeners.RefactoringElementListenerProvider via extensionPoint in your plugin.xml
See com.intellij.uiDesigner.palette.PaletteRefactoringListenerProvider as sample