Original Question: Eclipse luna theme issue
Related Question: How to make Eclipse color settings permanent?
TL;DR Eclipse Luna 4.4, Dark theme, Win 7 64bit, some settings reset to an initial value on start. How to make them stay the way i configured them ? Examples: Java Syntax Coloring, enums are italics with the dark theme, i dont want them italics tho...
Additional Research
In the workspace\.metadata\.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.ui.prefs
file there is a tag named overriddenByCSS
that seems to cause this issue. It only exists if the dark theme is used. I looked into the CSS files of the dark theme but couldnt find anything related...
Also removing or changing the line manually doesnt work, it gets written every start of eclipse.
Why do i ask ?
Even tho the "How to ask" mentions that a new question should be different to an allready existing one, i dont have enough reputation to comment on the original question and add details to it. So i tried in the form of an answer, but someone "thought" it was a good idea to delete my answer (that wasnt really answering, just adding more details...). So, well, lets just flood SO with duplicates then...
EDIT: I posted a bug at the eclipse bugzilla
If you want to join this club, simply type "Dark" into the Quick Access box and press enter. This brings you to the correct preference page. Select Dark, press Apply and Close (and restart your IDE to fully apply the theme).
Just navigate to Preferences > General > Appearance. Choose "Classic" for "Theme" and hit "Apply and Close". You may have to restart eclipse.
Step 1: Go to Window -> Preferences in Eclipse Luna. Step 2: Go to General -> Appearance and click on Appearance. We will find the UI as given below. Step 3: To change theme, click on theme select box, and choose Dark then click on OK.
A few days ago a comment was added to your Eclipse bug report and I have been able to successfully workaround this issue using that advice. It's tedious, but it worked for me.
Eclipse will load your preferences on startup, overwrite them with overriddenByCSS=
, etc. and then restore your original settings file on exit. This means that all changes you make to org.eclipse.jdt.ui.prefs should be made while Eclipse is not running.
Comparing this file while Eclipse is running to the version while Eclipse is not running will help you identify the changes you need to make to preserve your colors.
Use your preferred version control system to manage these files. This will ensure that you don't lose them in the future and will help you see how Eclipse is changing your preferences when it starts. I will use Mercurial below.
Exit Eclipse and put the core runtime settings under version control:
cd [eclipse workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings
hg init
hg add .
hg ci -m "before dark"
Start Eclipse and switch to the Dark theme and then Exit Eclipse.
Verify that only the theme changed and save the changes to a branch:
hg diff
hg branch dark
hg ci -m "after dark"
Start Eclipse again and while Eclipse is running, compare the files to what you just checked in. You will see the new overriddenByCSS value which will reference all of the values that were added by Eclipse on startup. Do a diff and keep note of what was changed and before you exit Eclipse, save these overrides.
hg diff
hg ci -m "eclipse overrides"
Exit Eclipse and you will notice that the changes are gone. Restore the changes it made when it was running:
hg revert .
Edit org.eclipse.jdt.ui.prefs and remove the line that starts with overriddenByCSS
. This will make the other overrides values stick. Save these changes.
hg ci -m "the overrides are now mine"
Start and Exit Eclipse and verify that Eclipse didn't make any changes to your file.
hg diff
Now that the overrides are yours, you are free to change them. For the example you mentioned, enums in italic, edit org.eclipse.jdt.ui.prefs and set semanticHighlighting.enum.italic=false
If you ever want to go back to your default before you started this, you can switch between branches using:
hg up -r default
hg up -r dark
Important note: If you change syntax color preferences using Eclipse, you'll notice that the overriddenByCSS
value comes back when Eclipse is running and your preferences will disappear. Periodically monitor your preference files for changes and commit them when you like them. Revert them when you don't.
On Eclipse 4.6 (Ubuntu) the solution that worked for me is the following:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With