Set the entry for the comment template: Window->preference->java->code style->code Template and expand the Comments node is all the elements that need to be annotated. Each of these elements is now introduced:
Files Note Tags:
/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author A18ccms a18ccms_gmail_com
* @date ${date} ${time}
* @version V1.0
*/
Type (Types) Comment Label (note for Class):
/**
* @ClassName: ${type_name}
* @Description: ${todo} (here is a word describing the role of this class)
* @author A18ccms a18ccms_gmail_com
* @date ${date} ${time}
*
* ${tags}
*/
Field Comment Label:
/**
* @Fields ${field}: ${todo} (describe what this variable means in a sentence)
*/
Constructor Tags:
/**
* <p>title: </p>
* <p>description: </p>
* ${tags}
*/
Methods (Constructor & Methods) Tags:
/**
* @Title: ${enclosing_method}
* @Description: ${todo} (here is a word describing the effect of this method)
* @param ${tags} settings file
* @return ${return_type} return type
* @throws
*/
Override method (overriding Methods) Label:
/* (non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/
Delegate method (Delegate Methods) Label:
/**
* ${tags}
* ${see_to_target}
*/
Getter Method Tags:
/**
* @return ${bare_field_name}
*/
Setter Method Tags:
/**
* @param ${param} to set the ${bare_field_name}
*/
Examples of simple templates:
<?xml version= "1.0" encoding= "UTF-8"? ><templates><template autoinsert= "true" context= "Fieldcomment_ Context "deleted=" false comment "description=" field "enabled=" true "id=" org.eclipse.jdt.ui.text.codetemplates.fieldcomment "Name=" Fieldcomment ">/**
* @Fields ${field}: ${todo} (describe what this variable means in a sentence)
*/
</template><template autoinsert= "true" context= "Gettercomment_context" deleted= "false" description= " Comment For getter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.gettercomment "name=" Gettercomment ">/**
* @return ${bare_field_name}
*/
</template><template autoinsert= "true" context= "Constructorcomment_context" deleted= "false" description= " Create a comment for the constructor "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorcomment "Name=" constructorcomment ">/**
* <p>title:${file_name} </p>
* <p>description: Constructors </p>
* ${tags}
*/
</template><template autoinsert= "true" context= "Filecomment_context" deleted= "false" description= "created Comments for Java files "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.filecomment "name=" Filecomment ">/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author Daiguangjiu
* @date ${date} ${time}
* @version V1.0
*/
</template><template autoinsert= "true" context= "Settercomment_context" deleted= "false" description= " Annotation for setter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "name=" Settercomment ">/**
* @param ${param} to set the ${bare_field_name}
*/</template><template autoinsert= "true" context= "Typecomment_context" deleted= "false" description= " Create a comment for the type "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.typecomment "name=" Typecomment ">/**
* @author ${user}
*
* ${tags}
*/</template><template autoinsert= "true" context= "Delegatecomment_context" deleted= "false" description= " The comment representing the method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.delegatecomment "name=" Delegatecomment ">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert= "true" context= "Overridecomment_context" deleted= "false" description= " The comment for the overriding method is "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "name=" Overridecomment ">/** ( Non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/</template><template autoinsert= "true" context= "Methodcomment_context" deleted= "false" description= " Comments for non-overridden methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodcomment "name=" Methodcomment ">/**
* ${tags}
*/</template></templa
<?xml version= "1.0" encoding= "UTF-8"? ><templates><template autoinsert= "true" context= "Fieldcomment_ Context "deleted=" false comment "description=" field "enabled=" true "id=" org.eclipse.jdt.ui.text.codetemplates.fieldcomment "Name=" Fieldcomment ">/**
* @Fields ${field}: ${todo} (describe what this variable means in a sentence)
*/
</template><template autoinsert= "true" context= "Gettercomment_context" deleted= "false" description= " Comment For getter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.gettercomment "name=" Gettercomment ">/**
* @return ${bare_field_name}
*/
</template><template autoinsert= "true" context= "Constructorcomment_context" deleted= "false" description= " Create a comment for the constructor "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorcomment "Name=" constructorcomment ">/**
* <p>title:${file_name} </p>
* <p>description: Constructors </p>
* ${tags}
*/
</template><template autoinsert= "true" context= "Filecomment_context" deleted= "false" description= "created Comments for Java files "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.filecomment "name=" Filecomment ">/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author Daiguangjiu
* @date ${date} ${time}
* @version V1.0
*/
</template><template autoinsert= "true" context= "Settercomment_context" deleted= "false" description= " Annotation for setter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "name=" Settercomment ">/**
* @param ${param} to set the ${bare_field_name}
*/</template><template autoinsert= "true" context= "Typecomment_context" deleted= "false" description= " Create a comment for the type "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.typecomment "name=" Typecomment ">/**
* @author ${user}
*
* ${tags}
*/</template><template autoinsert= "true" context= "Delegatecomment_context" deleted= "false" description= " The comment representing the method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.delegatecomment "name=" Delegatecomment ">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert= "true" context= "Overridecomment_context" deleted= "false" description= " The comment for the overriding method is "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "name=" Overridecomment ">/** ( Non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/</template><template autoinsert= "true" context= "Methodcomment_context" deleted= "false" description= " Comments for non-overridden methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodcomment "name=" Methodcomment ">/**
* ${tags}
*/</template></templa
Example 2:
<?xml version= "1.0" encoding= "UTF-8"?>
<templates>
<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" >
/**
* Create a new instance of ${enclosing_type}.
*
* ${tags}
*/
</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" >
/**
* @param ${param} The ${bare_field_name} to set
*/
</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" >
/**
* This method describes:
* @author: [email protected]
* @version: ${date} ${time}
*/
</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= "Filecomment_context"
Deleted= "false"
Description= "Comment for created Java files"
Enabled= "true"
Id= "Org.eclipse.jdt.ui.text.codetemplates.filecomment"
Name= "Filecomment" >
/**
* File name: ${file_name}
*
* Version information:
* Date: ${date}
* Copyright under the Corporation ${year}
* All rights reserved
*
*/
</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" >
/**
* ${bare_field_name}
*
* @return The ${bare_field_name}
* @since codingexample Ver (code example view) 1.0
*/
</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)
* ${see_to_overridden}
*/
</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 means in a sentence)
*
* @since Ver 1.1
*/
</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" >
/**
* This class describes:
* @author: [email protected]
* @version: ${date} ${time}
*/
</template>
</templates>
<?xml version= "1.0" encoding= "UTF-8"?>
<templates>
<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" >
/**
* Create a new instance of ${enclosing_type}.
*
* ${tags}
*/
</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" >
/**
* @param ${param} The ${bare_field_name} to set
*/
</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" >
/**
* This method describes:
* @author: [email protected]
* @version: ${date} ${time}
*/
</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= "Filecomment_context"
Deleted= "false"
Description= "Comment for created Java files"
Enabled= "true"
Id= "Org.eclipse.jdt.ui.text.codetemplates.filecomment"
Name= "Filecomment" >
/**
* File name: ${file_name}
*
* Version information:
* Date: ${date}
* Copyright under the Corporation ${year}
* All rights reserved
*
*/
</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" >
/**
* ${bare_field_name}
*
* @return The ${bare_field_name}
* @since codingexample Ver (code example view) 1.0
*/
</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)
* ${see_to_overridden}
*/
</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 means in a sentence)
*
* @since Ver 1.1
*/
</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" >
/**
* This class describes:
* @author: [email protected]
* @version: ${date} ${time}
*/
</template>
</templates>
Details of Eclipse's latest release note template settings