How to enrich the content of Eclipse annotations
Comments, Code Templates---Preferences, Windows, Eclipse, Window (Comments represents a comment template)
1. Files (Java file comments)
/***/
2. Types (Java class comment)
/**@author @version @since*/
3. Fields (class field comment)
/**@since* /
4. Constructors (constructor comment)
/***/
5. Methods (Java method Comment)
/**@author@since* /
6. Overriding methods (override method Comment)
/***/
7, Delegate methods (Agent method Comment)
/***/
8. Getters (Java getter method Comment)
/**@return@since * /
9. Setters (Java Setters method Comment)
/**@param ${param} @since* /
Code Templates, Code Preferences, Windows, Eclipse, Window
1. New Java files (new Java file Code template)
/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyr Ight (c) ${year}, [email protected] All rights Reserved. **/${filecomment}${package_declaration}/*** Classname:${type_name} <br/> * Function: ${todo} add Function. <br/> * Reason: ${todo} add Reason. <br/> * Date: ${date} ${time} <br/> *@author${user} *@version * @sinceJDK 1.6 *@see */${typecomment}${type_declaration}
2. Method body (Methods body template)
// ${todo} auto-generated method stub${body_statement}
3. Constructor body (constructor template)
${body_statement} // ${todo} auto-generated constructor stub
4. Getter Body (Field Getter method template
return ${field};
5. Setter Body (field setter method template)
${field} = ${param};
6. Catch block body (Exception catch code block template)
// ${todo} auto-generated catch block${exception_var}.printstacktrace ();
The detailed codetemplates.xml are as follows:
<?xml version= "1.0" encoding= "UTF-8" standalone= "no"? ><templates><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 ">/*** ${bare_field_name}. * *@returnThe ${bare_field_name} *@sinceJDK 1.6*/</template><template autoinsert= "false" context= "Settercomment_context" deleted= "false" description= " Comment for Setter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "Name=" Settercomment ">/*** ${param}. * *@param${param} The ${bare_field_name} to set *@sinceJDK 1.6*/</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" >/*** Creates a new instance of ${enclosing_type}. * * ${tags}*/</template><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 ">/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyri Ght (c) ${year}, [email protected] All rights Reserved. * */</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 " >/*** ClassName: ${type_name} <br/> * function: ${todo} ADD Function. <br/> * Reason: ${todo} ADD REASON (optional). <br/> * Date: ${date} ${time} <br/> * * @author${user} *@version${enclosing_type}${tags} *@sinceJDK 1.6*/</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 ">/*** ${field}:${todo} (describe what this variable represents in a sentence). *@sinceJDK 1.6*/</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 ">/*** ${enclosing_method}:(here to describe the effect of this method). <br/> * ${todo} (This method is described here to apply conditions – optional) .<br/> * ${ TODO} (described here for the execution process of this method – optional) .<br/> * ${todo} (here is a description of how this method is used – optional) .<br/> * ${todo} (This method is described here for considerations – optional) .<br/> * * @author${user} * ${tags} *@sinceJDK 1.6*/</template><template autoinsert= "false" context= "Overridecomment_context" deleted= "false" description= " Comment for overriding methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "Name=" Overridecomment ">/*** ${todo} simply describes the implementation of the method (optional). * ${see_to_overridden}*/</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 ">/*** ${tags} * ${see_to_target}*/</template><template autoinsert= "false" context= "Newtype_context" deleted= "false" description= "Newly Created files "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.newtype "name=" Newtype ">/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyri Ght (c) ${year}, [email protected] All rights Reserved. **/${filecomment}${package_declaration}/*** Classname:${type_name} <br/> * function: ${todo} ADD Function. <br/> * Reason: ${to DO} ADD REASON. <br/> * Date: ${date} ${time} <br/> * @author${user} *@version * @sinceJDK 1.6 *@see */${typecomment}${type_declaration}</template><template autoinsert= "true" context= "Classbody_context" deleted= "false" description= "Code in New Class type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.classbody "name=" Classbody "></ Template><template autoinsert= "true" context= "Interfacebody_context" deleted= "false" description= "Code in New Interface type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.interfacebody "name=" Interfacebody " ></template><template autoinsert= "true" context= "Enumbody_context" deleted= "false" description= "Code in New enum type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.enumbody "name=" Enumbody "></ Template><template autoinsert= "true" context= "Annotationbody_context" deleted= "false" description= "Code in New Annotation type bodies "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.annotationbody "Name=" Annotationbody "></template><template autoinsert=" true "context=" Catchblock_contExt "deleted=" false "description=" Code in new catch blocks "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.catchblock "name=" Catchblock ">//${todo} auto-generated catch block${exception_var}.printstacktrace ();</template><template autoinsert= "false" context= "Methodbody_context" deleted= "false" description= "Code in Created method stubs "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodbody "name=" MethodBody ">//${todo} auto-generated method Stub${body_statement}</template><template autoinsert= "true" context= "Constructorbody_context" deleted= "false "Description=" Code in created constructor stubs "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorbody "name=" Constructorbody ">${body_statement}//${todo} auto-generated constructor stub</template><template autoinsert= "true" context= "Getterbody_context" deleted= "false" description= "Code in Created getters "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.getterbody "name=" Getterbody ">return${field};</template><template autoinsert= "true" context= "Setterbody_context" deleted= "false" description= "Code in created Setters" enabled= "true" id= "Org.eclipse.jdt.ui.text.codetemplates.setterbody" name= "Setterbody" > ${field} = ${param};</template></templates>
Enrich the content of Eclipse annotations