What is the eclipse shortcut for auto-generating a default and field constructor?

前端 未结 10 1157
情话喂你
情话喂你 2020-12-13 16:59

I had a look at: Eclipse-Shortcuts, but I found nothing for generating a constructor.

Whats the shortcut for generating a standard constructor?

相关标签:
10条回答
  • 2020-12-13 17:25

    Type the first letter of your class, then press Ctrl+Space, Eclipse will list suggestions within a combobox. The topmost suggestion is the default constructor. Press Enter, it will be done. (I'm using Eclipse Juno and it works.)

    0 讨论(0)
  • 2020-12-13 17:35

    Ways to Generate default Constructor -
    1) Press Ctl + Space

    Ways to Generate field Constructor -
    1) Press Alt + Shift + S + O
    2) Right click -> Source -> Generate Constructor using field
    3) Go to Source menu -> Generate Constructor using field
    4) Go to Windows menu -> Preferences -> General -> Keys (Write Generate Constructor using field on text field)

    0 讨论(0)
  • 2020-12-13 17:35

    When you hit CTRL-SPACE inside your class definition, you will see a drop down. First option is your Constructor.

    0 讨论(0)
  • 2020-12-13 17:37

    I think CTRL + 3 is great.

    GCFS - generate constructors from a superclass. GCUF - generate constructor using fields. GGAS - generate getters and setters.

    0 讨论(0)
  • 2020-12-13 17:43

    I think shortcut key to generate Constructors is outdated. Alt+Shift+s and then press A opens the Generate Constructor using Fields dialog

    0 讨论(0)
  • 2020-12-13 17:46

    Or you could type Ctrl + 3 and type GCUF, what means. Generate Constructor Using Field. Do almost the same to generate getters and setters: Type Ctrl + 3 and type GGAS, what means, Generate Getters And Setters

    0 讨论(0)
提交回复
热议问题