NetBeans IDE 7.3: Find Usages Filter
By Geertjan-Oracle on Jan 18, 2013
You're happily coding along and suddenly think to yourself: "Hmmm. I wonder where the 'pos' variable in my class is used throughout my application?" So you right-click your "pos" variable and choose "Find Usages":
Now, as always, you see the dialog below where you can set the scope of the search and whether comments should be included:
Then you click Find and get a massive amount of data back, in this case, 274 occurrences where the "pos" variable is used:
That's a lot of data you got back. For the first time, in 7.3, you now have the second column of buttons on the left of the Usages window. This column is the "Find Usages Filter" and has six buttons, as shown below.
From top to bottom, the buttons above have the following tooltips:
- Read filter
- Write filter
- Read/Write filter
- Import filter
- Comment filter
- Test filter
From the data returned to the Usages window, you can remove all comments, for example, where "pos" was found, or all test classes, so that you're left with exactly the data you're interested in. Most useful is to use the "Write filter". Now everything is filtered out of the Usages window, except for the places in the code where the selected variable has write access:
Compare the above to what you get back when you use the "Read filter" instead, showing where the variable has read access:
And what does the "Read/Write filter" do? It will find occurrences where the variable has both read and write access, e.g., "pos += 3".
Thanks to Ralph for help in understanding this one.