如何制作这样的Eclipse代码模板?

cya*_*ang 7 java eclipse

在一些Eclipse项目中,我可以看到每个代码文件(.java)都有这样的代码模板:

public class AClass {
  // ===========================================================
  // Constants
  // ===========================================================

  // ===========================================================
  // Fields
  // ===========================================================

  // ===========================================================
  // Constructors
  // ===========================================================
  // ===========================================================
  // Getter & Setter
  // ===========================================================

  // ===========================================================
  // Methods for/from SuperClass/Interfaces
  // ===========================================================

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

  // ===========================================================
  // Inner and Anonymous Classes
  // ===========================================================
}
Run Code Online (Sandbox Code Playgroud)

我想在创建新的java类时自动生成这些注释,那该怎么办?

我尝试在Eclipse首选项中设置代码模板,但没有成功.

Gil*_*e59 9

您必须转到Eclipse首选项,Java /代码样式/代码模板并选择例如New Java File或Class body,然后进行编辑!