Find and Manipulate Method Calls

Answered

Hello,

I’m developing a plugin that requires finding all method calls of an specific method (similar to Find Usages). Once I have found these methods I need to chain another call to the result (returning the same data type). Here is a dummy Example:

Method:

String getName(){

...

}

Current usage:

String name = myClass.getName();

Usage after using the plugin:

String name = myClass.getName().toLowerCase();

The problem is not modifying the methods, but finding them. I tried using the class ReferencesSearch.search(...), but it didn’t work. Using FindManager.getInstance(project).findUsages(...) is also not an option, because this method returns void, and I don’t know how to get a reference to the results that are shown in the Find Usages Dialog.

I guess it is just using a class but I can’t find which one.

Any help would be appreciated, thanks in advance!

2 comments
Comment actions Permalink
Official comment

Please try MethodReferencesSearch

Comment actions Permalink

Thanks a lot. That's exactly what I needed!

0

Please sign in to leave a comment.