简体   繁体   English

IntelliJ IDEA结构搜索

[英]IntelliJ IDEA structural search

Is it possible to do a structural search on instances of a certain class in IDEA? 是否可以在IDEA中对某个类的实例进行结构搜索? I want to search usages of == on two instances of a given class. 我想在给定类的两个实例上搜索==的用法。 The instantiation is not part of my search. 实例化不是我搜索的一部分。 Eg 例如

Currency lhs = new Currency("CHF");
Currency rhs = new Currency("USD");

...
...


if (lhs == rhs) {
}

Here I'm looking for the lhs == rhs, not the other parts of the code. 在这里,我在寻找lhs == rhs,而不是代码的其他部分。 At the same time I'm looking for exactly the case where lhs and rhs are instances of Currency. 同时,我正在寻找lhs和rhs是Currency实例的确切情况。

What I also want to achieve is to find occurencies of this pattern where rhs is a result of method calls: 我还想实现的是找到这种模式的出现,其中rhs是方法调用的结果:

lhs == foo.getSomething().getCurrency()

I got the answer myself: 我自己得到了答案:

In the Edit Variables frame it is possible to specify the "Text / reqular expression for java expression type". 在“编辑变量”框架中,可以指定“ Java表达式类型的文本/必需表达式”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM