views:

150

answers:

2

I know it's possible to generate comments for classes, interface, etc., in the wizard screen when creating them, but I haven't found an option to generate javadoc comments for an existing file. Is it possible?

Thanks.

+4  A: 

The command is "Add Javadoc Comment", or "Generate Element Comment" (Alt+Shift+J), and it is dependent on the one element currently selected.
It cannot be applied to a all file. So if you select the all class through the project explorer view, you won't be able to generate all the missing comments from there.

But from the Project Explorer, as Vitalii Fedorenko mentions in the comments, it works (just tested it):

you should expand a class in the Package Explorer, select all elements and press Alt+Shift+J

alt text

VonC
To apply it to a file you should expand a class in the Package Explorer, select all elements and press Alt + Shift + J
Vitalii Fedorenko
@Vitalii: true, I just tested it and amended my answer to reflect that.
VonC
There's a screenshot. wow. Thank you so much.
Amir Rachum
A: 

If you like to keep both hands on keyboard, then typing /** on the line before a method and pressing enter works too:

/**[press enter here]
int avg(int a, int b) throws ArithmeticException {
    ...
}

-->

/**
 * 
 * @param a
 * @param b
 * @return
 * @throws ArithmeticException
 */
int avg(int a, int b) throws ArithmeticException {
    ...
}
COME FROM