RefactoringEventListener is not working for Local Variable

Answered

Hi,

The goal of my program is to extract the identifier type and identifier name before and after a Refactor-Rename event through Intellij.

Method name, class name, field name works perfectly fine.

However, that is not the case for the local variable(Basically it is declared in the method scope). My program can extract the name after Rename operation but fail to capture the name before Rename. In this case, both methods(refactoringStarted(), refactoringDone()) have been triggered. It just captures the name after Rename operation as a name before rename.

 

Are there any ways to solve this??? Appreciated your help.

 

0
2 comments

Chris,

The name from before the refactoring is available in refactoringStarted as:

beforeData.getUserData(RefactoringEventData.STRING_PROPERTIES)
1

Thank you sooo much!

It works now!

0

Please sign in to leave a comment.