To set the entry for the comment template: Window->preference->java->code style->code templates,
then expand the Comments node is all the elements that need to be annotated.
The following are some examples:
Files Note Tags:
/**@author @version * * Package Com.candy.candy.test;
Type (Types) Comment Label (note for Class):
/**@author @version */public class Codestyletemplate {}
Methods (Constructor & Methods) Tags:
/** * TODO @author Candy czx * @date 2014-10-24 morning 12:07:06 @version V1.0 @param arg1 @param arg2 @return */ Public string Testcodestyletemplate (String arg1, String arg2) { returnnull; }
Templates for the code style of other methods, properties, and so on, are configured by default values.
Attached: The above configuration of the Codetemplates.xml, directly to copy and paste.
<?XML version= "1.0" encoding= "UTF-8" standalone= "no"?><Templates><TemplateAutoInsert= "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) * ${see_to_overridden} */</Template><TemplateAutoInsert= "true"Context= "Fieldcomment_context"deleted= "false"Description= "Comment for Fields"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.fieldcomment"name= "Fieldcomment">/** * */</Template><TemplateAutoInsert= "true"Context= "Constructorcomment_context"deleted= "false"Description= "Comment for created constructors"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.constructorcomment"name= "Constructorcomment">/** * ${tags} */</Template><TemplateAutoInsert= "true"Context= "Settercomment_context"deleted= "false"Description= "Comment for setter Method"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.settercomment"name= "Settercomment">/** * @param ${param} The ${bare_field_name} to set */</Template><TemplateAutoInsert= "true"Context= "Delegatecomment_context"deleted= "false"Description= "Comment for delegate Methods"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.delegatecomment"name= "Delegatecomment">/** * ${tags} * ${see_to_target} */</Template><TemplateAutoInsert= "false"Context= "Methodcomment_context"deleted= "false"Description= "Comment for non-overriding methods"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.methodcomment"name= "Methodcomment">/** * ${todo} * @author Candy CZX * @date ${date} ${time} * @version V1.0 * ${tags} */</Template><TemplateAutoInsert= "false"Context= "Typecomment_context"deleted= "false"Description= "Comment for created types"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.typecomment"name= "Typecomment">/** * ${tags} * ${todo} * @author Candy CZX * @date ${date} ${time} * @version V1.0 * *</Template><TemplateAutoInsert= "false"Context= "Filecomment_context"deleted= "false"Description= "Comment for created Java files"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.filecomment"name= "Filecomment">/** * @projectName ${project_name} * @package ${package_name}.${file_name} * @Copyright Copyright (c) ${year} Candy Union * @author Candy CZX * @date ${date} ${time} * @version V1.0 * *</Template><TemplateAutoInsert= "true"Context= "Gettercomment_context"deleted= "false"Description= "Comment for getter Method"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.gettercomment"name= "Gettercomment">/** * @return the ${bare_field_name} */</Template></Templates>
When generating Java annotations using MyEclipse, the code Template used