I tried using the Toggle mark occurrences (Alt + Shift + O)
button and also in Preferences -> General -> Editors -> Text Editor -> Annotations
Go
Java> Editor > Mark Occurrences
Uncheck "Keep Marks when the section changes" then click Ok
Restart Eclipse.
This work for me.
You can try to activate Toggle Mark Occurrences with icon on Toolbar:
The standard "Mark Occurrences" functionality included in Eclipse that everyone recommends only highlights identifiers in editors of whatever language. For example, it won't highlight int
in C editors, and it won't help at all in the Console pane.
So if you want to highlight ALL occurrences on ANY word in ANY Eclipse pane (kinda like Notepad++ does), try the Glance plug-in for Eclipse.
As of November 2017 Glance works for Eclipse Neon and Oxygen. There was a period of time in which Neon was unsupported, and a fork appeared, but it seems unnecessary now (and abandoned).
Check out options that are checked in Preferences -> Java -> Editor -> Mark occurrences. Then restart Eclipse.
There are two ways to highlight all occurences. First is using Eclipse options, which is not very reliable, because in many versions of Eclipse it is not supported. Second is using a plugin called Glance which is available in Eclipse marketplace. This is supereasy and effective.
In the toolbar, there is button for Toggling Mark Occurrences
. So, once you selected the text/word whose occurences you wish to highlight, then click this toggle button.
Let's say this step doesn't work for you. Then, Follow this step:
Goto: Window
==> Preferences
==> General
==> Editors
==> Text Editors
==> Annotations
==> On right Annotations types box: Occurrences
==> Select all check boxes.
You can also go to Window
==> Preferences
==> Java
==> Editor
==> Mark Occurrences
==> Check all the checkboxes.
Restart Eclipse and check if highlighting works. If still doesn't work, then Go to Second Method
Second Method
From Eclipse marketplace, install Glance
. Once installed, restart Eclipse.
Now select any word in your eclipse editor
Ctrl + Cmd + F
shortcut on Mac or Ctrl + Alt + F
on other platformsEnter
or **Shift + Enter**
to find next/previous matchEsc
You can also customize Glance from Window
==> Preferences
==> Glance
In General > Editors > Text Editors > Annotations