Navigate Between Marked Occurrences

One of the dozens of interesting things I've picked up at JavaOne is... a very cool new keyboard shortcut that is in post-6.1 development builds. I.e., this is not in 6.1. You'd need to get a development build. Once you've done so, put your cursor on an identifier in your Java code, as shown below:

Great, all the occurrences of the selected identifier are marked, as in 6.0 and 6.1. Now how do you navigate between those marked occurrences? Wouldn't it be cool if you could hold down the Alt key and then use the Up arrow and Down arrow to navigate up and down the occurrences that have been marked? You can't do that in 6.1, but in development builds, that's exactly what you can do.

Vladimir Voskresensky from the NetBeans C/C++ development team in St. Petersburg told me about this on NetBeans Day. It's something he committed to the NetBeans sources, after having initially created it for the C++ editor. Thanks Vladimir. One thing I noticed is that the selected identifier suddenly changes while I am navigating, so that I can't navigate all the way down the list because the marked occurrence suddenly changes.


Mark occurrences is changed, because of bug in Java impl. If you simply put cursor in the beginning of identifier in function call, like in
unfortunately "equals" becomes highlighted, not "obj". So when you navigate with ALT+UP/DOWN cursor is moved in the beginning of identifier and ... because of the above bug your selection is changed :-( We don't have such problems in C++ :-). And just a note: this works fine in 6.1 release for C++

Posted by Vladimir Voskresensky on May 13, 2008 at 12:00 AM PDT #

I've put workaround for it was part of

now object is not lost, just cursor is positioned at the end of identifier

Posted by Vladimir Voskresensky on June 06, 2008 at 02:06 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

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.


« April 2015