Monday Aug 26, 2013

Fixing Similar Code All In One Go Throughout All Applications

Recently I was showing someone how NetBeans IDE lets you fix missing @Override annotations:

Then the someone said: "Well, now that I have fixed this particular missing @Override annotation, it would be cool if I could immediately tell NetBeans to find all other instances of missing @Override annotations, throughout my application."

And, as luck would have it, all you need to do is click the right arrow key (as can be seen by the arrow in the hint above) and you'll see it expand to the following:

If you select the third or fourth items above, a dialog will open where you can set the scope (by default, the current file, but it could be all open projects, the current project, or the current package) for searching for instances of missing @Override annotations. In the third case, the missing @Override annotations will be found and listed, while in the fourth case you'll also be able to fix all those missing annotations simply by clicking a button and then everywhere within the selected scope the missing @Override annotation will be added: 

Pretty cool, since it makes sense that you'd want to find all other instances of the same problem once your attention has been caught by one of them.

Interested to know more generally what you, humble reader of this blog, think about the support for Java hints in NetBeans IDE? What do you like about it/them? (What's your favorite Java hint and why?) What could be improved? What's missing? 

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
« August 2013 »
SunMonTueWedThuFriSat
    
1
24
       
Today