NooBxGockeL
NooBxGockeL

Reputation: 103

Eclipse Luna Dark theme, syntax coloring resets. How to disable?

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

Upvotes: 9

Views: 4990

Answers (4)

MoeBoeMe
MoeBoeMe

Reputation: 133

To set up Dark theme as a "global" theme, and the theme you like from Eclipse Color Theme that you installed from Market Place, you can do the following. I used:

  1. windows 10 (64 bit, but for 32 bit is probably the same)
  2. eclipse oxygen

Steps:

  1. Set the "global" theme to the dark theme: (Windows>Preferences>General>Appearance>Theme:Dark)
  2. close eclipse. (You can change the Color Theme to let's say Recogn Eyes -which is my favorite-)
  3. Re-open eclipse. (If you changed the Color theme you will have the default for the Dark theme, since you are reading this)
  4. Open File explorer and look for C:\Users\[user]\eclipse-workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
  5. Open org.eclipse.e4.ui.css.swt.theme.
  6. Copy text after =, and keep that in your clipboard , in my case it was org.eclipse.e4.ui.css.theme.e4_dark
  7. (In eclipse) Set the schema to default, and close the application.
  8. open eclipse and choose your favorite color theme.
  9. Close eclipse.
  10. Go to the file org.eclipse.e4.ui.css.swt.theme again and paste what was in the clipboard (themeid=org.eclipse.e4.ui.css.theme.e4_dark, in my case) after the =.

Upvotes: 0

Shay Perlstein
Shay Perlstein

Reputation: 151

On Eclipse 4.6 (Ubuntu) the solution that worked for me is the following:

  • Set the Dark theme (before setting any color scheme)
  • Edit the file org.eclipse.e4.ui.css.swt.theme.prefs under .metadata/.plugins/org.eclipse.core.runtime/.settings
  • Copy the used theme id (in my case themeid=org.eclipse.e4.ui.css.theme.e4_dark)
  • Set any other theme than dark.
  • Set your desired scheme
  • Quit eclipse
  • Edit again org.eclipse.e4.ui.css.swt.theme.prefs
  • Replace the themeid with the copied value.
  • Restart eclipse.

Upvotes: 4

Petar Simic
Petar Simic

Reputation: 23

Just go to window->preferences->oomph->setup tasks, and enable skip automatic task execution at startup time

Upvotes: 2

andykellr
andykellr

Reputation: 799

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.

Before you get started, remember these things:

  1. 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.

  2. 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.

  3. 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.

Follow these steps to switch to the Dark theme while preserving control over your syntax colors:

  1. 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"
    
  2. Start Eclipse and switch to the Dark theme and then Exit Eclipse.

  3. Verify that only the theme changed and save the changes to a branch:

    hg diff
    hg branch dark
    hg ci -m "after dark"
    
  4. 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"
    
  5. Exit Eclipse and you will notice that the changes are gone. Restore the changes it made when it was running:

    hg revert .
    
  6. 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"
    
  7. Start and Exit Eclipse and verify that Eclipse didn't make any changes to your file.

    hg diff
    
  8. 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

  9. 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
    
  10. 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.

Here is what my Eclipse looks like now with all of the colors that I originally tweaked before switching to the Dark theme:

Screenshot of my Eclipse

Upvotes: 9

Related Questions