Search code examples
javaeclipsejavadoc

Editing Eclipse Javadoc ${tags} Variable


Version: Luna Service Release 2 (4.4.2)

I typically use the "/**" method to insert Javadoc on my methods. Eclipse inserts @param for the all the args, @throws for all the throwables, and a @return. However the @return never has a type appended to it. It looks like this:

/**
 * 
 * @param criteria
 * @param filters
 * @return
 */
protected static String 
          getColumnNameFromCriteria(SelectedCriteria criteria, List<SelectionFilter> filters)

The first question is: is there a switch somewhere in Eclipse to make it automatically insert the method return type when adding Javadoc?

I could not find one, so I looked up: preferences->java->code style->code templates->Methods

On that template I see a variable ${tags}. That variable is what generates the Javadoc shown above.

The second question is: is there a way to edit ${tags} to include the variable ${return_type} appended to @return that is generated by ${tags}?

I want to be able to type /**<enter> and have Eclipse automatically create the following Javadoc:

/**
 * 
 * @param criteria
 * @param filters
 * @return String 
 */
protected static String 
          getColumnNameFromCriteria(SelectedCriteria criteria, List<SelectionFilter> filters)

Solution

  • Have you tried jautodoc plugin? have a look in to it may be it will help you.its better than eclipse built in alt-shift-j

    http://jautodoc.sourceforge.net/