Reputation: 11534
I had a look at: Eclipse-Shortcuts, but I found nothing for generating a constructor.
Whats the shortcut for generating a standard constructor?
Upvotes: 63
Views: 81570
Reputation: 11
I think Ctrl + 3 is great. Type:
Upvotes: 1
Reputation: 1104
There are several ways you can follow.
Upvotes: 2
Reputation: 730
I think shortcut key to generate Constructors is outdated. Alt+Shift+s
and then press A
opens the Generate Constructor using Fields
dialog
Upvotes: 0
Reputation: 1742
For Mac Users it is
Option + Command(⌘) + S or
Command(⌘) + Option + S will open the pop up.
Upvotes: 3
Reputation: 21
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
Upvotes: 2
Reputation: 1075
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)
Upvotes: 7
Reputation: 5045
Alt+Shift+s and then o opens the Generate Constructor using Fields
dialog.
Upvotes: 79
Reputation: 25950
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.)
Upvotes: 97
Reputation: 33544
Goto Source ---> Generate constructor using Fields
Under Source Title bar, select the Generate constructor using Fields option.
Or
Ctrl+Space
which displays the various suggestions possible, from there you can go for the default contructor.
Upvotes: 15
Reputation: 15641
When you hit CTRL-SPACE
inside your class definition, you will see a drop down.
First option is your Constructor.
Upvotes: 4