Eclipse navigate to next/previous marked occurrence
Eclipse has the Mark Occurrences feature where it highlights all occurrences of a selected variable/method. Is there a way to navigate to next or previous marked occurrence?
To skip between highlighted occurrences only, try the following:
-
Above the editor Window, select the down arrow next to the next annotation button.
Adjust the selection so that only "Occurrences" is marked.
Now, when you click on an item to highlight it, you can skip forwards and backwards to other occurrences using Ctrl+(comma) and Ctrl+(period).
After selecting a piece of text:
Next occurrence is ctrl+k.
Previous occurrence is ctrl+shift+k.
If you are looking to navigate through variables / methods defined in the same class, a quicker way to do this would be to select ( highlight ) the variable / method name you want to navigate to and use Alt + Shift + R to get into the refactoring mode and then use Tab or Shift + Tab.
Tab - takes you to the next occurrence
Shift + Tab - takes you to the previous occurrence
This way will save you from reaching mere text matches ( including those in comments ), as how Ctrl + K behaves. So you are taken through only "valid" occurrences.
Use Ctrl+> or Ctrl+<
and it's quite easy to remember because > < works as arrow pointing in the direction where you navigate.