Jonas Gröger
Jonas Gröger

Reputation: 1628

Eclipse Syntax Coloring File

After setting up the Java syntax highlighting for my workspace, I want to backup this file to, lets say, give it to my friends.

Can you tell me in which file Eclipse stores these coloring values?

Upvotes: 21

Views: 32109

Answers (4)

Stephane Baubillier
Stephane Baubillier

Reputation: 1

You can also create an .epf file (Eclipse preference file) with the preferences which are otherwise stored in the <workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.jdt.prefs file.

Later, you can import the .epf file via "File > Import > General > Preferences".

Here is an example .epf file (make sure to include the file_export_version=3.0 line, the import will not work otherwise!):

file_export_version=3.0
/instance/org.eclipse.jdt.ui/java_multi_line_comment=128,128,128
/instance/org.eclipse.jdt.ui/java_single_line_comment=128,128,128
/instance/org.eclipse.jdt.ui/java_string=255,0,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.abstractMethodInvocation.color=0,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.abstractMethodInvocation.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.abstractMethodInvocation.italic=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.abstractMethodInvocation.underline=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.field.color=0,0,255
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedField.color=0,0,255
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedField.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedField.italic=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedMethodInvocation.color=0,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedMethodInvocation.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.inheritedMethodInvocation.italic=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.localVariable.color=255,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.localVariableDeclaration.bold=false
/instance/org.eclipse.jdt.ui/semanticHighlighting.localVariableDeclaration.color=255,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.localVariableDeclaration.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.method.color=0,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.method.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.number.color=128,0,64
/instance/org.eclipse.jdt.ui/semanticHighlighting.number.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.parameterVariable.bold=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.parameterVariable.color=255,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.parameterVariable.enabled=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticField.bold=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticField.color=0,0,255
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticField.italic=false
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticFinalField.color=0,0,255
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticFinalField.italic=false
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticMethodInvocation.bold=true
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticMethodInvocation.color=0,128,0
/instance/org.eclipse.jdt.ui/semanticHighlighting.staticMethodInvocation.italic=false

Upvotes: 0

aliopi
aliopi

Reputation: 3832

If you want, try out the Eclipse Color Theme plugin. It's easier.

See some themes. I prefer bright ones but there are dark ones also.

After you install the plugin, go to Windows > Preferences and there General > Appearance > Color Themes and pick one.

If you want to use the Intellij IDEA Theme, you must download the xml for it (not the .epf) and import it with the dialog.

enter image description here

(I'm not a developer of this plugin)

Upvotes: 0

WesternGun
WesternGun

Reputation: 12728

Sometimes simply import/export would not be enough, so you may need a list of .pref files where the syntax coloring settings are stored. What I have here is not complete and I just list what I use and I hope it helps.

(I process .java, .jsp, .xml, js and .properties files.)

You can find them by searching .pref files in your workspace, and open each one to see which contains color code. Remember to adjust your searching options to look into subfolders.

org.eclipse.ui.editors.prefs
org.eclipse.jdt.ui.prefs
org.eclipse.ui.workbench.prefs
org.eclipse.wst.xml.ui.prefs
org.eclipse.jst.jsp.ui.prefs
org.eclipse.wst.html.ui.prefs
org.eclipse.wst.jsdt.ui.prefs
org.eclipse.ant.ui.prefs
org.eclipse.datatools.sqltools.sqleditor.prefs
org.eclipse.debug.ui.prefs
org.eclipse.php.ui.prefs
com.adobe.flexide.mxml.core.prefs
org.python.pydev.prefs
com.adobe.flexide.as.core.prefs
com.adobe.flexide.css.core.prefs
org.codehaus.groovy.eclipse.ui.prefs
org.epic.perleditor.prefs
org.eclipse.cdt.ui.prefs

You may copy them when you finish adjusting your syntax coloring settings. When needed, search .pref again to get access to their locations, and restore your settings by copying the lines with color code, in order to avoid unpredictable side effect. As I can see this is the only way, inconvenient buy effective.

Upvotes: 0

kaliatech
kaliatech

Reputation: 17867

SECOND ANSWER (also in comments below)

Sharing Java color syntax setting is possible by working with various Eclipse preference files. See: http://srand2.blogspot.com/2009/08/eclipse-color-themes.html .

Specifically:

  • [workspace]\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs
  • [workspace]\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.editors.prefs

Also, for future readers, @jonas-groger added comment below regarding http://eclipsecolorthemes.org/ as another option.

FIRST ANSWER (didn't address color syntax)

Using Eclipse Helios (older versions of Eclipse are similiar):

  • Window > Preferences > Java > Code Style > Formatter
  • Select your profile
  • Edit
  • Export...

This generates an XML file of all your Java formatting settings that can be easily shared/imported.

Upvotes: 33

Related Questions