Eclipse syntax coloring makes my code illegible - eclipse

What exactly is Eclipse doing here to the symbol CreateDefaultSource?
If I single-click a symbol and hover over it for a short while, it shades the background to an illegible light-grey. Clicking off of the symbol doesn't immediately cause it to go away.
I'm using the Color Theme plugin to provide syntax coloring. I thought perhaps this was the "Content Assist" background color, but I've changed that under the general prefs and I'm still getting this.
And perhaps a slightly more egregious example:

You can disable this behaviour: in Preferences search for Mark occurences. You will find some sections, each one for a programming language (Java, Javascript, Python,..). Uncheck this option:
Keep marks when the selection changes

Thanks to bluish's hint, I found the appropriate settings to modify these colors:
For references: Preferences > General > Editors > Text Editors > Annotations > PHP elements 'read' occurrences
For assignment lvalues: Preferences > General > Editors > Text Editors > Annotations > PHP elements 'write' occurrences

Related

Eclipse Py-dev, dark theme remove text highlight during typing?

When i type a new word in eclipse pydev, it gets yellowishly higlited. Which makes it very difficult to read. How to remove this highlighting??
You can configure that color in the preferences:
General > Editors > Text Editors > Annotations > Occurrences (PyDev)

Where to change highlight color for selected occurrences in Eclipse?

When a method or variable is selected it is highlighted in Eclipse with some color. Can anyone advice where to change that color? I'm working under Windows OS.
I've found where to change it:
Preferences -> General -> Editors -> Text Editors -> Annotations
and there you have to change both "Occurrences" and "Write occurrences".
Preferences -> General -> Editors -> Text Editors
Current Line Highlight
I think you want the above
else
Preferences -> Java -> Editor -> Syntax Coloring
Element -> Java -> Method or Variable
Check Enable and select color
This has made me mad for about half an hour.
If the issue appears in JavaScript files, the option is under Preferences -> General -> Editors -> Text Editors -> Annotations and in the Annotation types choose JavaScript Occurences. Mine was set to black, nasty little thing took me too long to fix.
If you're using eclipse with PHP package and want to change highlighted colour then there is slight difference to above answer.
Right click on highlighted word
Select 'Preferences'
Go to General > Editors > Text Editors > Annotations. Now look for "PHP elements 'read' occurrences" and "PHP elements 'write' occurrences". You can select your desired colour there.

How to customize Eclipse's text editor code formatting

How can I set my Eclipse's code formatter to allow code rows longer than 80 characters. I know that very long lines is hard to read but in my opinion 80 characters per line is very small value for wide screen monitors.
In Preferences, go to Java > Code Style > Formatter and edit/create the formatter and go to tab Line Wrapping. There in you can set the Maximum line width.
Further on you can in General > Editors > Text Editors also set the Print margin column which should shift up that margin (a 1px wide vertical line in the right side of your code) to the desired position. This however doesn't affect the formatter, only the human eye.
This answer was a bit old, and the path have changed with new versions of Eclipse.
To set the Maximum line width, go to Project > Properties. In the Properties window, go to Java Code Style > Formatter. Select your Active Profile (let the one which is already selected, this is the one you are currently using) and click on Edit. In the tab Line Wrapping, you can set the Maximum line width (80 by default). You can also go to the tab Comments and uncheck Enable Line Comment Formatting if you want your comments not to be formatted on multiple lines with Ctrl+Shift+F.
Don't forget to change the name of the Profile Name; if you don't change it, you won't be able to save your changes (provided the one you are editing is Built-In
Also, you can set the Print margin column in Window > Preferences > General > Editors > Text Editors.
Regarding the "small" value (80), this has just changed (in August 2014).
See "Eclipse is not a terminal anymore – Default line size of Java code formatter is now 120"
(By Lars Vogel)
Project > Properties, Java Code Style > Formatter.
Edit tab Line Wrapping
A three-years old issue is finally addressed:
bug 356851: Default line size of Java code formatter should be increased to 120
It is not mentioned in the Eclipse Project 4.5 (Mars) M1 - New and Noteworthy, but it is still "Verified for 4.5 M1 using I20140804-2000 build".

How to Fix "Mark Occurrences" in Eclipse?

Eclipse is a great editor, and among it's many wonderful features one of my favorites is the Mark Occurrences feature. However, I recently installed the Aptana plug-in, and in trying to configure it I somehow managed to break Mark Occurrences in my Eclipse installation.
The feature still works somewhat, but instead of highlighting all occurrences of a given object, it now only highlights the occurrence where it is first created. In other words, in:
1. Dog dog = new Dog();
2. dog.bark();
3. dog.bark();
Only the "dog" in line 1 would be highlighted, not the "dog" in 2 or 3.
However, before I know I had things configured such that all three "dog" references would be highlighted by Eclipse. Does anyone know what configuration option I changed to "break" the marking of occurrences like this?
If the option mentioned by laurie is checked and you're wondering why it isn't working, you might have hit Alt-Shift-O sometime:
Cannot highlight all occurrences of a selected word in Eclipse
Note, that "Organize Imports" has Ctrl-Shift-O...
Check the following preference setting:
Preferences > General > Editors > Text Editors > Annotations
In here compare the settings for Occurrences and Write Occurrences.
You probably don't have the Text as higlighted option checked
There is another way to toggle the Mark Occurrences feature (apart from Preferences -> Java -> Editor -> Mark Occurrences)
Simply click the "Toggle Mark Occurrences" button from the toolbar. This can be seen in the image below. If you don't see the item in your bar you can turn on by selecting Window > Perspective > Customize Perspective... > Editor Presentation > Toggle Mark Occurrences
You can use a keyboard shortcut to toggle it, also:
On Windows: Alt + Shift + O
On OS X: Option + Command + O
Hope that helps
Preference > Java > Editor > Mark Ocurrences > check: Mark Ocurrences of the selected element in the current file.
and eclipse won't highlight occurences if your project contains errors
check the Problems view to be sure you project is clean
Go
Java> Editor > Mark Occurrences
Uncheck "Keep Marks when the section changes" then click Ok
Restart Eclipse.
This work for me.
Double click on the class or the package in it disappears. Have no fear.
( I also activated this feature by mistake while pressing selecting a word)

Change Eclipse variable autohighlight color

I have customized my own colors in eclipse but cannot find where to change the auto highlight color when you click on a variable and it highlights all other uses. Has anyone done this before?
Preferences -> General -> Editors -> Text Editors -> Annotations -> Occurrences
How to change your various variable background-highlighting "occurrences" settings
For anyone who'd like a screenshot and more details:
Tested in Eclipse 2022-12 (4.26.0) on Ubuntu 22.04.
You may have various "Occurrences" settings to change. Each one causes variables of the same name from various language file types to be highlighted in different kinds of files. I have 5 or so "occurrences" settings in Window → Preferences → General → Editors → Text Editors → Annotations → in the “Annotation types” window:
Bash occurrences
C/C++ Occurrences
C/C++ Write Occurrences
Occurrences
Occurrences (LiClipse)
I have changed all 5 to the same custom color: #414104, which is a nice-looking brown which looks great for dark themes.
Here's a screenshot prior to changing that setting for "Occurrences (LiClipse)":
And here's the new color I set all 5 to: #414104:
References:
The accepted answer
I first wrote about this in my Eclipse setup instructions on a new Linux (or other OS) computer document, where I have documented this and a lot more.