How to autogenerate xml based function header comments (@param etc) in Eclipse. Is there an equivalent of "///" shortcut in Visual Studio.
There may be a better approach, but if you expand the class in Package Explorer, select the methods you would to document, then right-click and select "Source -> Generate Element Comment" that will add comments for all the selected methods.
Shift-Alt-J is a useful keyboard shortcut in Eclipse for creating Javadoc comment templates.
Finding comments is easy: search for "/*" or "//". And since comments have no formal relation to code, when is a comment "about" the code nearby, and when is it just a comment ("a sonnet to ...")?
In the line just before the method definition, type /**
and hit enter.
In the IDE, type /**
just before the method and hit enter.
Eclipse will autogenerate the Javadoc tags and the end */
type /** here and his enter, eclipse will generate the javadoc tags and the end */
public void setName(String name)
{
...
}
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With