views:

7854

answers:

6

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?

+3  A: 

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.

VonC
Great idea, I'll try that out. Thanks!
Frederic Daoud
How do you export anything else than jre settings and key bindings?All I get in File->Export->Preferences is jre and key settings.
Chobicus
On my eclipse 3.4.1 (or 3.5Mx), I do see an 'export all' option I can select. That will... export all preferences. You can then edit the resulting file to keep only what interest you, and re-import those specific setting into your eclipse configuration.
VonC
Argh, I thought it means both, jre and key bindings!Thank you
Chobicus
+11  A: 

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.

Frederic Daoud
+1  A: 

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

+1  A: 

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

Oliver
A: 

I am trying to achieve this for Eclipse Helios (CDT) but with no luck - anyone managed to achieve this?

I am just changing from one workspace to another (not installing new Eclipse or anything), and would like to bring my colour settings across ...

many thanks for help gvanto

+1  A: 

I have had success in importing Eclipse Helios's syntax highlighting rules by copying the file:

.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

from the source workspace to the target workspace. It seems this file also contains Eclipse's code formatter profiles and code templates.

Environment:

Version: Helios Release
Build id: 20100617-1415
(on linux)
st.never