TL;DR:
Generate Getters and Setters in 2 Seconds:
Think: “generate getters and setters” et voilà here they are!
Do: Shift + Alt + S -> R -> TAB -> ENTER -> Shift+TAB -> ENTER

Hi, I hate using the mouse while thinking and programming in Eclipse. It’s a common task to implement a simple POJO with Getters and Setters for all fields and you all probably now the possibility to do it like that:

Right-Click -> Source -> Generate Getters and Setters… Than you need to select all fields or hit the “Select All” button and click OK.

This is nice but you need to move your hand to the mouse, then it takes at least 4 Clicks and you need to navigate through 2 levels of the context-menu. This takes me around 4-5 Seconds (unless I mess up some mouse-movement..) and it disrups my thinking-process. I need getters and setters as fast as possible without thinking!

Here is what I do – without touching the mouse!

By default the short-cut Shift + Alt + S in Windows shows the source quick menu. Then pressing R opens the Generate Getters and Setters menu. You can rebind it in Windw->Propertiers > General > Keys. Many people use Shift + Alt + G as a short cut, but I will go with the default one.

After opening the Generator you can select all fields by hitting: TAB -> ENTER.

Then to close and actually generate the methods you need to press OK. However the focus is still on the “Select All” Button. But by hitting Shift +TAB the focus is back to the list, and hitting ENTER on the list actually is the same as pressing the OK button. So here you go:

Shift + Alt + S -> R -> TAB -> ENTER -> Shift+TAB -> ENTER

Just do it like 5-10 times for training right away.

Now, this takes me less than 2 seconds which does not disrupt my thinking process: It’s like thinking “generate getters and setters” et voilà here they are!