NetBeans IDE 7.3: Find Usages Filter

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. 

Comments:

impressed

Posted by guest on January 18, 2013 at 07:37 PM PST #

Great, I love this feature!

Posted by Muhammad Ghazali on January 29, 2013 at 05:57 PM PST #

What about removing some nodes from filtering results? This could help to leave only interesting data that could be compared and create list. The customized elements would remind todo list of elements that the user is working with.

Posted by guest on January 30, 2013 at 01:41 PM PST #

A wonderful feature. I was just about to request it when I googled first to see if someone else reported it before me and found this post. But it seems more obvious for me if the filter was appearing in the Find Usages dialog.

Posted by Mina on May 22, 2013 at 12:17 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today