Eclipse Syntax Coloring File

后端 未结 4 1475
孤独总比滥情好
孤独总比滥情好 2021-02-02 11:50

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 sto

相关标签:
4条回答
  • 2021-02-02 12:17

    You can also create a .epf file (Eclipse preference file) with the useful prefs contained in

    [workspace]\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.editors.prefs, and then import it (File > Import > General > Prefernces).
    

    Here is an example :

    <code>
    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
    
    </code>
    
    0 讨论(0)
  • 2021-02-02 12:20

    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.

    0 讨论(0)
  • 2021-02-02 12:30

    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.

    0 讨论(0)
  • 2021-02-02 12:41

    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.

    (I'm not a developer of this plugin)

    0 讨论(0)
提交回复
热议问题