Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search usages of Subclass's method

I have parent class Parent with method getToken(). And I have its child class - ChildA and ChildB, which don't override method getToken().

How I can search usages of method getToken() which used by instance of class ChildA?

Sorry for my English. Thanks!

like image 209
Dedyshka Avatar asked Oct 24 '12 12:10

Dedyshka


2 Answers

As I spent half an hour to find the exact solution through all complicated and outdated documentations and examples, I just put the full answer using SSR here (Intellij 15.0.5):

Open SSR dialog (Edit > Find > Search Structurally...) and input template in screenshot, then click on "Edit variables..." to see the second dialog and edit the "Expression type (regexp)" as shown:

enter image description here

and if you want to include subclasses of ChildA too, just check the box "Apply constraint within type hierarchy" bellow the expression type:

enter image description here

like image 133
mohamnag Avatar answered Sep 21 '22 01:09

mohamnag


You can add getToken() to ChildA, perform the search only for this method, then delete it. Another way is to use Structural Search and Replace.

like image 44
CrazyCoder Avatar answered Sep 20 '22 01:09

CrazyCoder