2

I often see comment blocks like:

// ===========================================================
// Methods
// ===========================================================

Is there any way to add them in Eclipse fast?

Mateusz Kaflowski
  • 2,221
  • 1
  • 29
  • 35
  • `ctrl shift /` will add a block comment, but not in the format you have posted. – The Cat Mar 19 '13 at 10:58
  • 1
    BTW: when you need to separate fields and methods like this, your classes probably are too long. As a rule of thumb, a class should fit into 1-2 screens. – Andy Mar 19 '13 at 11:04
  • 1
    Please read the answers in http://stackoverflow.com/questions/2379197/how-to-mark-logical-sections-of-code-in-java-comments to see why this approach is wrong in most cases. – Bananeweizen Mar 19 '13 at 18:39

3 Answers3

3

You could try creating a code template: -> Window -> Preferences -> Java -> Editor -> Templates.

Kai
  • 38,985
  • 14
  • 88
  • 103
2

You can add your own comment template in Eclipse. I think you can do this under: Main Menu -> Window -> Preferences -> Java -> Code Style -> Code Templates -> Configure generated code and comments.

Take a look at these instructions here and this answer i think it is exactly what you need.

Community
  • 1
  • 1
CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
0

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.

Achintya Jha
  • 12,735
  • 2
  • 27
  • 39