[英]What is the eclipse shortcut for auto-generating a default and field constructor?
I had a look at: Eclipse-Shortcuts , but I found nothing for generating a constructor.我看了一下: Eclipse-Shortcuts ,但我没有找到任何生成构造函数的信息。
Whats the shortcut for generating a standard constructor?生成标准构造函数的快捷方式是什么?
Type the first letter of your class, then press Ctrl + Space , Eclipse will list suggestions within a combobox.输入班级的第一个字母,然后按Ctrl + Space ,Eclipse 将在组合框中列出建议。 The topmost suggestion is the default constructor.
最重要的建议是默认构造函数。 Press Enter , it will be done.
按Enter ,它会完成。 (I'm using Eclipse Juno and it works.)
(我正在使用 Eclipse Juno 并且它有效。)
Alt + Shift + s and then o opens the Generate Constructor using Fields
dialog. Alt + Shift + s然后o打开“
Generate Constructor using Fields
对话框。
Goto Source ---> Generate constructor using Fields
Under Source Title bar, select the Generate constructor using Fields option.在 Source Title 栏下,选择 Generate constructor using Fields 选项。
Or要么
Ctrl+Space
which displays the various suggestions possible, from there you can go for the default contructor. Ctrl+Space
显示各种可能的建议,从那里你可以找到默认的构造函数。
Ways to Generate default Constructor -生成默认构造函数的方法 -
1) Press Ctl + Space 1) 按Ctl + Space
Ways to Generate field Constructor -生成字段构造函数的方法 -
1) Press Alt + Shift + S + O 1) 按Alt + Shift + S + O
2) Right click -> Source -> Generate Constructor using field 2)右击->Source->Generate Constructor using field
3) Go to Source menu -> Generate Constructor using field 3)转到源菜单- >使用字段生成构造函数
4) Go to Windows menu -> Preferences -> General -> Keys (Write Generate Constructor using field on text field) 4) 转到Windows 菜单-> Preferences -> General -> Keys (Write Generate Constructor using field on text field)
When you hit CTRL-SPACE
inside your class definition, you will see a drop down.当您在类定义中按下
CTRL-SPACE
时,您会看到一个下拉菜单。 First option is your Constructor.第一个选项是您的构造函数。
For Mac Users it is对于 Mac 用户,它是
Option + Command(⌘) + S or Option + Command(⌘) + S或
Command(⌘) + Option + S will open the pop up. Command(⌘) + Option + S 将打开弹出窗口。
Or you could type Ctrl + 3 and type GCUF, what means.或者您可以键入 Ctrl + 3 并键入 GCUF,这是什么意思。 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
执行几乎相同的操作来生成 getter 和 setter:键入 Ctrl + 3 并键入 GGAS,什么意思,Generate Getters And Setters
There are several ways you can follow.您可以采用多种方法。
I think CTRL + 3 is great.我认为 CTRL + 3 很棒。
GCFS - generate constructors from a superclass. GCFS - 从超类生成构造函数。 GCUF - generate constructor using fields.
GCUF - 使用字段生成构造函数。 GGAS - generate getters and setters.
GGAS - 生成 getter 和 setter。
I think shortcut key to generate Constructors is outdated.我认为生成构造函数的快捷键已经过时了。
Alt+Shift+s
and then press A
opens the Generate Constructor using Fields
dialog Alt+Shift+s
然后press A
打开“ Generate Constructor using Fields
对话框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.