1.點擊Window->Preference->Java -> Code Style -> Formatter
2.點擊右側Import選擇*.xml模板文件導入即可
3.如果需要對模板進行修改,可點擊Edit編輯即可
模板實例:
<?xml version="1.0" encoding="UTF-8"?> <profiles version="10"> <profile Profile" version="10"> <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> ........... ............ ............ .......... ............
注釋模板導入:
1.點擊Window->Preference->Java -> Code Style -> Code Templates
2.點擊右側Comments,然后點擊Import選擇*.xml模板文件導入即可
3.如果需要對模板進行修改,可點擊Comments下的某一項,然后點擊Edit編輯即可
實例:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description:
* @author ${user}
* @date ${date} ${time}
* @version V1.0
*/ /**
.....................
........................
................
...............
..............
.................
................
