Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlighting all occurrences of a search string in Eclipse Java editor

If you search for a String in Netbeans Java editor, it automatically highlights all occurrences of that string.

But, how can I achieve this feature in Eclipse?

(I checked Preferences > Java > Editor > Mark Occurrences, but it seems it is only for similar variables methods etc. but not for for search matches)

like image 452
siva636 Avatar asked May 24 '13 02:05

siva636


People also ask

How do you highlight occurrences in Eclipse?

Glance does not work anymore, but in current Eclipse Versions (Eclipse 2020) you can highlight any word by selecting the word and pressing CTRL+F.

How do I select all occurrences of a word in Eclipse?

Ctrl + shift + a finds 'occurances in a file' that highlights all occurances of the selected text as you describe.

What is Toggle mark occurrences Eclipse?

The Mark Occurrences feature enables you to see where an element is referenced by simply clicking on the element in the editor.

How do I select multiple words in Eclipse?

Press Alt+Shift+Up several times until the method is selected. Each time you press this key, Eclipse will select the enclosing element of the current selection. Often 4-5 times would be enough but sometimes you'll need up to 7.


3 Answers

Have you tried the Glance plugin for Eclipse? fully meet your requirements and even with more features.

demo and Github of this project: http://ystrot.github.io/glance/


UPDATE: available in Eclipse marketplace

http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1012

like image 75
Sam Su Avatar answered Oct 18 '22 01:10

Sam Su


You can enable "Toggle Mark Occurrences" (shortkey is ALT+SHIFT+O).

For the color of the select text,you can:

Window->Preferences->General->Editors->Text Editors->Annotations->Occurrences

Hope it useful.

like image 32
Sstx Avatar answered Oct 18 '22 00:10

Sstx


eclipse instasearch plugin is a very useful plugin for search needs inside eclipse. It is based on lucene. This is also available in eclipse marketplace.

It has extensive feature set.

  • Instantly shows search results
  • Shows a preview using relevant lines
  • Periodically updates the index
  • Matches partial words (e.g. case in CamelCase)
  • Opens and highlights matches in files
  • Searches JAR source attachments
  • Supports filtering by extension/project/working set
like image 4
Sairam Krish Avatar answered Oct 18 '22 01:10

Sairam Krish