structural search template with method body
Hi,
Can't figure out how to write a template which would search methods by pattern on their body. For example I want to find all static methods which invoke specific method on another class. First I tried
class $Class$ {
static $ReturnType$ $MethodName$($ParameterType$ $Parameter$) {
AnotherClass.$MethodName$
}
}
but it didn't find anything, as far as I understand that's because it looks for exact method body with the only call inside. So I need to define a pattern somewhere like \.*AnotherClass.$MethodName$\.* bud Idea rejects it saying "This pattern is malformed. It does not match anything in the selected scope". So how to define it? Or, in general, is it a correct way to get the search like I want?
Best regards, Eugene.
请先登录再写评论。
Search for methods first, then search pattern in "search results" scope
On 8/7/2012 2:54 PM, Yevgen Bushuyev wrote:
>
>
>
>
>
Sorry, can't get it working. In the first search template I use
AnotherClass.$MethodCall$($Parameter$)
There are some search results, everything as expceted. Then I want find invocations made from static methods. I create new template, select "Previouis search results" in Scope dropbox, put
$Instance$.$MethodCall$($Parameter$)
into Search template, then Edit Variables->Method Call->Text/Regexp typed static there. Nothing found, though I'm sure there should be results. Even if Text/Regexp is empty it finds nothing. Maybe I should use something else in second Search template?
Best regards, Eugene.
AFAIU, you need to use template to find context first (static methods), marking Body as target of search