开发者

Best way to search for instances of a string in Eclipse

开发者 https://www.devze.com 2023-02-20 23:10 出处:网络
I am trying to find where a particular variable is being set.Is it possible to search through a set of project source files to find all the possible spots a certain variable might be getting set?

I am trying to find where a particular variable is being set. Is it possible to search through a set of project source files to find all the possible spots a certain variable might be getting set?

The search in the drop-down menu is a bit confusing to use. After I enter a search I happen to be looking at, and I know it is there, when I do a search from the root of the file system, it tells me that the string is not there :)

Is this a common newbie issue? I j开发者_如何学Cust recently started using Eclipse and could just be missing something simple :)

Thanks, Alex


Select the field where it is declared, then ctrl+shift+H to open the search dialog. The "Java Search" tab should be selected with the Search string populated with your field name, including package. In "Search For" select "Field" and in "Limit To" select "Write accesses" That will show you everywhere that field is assigned.

Here's a screenshot of the search dialog.

Best way to search for instances of a string in Eclipse


I believe the default mapping is Ctrl Shift G. Highlight the variable and do Ctrl Shift G it will find all references of that variable.

Be careful, it will not just do assignments, so you might be getting more data than you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消