Eclipse is very handy for generating javadocs for me. I have it set up to generate a class javadoc in the following format simply by pressing Ctrl-Shift-J:
/**
*****************************************************************************
* Class name - Desc
*
* @author Scott Johnson
* @version 1 <timestamp>
*****************************************************************************
*/
I’d like to be able to generate a new @version tag, though, with a similar keypress. Is there any way I can bind a key combination (such as Ctrl-Alt-Shift-T or V) to automatically place a new timestamp in the comment?
Ideally, I’d like to have something that would add a new version to the class javadoc – so if I had something like:
/**
*****************************************************************************
* MyClass - A simple example
*
* @author Scott Johnson
* @version 1 1:36:04 PM Feb 16, 2010
*****************************************************************************
*/
And I pressed Ctrl-Alt-Shift-T (or whatever) over the class name, it would add the following line:
* @version 2 2:28:04 PM Nov 16, 2010
underneath
* @version 1 1:36:04 PM Feb 16, 2010
One option would be to create a Template (Java -> Editor -> Templates if you are using java).
Name the new template “@version” and in the pattern field write:
This will insert the current date and type and place your mouse cursor where in your current example the version number would go.
Now when you are in the java perspective and you write @version pressing command spacebar should execute your template.