tags:

views:

43

answers:

4

How to autogenerate xml based function header comments (@param etc) in Eclipse. Is there an equivalent of "///" shortcut in Visual Studio.

+1  A: 

http://jautodoc.sourceforge.net/

JAutodoc is an Eclipse Plugin for automatically adding Javadoc and file headers to your source code. It optionally generates initial comments from element name by using Velocity templates for Javadoc and file headers.

gulbrandr
+4  A: 

You can do this by clicking ALT+Shift+J inside the method/class. | It's not XML Based though, but you can generate JavaDoc by clicking Project->Generate JavaDoc... in the menubar.

Shaharyar
Its worth noting that the "/**" method will not work if there's already some form of comment before the method, but this one will. Admittedly, /** is easier to remember, so it's a tradeoff.
RHSeeger
@RHSeeger, yes. But as you said /** is easier to remember, and I have faced this issue only a very few times.
Nivas
@Nivas: Oh, I agree. I use the /** method in a vast majority of cases. It's good to know the alt/shift/J method though for when you have comments right before a method... so you don't need to remove them just to autogenerate the javadoc.
RHSeeger
+5  A: 

In the line just before the method definition, type /** and hit enter.

type /** here and hit enter
public void setName(String name)
{
   ...
}
Nivas
precisely the thing I was looking for.Thanks!
iJeeves
+1  A: 

You can specify what is autogenerated in Eclipse by going to Window->Preferences

Under, Java -> Code Style -> Code Templates; is the list of what comments get put where. You can google for the syntax of how to insert the different param names and other constants so that you can generate whatever comment you wish, be it Javadoc or other.

As Nivas said, typing /** then hitting enter will auto insert a the comment.

Andrew