This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes eclipse, javadoc and ${tags} Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse, javadoc and ${tags}" Watch "eclipse, javadoc and ${tags}" New topic

eclipse, javadoc and ${tags}

christophe seguinot

Joined: Oct 19, 2007
Posts: 18

In the javadoc template of a method (java -> Code Style -> Code Template : Comments -> Methods) we can have :

Take the following example :

By clicking on ctrl + shift + j, we get :

Extract form the eclipse documentation :
"Comment templates can contain the variable ${tags} that will be substituted by the standard Javadoc tags (@param, @return..) for the commented element."

I would like to customize the template associated to @{tags} in order to add the @link tags.

Does anyone know how to do this or at least if it's possible or maybe the name of the eclipse plugin which is used, some clue perhaps ?

Best regards,
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17148

Making a template like what you described is easy. Making the link target point somewhere requires that something be able to figure out where that "somewhere" is going to be.

If you were actually just planning to link to the parameter's datatype javadocs, the link tag would be redundant, since the normal javadoc generator already does that.

An IDE is no substitute for an Intelligent Developer.
B Kelly

Joined: Aug 13, 2012
Posts: 1
Similar question: I'd like to customize ${tags} in auto-generated constructors to reference javadoc I write for fields set in the constructor. I do something similar for auto-getters and setters:

* Get the ${bare_field_name}.
* @return the ${bare_field_name}
* @see #${bare_field_name}

* Set the ${bare_field_name}.
* @param ${param} input ${bare_field_name}
* @see #${bare_field_name}

This would be a big time saver, as I would only have to document the fields once instead of repeat or copy paste for multiple constructors. Any straightforward way to do this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17148

Welcome to the JavaRanch B,

Actually, rather than raising a dead topic (zombie), we'd prefer that you start a new one.

It's very easy to customize the autodocs in Eclipse. Just go to Help/Preferences, select Java, Code Style, Code Templates. The items in question are "fields", "getters" and "setters". These are the templates that are used when generating properties and accessor/mutator methods.
I agree. Here's the link:
subject: eclipse, javadoc and ${tags}
jQuery in Action, 3rd edition