Does intellij give notice of refactoring?

Does intelliJ provide for listeners who can be notified after a refactoring has happened?

Message was edited by:
softwarevisualization

1 comment
Comment actions Permalink

I haven't created any refactoring listeners, but here's what I found in the documentation.

Some refactoring listeners can be found in the com.intellij.refactoring.listeners package. The key classes and interfaces to look at are:

RefactoringListenerManager
RefactoringElementListenerProvider
RefactoringElementListener

You want to implement RefactoringListenerProvider and RefactoringElementListener.

To register your listeners, add your provider via
RefactoringListenerManager.getInstance(Project project).addRefactoringListener(RefactoringElementListenerProvider provider)

Your listener provider should return your implementation(s) of RefactoringElementListener via getListener(PsiElement element)

There's also a MoveMemberListener interface in the package if you're interested.

Hope this is helpful to you.

0

Please sign in to leave a comment.