Thursday, March 10, 2011

How to change marked occurrences colour in Eclipse

This is something that bugs me every time I setup a new workspace in Eclipse, as I find the default Eclipse highlight background colors quite bland – I think it used to be some light yellow for both of them in previous versions... I decided to post about it this time as it happened a few times already and as odd it might sound I sometimes use the information from my blog (what?), that way I only need to remember there was a solution even if recalling all details.

If you use the “Mark Occurrences” feature, whenever you move the cursor to a member, local variable, method etc. Eclipse will highlight the occurrences in the editor as well as on the side ruler (for easy navigation in a large file). In newer Eclipses I think they even broken down the concept into two types – “write occurrence” for the actual variable definition and “occurrence” for when it is used.


If you want to change the default highlight colours you can do so in the Preferences > General > Editors > Text Editors > Annotations – look for “Occurrence annotation” and “Write occurrences”.


You might need to close editors and re-open them to get the new highlight colors.

2 comments :