Eclipse 语法着色文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4818197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Syntax Coloring File
提问by Jonas Gr?ger
After setting up the Java syntax highlighting for my workspace, I want to backup this file to, lets say, give it to my friends.
在为我的工作区设置 Java 语法突出显示后,我想备份这个文件,比如说,把它交给我的朋友。
Can you tell me in which file Eclipse stores these coloring values?
你能告诉我 Eclipse 将这些颜色值存储在哪个文件中吗?
回答by kaliatech
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.
通过使用各种 Eclipse 首选项文件,可以共享 Java 颜色语法设置。请参阅: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
- [工作区]\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs
- [工作区]\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.editors.prefs
Also, for future readers, @jonas-grogeradded comment below regarding http://eclipsecolorthemes.org/as another option.
此外,对于未来的读者,@jonas-groger在下面添加了关于http://eclipsecolorthemes.org/作为另一种选择的评论。
FIRST ANSWER (didn't address color syntax)
第一个答案(没有解决颜色语法)
Using Eclipse Helios (older versions of Eclipse are similiar):
使用 Eclipse Helios(旧版本的 Eclipse 类似):
- Window > Preferences > Java > Code Style > Formatter
- Select your profile
- Edit
- Export...
- 窗口 > 首选项 > Java > 代码样式 > 格式化程序
- 选择您的个人资料
- 编辑
- 出口...
This generates an XML file of all your Java formatting settings that can be easily shared/imported.
这会生成一个包含所有 Java 格式设置的 XML 文件,可以轻松共享/导入。
回答by WesternGun
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.
有时只是import/export
不够,因此您可能需要.pref
存储语法着色设置的文件列表。我这里的内容并不完整,我只是列出了我使用的内容,希望对您有所帮助。
(I process .java
, .jsp
, .xml
, js
and .properties
files.)
(我的过程.java
,.jsp
,.xml
,js
和.properties
文件。)
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.
您可以通过搜索.pref
工作区中的文件来找到它们,然后打开每个文件以查看哪些包含颜色代码。请记住调整您的搜索选项以查看子文件夹。
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.
您可以在完成语法着色设置的调整后复制它们。需要时,.pref
再次搜索以访问它们的位置,并通过复制带有颜色代码的行来恢复您的设置,以避免不可预测的副作用。正如我所见,这是唯一的方法,不方便购买有效。
回答by aliopi
If you want, try out the Eclipse Color Themeplugin. It's easier.
如果需要,请试用Eclipse Color Theme插件。这更容易。
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.
安装插件后,去Windows > Preferences
那里General > Appearance > Color Themes
选择一个。
If you want to use the Intellij IDEA Theme, you must download the xmlfor it (not the .epf) and import it with the dialog.
如果您想使用 Intellij IDEA 主题,您必须为其下载 xml(而不是 .epf)并使用对话框导入它。
(I'm nota developer of this plugin)
(我不是这个插件的开发者)
回答by Stephane Baubillier
You can also create a .epf
file (Eclipse preference file) with the useful prefs contained in
您还可以创建一个.epf
文件(Eclipse 首选项文件),其中包含有用的首选项
[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>