How to comment a block in Eclipse?
Does Eclipse have a hot key to comment a block? and to uncomment a block?
Ctrl-/ to toggle "//" comments and Ctrl-Shift-/ to toggle "/* */" comments. At least for Java, anyway - other tooling may have different shortcuts.
Ctrl-\ will remove a block of either comment, but won't add comments.
Note: As for Eclipse CDT 4.4.2, Ctrl-Shift-/ will not uncomment a "/* */" block comment. Use Ctrl-Shift-\ in that case.
EDIT: It's Ctrl on a PC, but on a Mac the shortcuts may all be Cmd instead. I don't have a Mac myself, so can't easily check.
There are two possibilities:
Every line prepended with //
ctrl + / to comment
ctrl + \ to uncomment
Note: on recent eclipse cdt, ctrl + / is used to toggle comments (and ctrl + \ has no more effect)
Complete block surrounded with block comments /*
ctrl + shift + / to comment
ctrl + shift + \ to remove
For Eclipse Editor
For Single Line (Toggle Effect)
Comment : Ctrl+Shift+c
Uncomment: Ctrl+Shift+c
For Multiple Lines (Toggle Effect) (Select the lines you want to comment)
comment : Ctrl+Shift+c
Uncomment: Ctrl+Shift+c
It is for all html , css , jsp , java . It gives toggle effect.
I came here looking for an answer and ended up finding it myself, thanks to the previous responses.
In my particular case, while editing PHP code on Eclipse Juno, I have found that the previous commands won't work for me. Instead of them, I should press Ctrl+ 7 (on the superior number key) to obtain the double bar comment ("//"). There's no way I can comment them with the previous mentioned key combinations.