Eclipse syntax highlighting preferences save and restore

Viewed 57951

I spend some time customizing the colors for syntax highlighting in Eclipse (Java, JSP, HTML, CSS, etc.) but whenever I try to export these settings via File|Export|General|Preferences and reimport them, the settings never completely get imported back. Some colors are restored and others are left unchanged, leaving me in an 'in between' state - very frustrating.

I'm using Eclipse 3.4 Ganymede, by the way.

Has anyone found a reliable way to save and restore Eclipse syntax highlighting settings?

10 Answers

I finally figured out how to do this.

I just wanted to mention beforehand that I did try to start with a fresh Eclipse install, export the preferences to a .epf file, change just one single setting, export again, and compare the files. To my surprise, trying to import settings from a minimal .epf file did not work reliably either.

The solution that worked for me was to copy these files: {Eclipse workspace directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs

I tried a fresh Eclipse install on another machine and after copying those files over, all my settings were restored perfectly.

Eclipse CDT stores 'Syntax coloring' in the file org.eclipse.cdt.ui.prefs

This is located for example here: C:\eclipse\workspace.metadata.plugins\org.eclipse.core.runtime.settings\

Copy and paste over the top of the one in your new eclipse instance. This worked for me when moving from 3.4 to 3.5

I would export the preference before modifying the color, and then after.

That way, you would be able to isolate the specific rules of an eclipse preference file into one smaller file and:

  • check if some colors not restored are indeed represented by a rule
  • the import of a smaller preference has any effect on the previously unchanged settings.

That kind of strategy can be further refined into several small settings files (one for Java, one for JSP, HTML, CSS, ...), in order to better analyzing the potential side-effects when re-importing those settings.

I have deleted recently changed *.prefs file from the following dreictory \myworkspace.metadata.plugins\org.eclipse.core.runtime.settings\ and imported existing exported preference.

I am the first person, who answer for this question as per my knowledge :), Cause even I struggled lot.

Thanks

Related