Procedure: open window> preferences> JAVA> code style> code templates
Click "import" to import the template codetemplates. xml file.
Appendix: content of the codetemplates. xml file
<? 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 ">/** <br/> * <B> Project name: </B> system project name <br/> * <B> package name: </B >$ {package_name} <br/> * <B> File Name: </B >$ {file_name} <br/> * <B> Version Information: </B> <br/> * <B> date: </B >$ {date}-$ {time} <br/> * <B> copyright (c) </B> $ {year} XX Company-copyright <br/> */</template> <template autoinsert = "true" context = "filecomment_context" deleted = "false" Description = "comment for created JavaScript files" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. filecomment "name =" filecomment ">/** <br/> */</template> <template autoinsert =" true "context =" delegatecomment_context "deleted = "false" Description = "comment for delegate functions" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. delegatecomment "name =" delegatecomment ">/** <br/> * $ {tags} <br/> * $ {see_to_target} <br/> */</template> <template autoinsert = "false" context = "typecomment_context" deleted = "false" Description = "comment for created types" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. typecomment "name =" typecomment ">/** <br/> * @ author kin <br/> * $ {tags} <br/> */< /template> <template autoinsert = "false" context = "typecomment_context" deleted = "false" Description = "comment for created types" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. typecomment "name =" typecomment ">/** <br/> * <B> Class Name: </B >$ {type_name} <br/> * <B> class description: </B> <br/> * <B> Creator: </B> kin <br/> * <B> modifier: </B> kin <br/> * <B> modification time: </B >$ {date }$ {time} <br/> * <B> modify remarks: </B> <br/> * @ version 1.0.0 <br/> */</template> <template autoinsert =" true "context =" fieldcomment_context "deleted =" false "Description =" comment for vars "enabled =" true "id =" org. eclipse. WST. jsdt. UI. text. codetemplates. fieldcomment "name =" fieldcomment ">/** <br/> */</template> <template autoinsert =" false "context =" constructorcomment_context "deleted = "false" Description = "comment for created constructors" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. constructorcomment "name =" constructorcomment "> <br/>/** <br/> * Create a new instance $ {enclosing_type }. <br/> * $ {tags} <br/> */</template> <template autoinsert = "true" context = "overridecomment_context" deleted = "false "Description =" comment for overriding funding "enabled =" true "id =" org. eclipse. WST. jsdt. UI. text. codetemplates. overridecomment "name =" overridecomment ">/* (non-jsdoc) <br/> * $ {see_to_overridden} <br/> */</template> <template autoinsert = "true" context = "settercomment_context" deleted = "false" Description = "comment for setter method "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. settercomment "name =" settercomment ">/** <br/> * @ Param $ {Param} the $ {bare_field_name} to set <br/> */</template> <template autoinsert = "true" context = "settercomment_context" deleted = "false" Description = "comment for setter function" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. settercomment "name =" settercomment ">/** <br/> * @ Param $ {Param} the $ {bare_field_name} to set <br/> */</template> <template autoinsert = "false" context = "gettercomment_context" deleted = "false" Description = "comment for getter method" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. gettercomment "name =" gettercomment ">/** <br/> * $ {bare_field_name} <br/> * @ return the $ {bare_field_name} <br/> * @ since 1.0.0 <br/> */<br/> </template> <template autoinsert = "false" context = "methodcomment_context" deleted = "false" Description = "comment for non-overriding methods "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. methodcomment "name =" methodcomment ">/** <br/> * $ {enclosing_method} (the role of this method is described in one sentence here) <br/> * (the applicable conditions of this method are described here-optional) <br/> * $ {tags} <br/> * $ {return_type} <br/> * @ exception <br/> * @ since 1.0.0 <br/> */</template> <template autoinsert = "true" context = "delegatecomment_context" deleted = "false" Description = "comment for delegate methods" enabled = "true" id =" org. eclipse. jdt. UI. text. codetemplates. delegatecomment "name =" delegatecomment ">/** <br/> * $ {tags} <br/> * $ {see_to_target} <br/> */</template> <template autoinsert = "true" context = "constructorcomment_context" deleted = "false" Description = "comment for created constructors" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. constructorcomment "name =" constructorcomment ">/** <br/> * $ {tags} <br/> */</template> <template autoinsert =" true "context =" overridecomment_context "deleted =" false "Description =" comment for overriding methods "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. overridecomment "name =" overridecomment ">/* (non-javadoc) <br/> * $ {see_to_overridden} <br/> */</template> <template autoinsert = "false" context = "fieldcomment_context" deleted = "false" Description = "comment for fields "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. fieldcomment "name =" fieldcomment ">/** <br/> * $ {field }:$ {todo} (describe what this variable represents in one sentence) <br/> * @ since 1.0.0 <br/> */<br/> </template> <template autoinsert = "true" context = "gettercomment_context" Deleted = "false" Description = "comment for getter function" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. gettercomment "name =" gettercomment ">/** <br/> * @ return the $ {bare_field_name} <br/> */</template> <template autoinsert =" true" context = "methodcomment_context" deleted = "false" Description = "comment for non-overriding function" enabled = "true" id = "org. eclipse. WST. jsdt. UI. text. codetemplates. methodcomment "name =" methodcomment ">/** <br/> * $ {tags} <br/> */</template> </templates>