Monday August 25, 2008
Jumping to Related Places in the NetBeans Java Editor
I learned something interesting about the NetBeans Java Editor today. Say you have an import statement (or anything else) selected, as here:
Now look at those browny-greeny marks in the right sidebar. When you click them, the cursor jumps to places where the selected item is used. So, in the case of import statements, you can click the browny-greeny mark and then find yourself in places in the code where you're doing something with that class.
I never knew that and it's pretty cool.
Aug 25 2008, 11:24:40 AM PDT Permalink
Yeah personally I use that all the time as a simple but very fast "find occurrences".
It would be even better though if a preview could be shown as you hover over the mark occurrences gutter, such that you did not necessarily have to click and go there, if all you really want is to inspect something.
At the same time, this hover preview functionality could be used for when hovering a block of folded code! ;)
Posted by Casper Bang on August 25, 2008 at 11:48 AM PDT #
No need to select anything. Just move the caret into the identifier. Once it is highlighted in for the usual "mark occurrences" feature, use Alt-Up/Down to jump to various usages (cycling back to the definition). Handy way to quickly jump to usages of imports, or private fields / methods / constructors / nested classes.
Posted by Jesse Glick on August 25, 2008 at 12:52 PM PDT #
I feel like I just lost the probably only chance I had to reverse the roles and actually teach you something.
Yesterday I could have sent you an email like "by the way, do you know about the jump-to-highlighting stuffs in the right side column?". Instead of that, I spent my time to read your tutorials.
I feel so frustrated :-)
Posted by Vincent Cantin on August 25, 2008 at 05:18 PM PDT #
I knew this, and forgot to blog about, or create a doc for it..Damn!
Anyways, its really cool stuff!
Enjoy learning ;-)
Similar case is for the class you implement. When you put the cursor on that className, then it would mark occurrences for the implemented methods.
Not sure about Inheritance (extends).


