先切個eclipse設定時的sample代碼圖:

再切一個自己的圖:
廢話不說,直接入題。
其實eclipse的各種配置都是在檔案設定裡的,是以隻要用一個配置好的模版來替換預設的配置檔案,即可将所有配置克隆到新的eclipse環境中。這些配置檔案在workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings檔案夾下。
懶人直接上代碼:檔案org.eclipse.ui.editors.prefs:
<a href="http://my.oschina.net/itblog/blog/353200#">?</a>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<code>abstracttexteditor.color.background.systemdefault=false</code>
<code>abstracttexteditor.color.foreground.systemdefault=false</code>
<code>linenumberruler=true</code>
<code>abstracttexteditor.color.foreground=248,248,248</code>
<code>abstracttexteditor.color.selectionbackground=37,59,118</code>
<code>currentlinecolor=60,65,77</code>
<code>printmargin=true</code>
<code>abstracttexteditor.color.background=12,16,33</code>
<code>linenumbercolor=141,143,173</code>
<code>abstracttexteditor.color.selectionbackground.systemdefault=false</code>
<code>printmargincolor=122,123,139</code>
<code>eclipse.preferences.version=1</code>
<code>breakpointindicationinoverviewruler=true</code>
<code>occurrenceindicationcolor=60,65,77</code>
<code>overviewruler_migration=migrated_3.1</code>
檔案org.eclipse.jdt.ui.prefs:
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<code>content_assist_disabled_computers=org.eclipse.jdt.ui.templateproposalcategory\u0000org.eclipse.jdt.ui.javanotypeproposalcategory\u0000org.eclipse.jdt.ui.javatypeproposalcategory\u0000org.eclipse.jdt.ui.textproposalcategory\u0000</code>
<code>content_assist_lru_history=<?</code><code>xml</code> <code>version\="1.0" encoding\="utf-8" standalone\="no"?><</code><code>history</code> <code>maxlhs\="100" maxrhs\="10"/></code>
<code>content_assist_number_of_computers=21</code>
<code>content_assist_parameters_background=0,0,0</code>
<code>content_assist_parameters_foreground=255,255,255</code>
<code>content_assist_proposals_background=255,255,255</code>
<code>content_assist_proposals_foreground=26,26,26</code>
<code>fontpropagated=true</code>
<code>java_bracket=0,255,0</code>
<code>java_comment_task_tag=0,128,0</code>
<code>java_default=144,238,144</code>
<code>java_doc_default=128,128,128</code>
<code>java_doc_keyword=128,0,255</code>
<code>java_doc_keyword_bold=false</code>
<code>java_doc_link=128,128,192</code>
<code>java_doc_tag=0,128,255</code>
<code>java_keyword=30,144,255</code>
<code>java_keyword_bold=false</code>
<code>java_keyword_return=255,0,255</code>
<code>java_keyword_return_bold=false</code>
<code>java_multi_line_comment=139,105,20</code>
<code>java_operator=255,255,0</code>
<code>java_single_line_comment=0,128,0</code>
<code>java_string=128,128,128</code>
<code>org.eclipse.jdt.ui.editor.tab.width=</code>
<code>org.eclipse.jdt.ui.formatterprofiles.version=12</code>
<code>org.eclipse.jdt.ui.javadoclocations.migrated=true</code>
<code>org.eclipse.jdt.ui.text.code_templates_migrated=true</code>
<code>org.eclipse.jdt.ui.text.custom_code_templates=<?</code><code>xml</code> <code>version\="1.0" encoding\="utf-8" standalone\="no"?><</code><code>templates</code><code>/></code>
<code>org.eclipse.jdt.ui.text.custom_templates=<?</code><code>xml</code> <code>version\="1.0" encoding\="utf-8" standalone\="no"?><</code><code>templates</code><code>/></code>
<code>org.eclipse.jdt.ui.text.templates_migrated=true</code>
<code>org.eclipse.jface.textfont=1|consolas|12.0|0|windows|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|consolas;</code>
<code>proposalordermigrated=true</code>
<code>semantichighlighting.abstractmethodinvocation.color=255,165,0</code>
<code>semantichighlighting.abstractmethodinvocation.enabled=true</code>
<code>semantichighlighting.annotation.color=229,229,229</code>
<code>semantichighlighting.annotationelementreference.color=191,191,191</code>
<code>semantichighlighting.annotationelementreference.enabled=true</code>
<code>semantichighlighting.autoboxing.color=230,230,250</code>
<code>semantichighlighting.autoboxing.enabled=true</code>
<code>semantichighlighting.class.color=173,216,230</code>
<code>semantichighlighting.class.enabled=true</code>
<code>semantichighlighting.deprecatedmember.color=255,165,0</code>
<code>semantichighlighting.enum.enabled=true</code>
<code>semantichighlighting.field.color=160,32,240</code>
<code>semantichighlighting.inheritedmethodinvocation.color=255,192,203</code>
<code>semantichighlighting.inheritedmethodinvocation.enabled=true</code>
<code>semantichighlighting.interface.color=255,165,0</code>
<code>semantichighlighting.interface.enabled=true</code>
<code>semantichighlighting.localvariable.color=230,230,250</code>
<code>semantichighlighting.localvariable.enabled=true</code>
<code>semantichighlighting.localvariabledeclaration.color=229,229,229</code>
<code>semantichighlighting.localvariabledeclaration.enabled=true</code>
<code>semantichighlighting.method.color=191,191,191</code>
<code>semantichighlighting.method.enabled=true</code>
<code>semantichighlighting.methoddeclarationname.bold=false</code>
<code>semantichighlighting.methoddeclarationname.color=128,200,64</code>
<code>semantichighlighting.methoddeclarationname.enabled=true</code>
<code>semantichighlighting.number.color=255,255,255</code>
<code>semantichighlighting.number.enabled=true</code>
<code>semantichighlighting.parametervariable.color=229,229,229</code>
<code>semantichighlighting.parametervariable.enabled=true</code>
<code>semantichighlighting.staticfield.color=255,0,0</code>
<code>semantichighlighting.staticfinalfield.color=144,238,144</code>
<code>semantichighlighting.staticfinalfield.enabled=true</code>
<code>semantichighlighting.staticmethodinvocation.color=255,0,0</code>
<code>semantichighlighting.typeargument.enabled=true</code>
<code>semantichighlighting.typeparameter.color=173,216,230</code>
<code>semantichighlighting.typeparameter.enabled=true</code>
<code>sourcehoverbackgroundcolor=245,245,181</code>
<code>sourcehoverbackgroundcolor.systemdefault=false</code>
<code>sp_cleanup.add_default_serial_version_id=true</code>
<code>sp_cleanup.add_generated_serial_version_id=false</code>
<code>sp_cleanup.add_missing_annotations=true</code>
<code>sp_cleanup.add_missing_deprecated_annotations=true</code>
<code>sp_cleanup.add_missing_methods=false</code>
<code>sp_cleanup.add_missing_nls_tags=false</code>
<code>sp_cleanup.add_missing_override_annotations=true</code>
<code>sp_cleanup.add_serial_version_id=false</code>
<code>sp_cleanup.always_use_blocks=true</code>
<code>sp_cleanup.always_use_parentheses_in_expressions=false</code>
<code>sp_cleanup.always_use_this_for_non_static_field_access=false</code>
<code>sp_cleanup.always_use_this_for_non_static_method_access=false</code>
<code>sp_cleanup.convert_to_enhanced_for_loop=false</code>
<code>sp_cleanup.correct_indentation=false</code>
<code>sp_cleanup.format_source_code=false</code>
<code>sp_cleanup.format_source_code_changes_only=false</code>
<code>sp_cleanup.make_local_variable_final=false</code>
<code>sp_cleanup.make_parameters_final=false</code>
<code>sp_cleanup.make_private_fields_final=true</code>
<code>sp_cleanup.make_type_abstract_if_missing_method=false</code>
<code>sp_cleanup.make_variable_declarations_final=true</code>
<code>sp_cleanup.never_use_blocks=false</code>
<code>sp_cleanup.never_use_parentheses_in_expressions=true</code>
<code>sp_cleanup.on_save_use_additional_actions=false</code>
<code>sp_cleanup.organize_imports=true</code>
<code>sp_cleanup.qualify_static_field_accesses_with_declaring_class=false</code>
<code>sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true</code>
<code>sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true</code>
<code>sp_cleanup.qualify_static_member_accesses_with_declaring_class=false</code>
<code>sp_cleanup.qualify_static_method_accesses_with_declaring_class=false</code>
<code>sp_cleanup.remove_private_constructors=true</code>
<code>sp_cleanup.remove_trailing_whitespaces=false</code>
<code>sp_cleanup.remove_trailing_whitespaces_all=true</code>
<code>sp_cleanup.remove_trailing_whitespaces_ignore_empty=false</code>
<code>sp_cleanup.remove_unnecessary_casts=true</code>
<code>sp_cleanup.remove_unnecessary_nls_tags=false</code>
<code>sp_cleanup.remove_unused_imports=false</code>
<code>sp_cleanup.remove_unused_local_variables=false</code>
<code>sp_cleanup.remove_unused_private_fields=true</code>
<code>sp_cleanup.remove_unused_private_members=false</code>
<code>sp_cleanup.remove_unused_private_methods=true</code>
<code>sp_cleanup.remove_unused_private_types=true</code>
<code>sp_cleanup.sort_members=false</code>
<code>sp_cleanup.sort_members_all=false</code>
<code>sp_cleanup.use_blocks=false</code>
<code>sp_cleanup.use_blocks_only_for_return_and_throw=false</code>
<code>sp_cleanup.use_parentheses_in_expressions=false</code>
<code>sp_cleanup.use_this_for_non_static_field_access=false</code>
<code>sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true</code>
<code>sp_cleanup.use_this_for_non_static_method_access=false</code>
<code>sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true</code>
<code>spelling_locale_initialized=true</code>
<code>tabwidthpropagated=true</code>
<code>useannotationsprefpage=true</code>
<code>usequickdiffprefpage=true</code>
注意,在替換檔案内容前,建議先把原來的檔案備份一下,拷貝該檔案,在檔案名最後增加.bak字尾,以後如果不想要這個深色主題了,直接可以用原來的檔案恢複過來,友善又簡單。
替換後,重新開機eclipse即可看到效果。
這些屬性具體的含義,一看應該能夠猜到七八分了。如果覺得有些顔色不太喜歡,請自行修改。細節修改可以參看下面的“手動修改”。
window->preferences->general->editor->text editors->右邊選擇appearance color options->選background color 選擇背景顔色,這裡我選的是(12,16,33)
選current line highlight 來改變目前選中行的顔色。
window->preferences->java->editor->syntax coloring->右邊有個element,展開裡面的節點,選擇要修改的項,右邊作修改:
當然,修改xml檔案的相關背景色也差不多,路徑為:
window->preferences->xml->xml files->editor->syntax coloring->右邊有個syntax element,選擇要修改的項,右邊作修改即可。最後再上一個xml檔案的效果圖: