variable - Eclipse doesn't highlight references anymore

highlighting variable in eclipse (7)

I have an odd problem. In Eclipse Ganymede, I used to be able to highlight a variable, and it would highlight the use of that variables in that method. However through some action I have now disabled it. Is there a way I can enable it?

I tried searching Google, but since I don't know what the feature is called, its kinda tough.

Its a really useful feature, and its annoying that its not working.

I had a similar problem. I solved it by uninstalling the erlang plugin called "erlide".

I had the similar problem where the references were not highlighted, on enabling the mark occurrences in windows-prefrences-java-editor I am able to highlight the references

In addition, you have to go to General->Editors->Text Editors->Annotations, choose Occurrences and check the "Text as" and choose Highlighted. This will make you happy.

On Mac OS it's opt-cmd-O I pressed that once by mistake, thanks to this question I found my way back

That is probably how the 'mark occurences' got turned off... I was using Ctrl+Shift+O to organize imports and by mistake chosen Alt instead of Ctrl. So it can be turned on again by Alt+Shift+O.

There's a little "highlighter" icon on the toolbar - it toggles "Mark Occurrences".

From the preferences window, the feature you mean is configured by navigating to:

Window -> Preferences -> Java -> Editor -> Mark Occurrences

  • In Eclipse Kepler,
    You can simply use the "Toggle Mark Occurrences" icon on the tool bar or you can use keyboard short cut alt+shift+O.

  • Window > Preferences > Java > Editor > Mark Occurrences. Enable "Mark occurrences of the selected element in the current file" and click Apply.