Eclipse navigate to next/previous marked occurrence

Eclipse

Eclipse Problem Overview


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?

Eclipse Solutions


Solution 1 - Eclipse

To skip between highlighted occurrences only, try the following:

  • Above the editor Window, select the down arrow next to the next annotation button.

    Button location

  • 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).

Solution 2 - Eclipse

After selecting a piece of text:

  • Next occurrence is ctrl+k.

  • Previous occurrence is ctrl+shift+k.

Solution 3 - Eclipse

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.

Solution 4 - Eclipse

Use Ctrl+> or Ctrl+<

and it's quite easy to remember because > < works as arrow pointing in the direction where you navigate.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSteve KuoView Question on Stackoverflow
Solution 1 - EclipseDuncan JonesView Answer on Stackoverflow
Solution 2 - EclipseRebecca ChernoffView Answer on Stackoverflow
Solution 3 - EclipseArun PBView Answer on Stackoverflow
Solution 4 - EclipseMarian PaździochView Answer on Stackoverflow