Eclipse and STS (Spring Tool Suite) IDEs have the same shortcuts. STS is written on top of the Eclipse. So Eclipse shortcuts can be used in STS as well. Following are some important eclipse and sts ide shortcuts that every developer should know.
Fomat Code : Ctrl + Shift + F
Select the whole program or a particular block and press Ctrl + Shift + F to format the code
Correct Indentation : Ctrl + I
Select all the lines of the program or a particular block for correct indentation. Format all the lines and only indent the particular block, a few lines, or a single line.
Go to Line: Ctrl + L
Go to a Line Number. Enable the Line numbers by using the Show Line Numbers menu. Useful in debugging the line by line number while doing a screen presentation.
Toggle Comment: Ctrl + 7
Comment a line or uncomment a line. Toggles the comment. Also Ctrl + / or Crtl + Shift + C can be used as toggle comment. So all these three shortcuts do the same functionality.
Autocomplete or Show template proposals: Crtl + Space
It is used as a content assist. You can press at any new line or after a code to see the template proposals like a variable, method, keywords, etc.
Organize Import: Ctrl + Shift + O
If Ctrl + Shift + O is pressed it arranges the import statements in order, removes unused imports, and adds the missing import statements. Import statements are sorted according to alphabetical order. It also groups the imports and each group of imports is differentiated by a new line.
Rename: Alt + Shift + R
Renames the current selection. If the current selection is on a file it opens a dialog to rename the file. If a method is selected and the shortcut keys are pressed it renames a method. On the method selection or variable, expand the Options to Open a rename dialog. Alt + Shift + R shortcut on a method or a variable just works like a Ctrl + 2, R shortcut key.
Open Resource: Ctrl + Shift + R
To open a java class or any file with a different extension.
Open Type: Ctrl + Shift + T
To open a file that exists in another jar or third-party jars. For example, if you want to open a String, Math, etc., class. Suppose you want to see the methods available in the List interface or ArrayList class use Ctrl + Shift + T and enter the class name to view the available methods, etc.
Quickfix: Ctrl + 1
Shows a quick fix depending upon the cursor's current position. Some quick fixes are like you can rename method or variable across a whole file. If a variable is used ten times in a file, using this shortcut you can rename those ten occurrences.
Switch Views: Ctrl + F7
Switch to Editor Views. Shows the option to switch between the available editor views.
Build All: Ctrl + B
Build All projects in the workspace.
Show Methods: Ctrl + O
Shows all the methods in a class. Press Ctrl + O again to show the inherited methods. To hide inherited methods press Ctrl + O again.
Matching Bracket: Ctrl + Shift + P
Cursor shifts to Matching Bracket.
Javadoc: Shift + F2
Opens a browser window to show Javadoc for the selected class, type, or method. Just pressing F2 shows Javadoc dialog within the editor.
Search: Ctrl + H
Opens a Search Dialog. The File Search tab is used to search project related files like java class. Add file name patterns (*.java, *.properties) separated by comma to search files ends with particular extensions.
Surround with Quick Menu: Alt + Shift + Z
Show quick menu to surround with try catch statements, conditional statements, loops
Source Menu: Alt + Shift + S
Show Source Menu with options like Toggle comment, generate getters/setters for POJO classes, etc.
Previous Opened Editor: Alt + ←
Alt + Left arrow shortcut is used to Go back to the previous selection or previous editor window.
Next editor: Alt + →
Alt + Right Arrow shortcut is used to Go back to the next selection or the next editor window.
Refactor: Alt + Shift + T
Select any number of lines or a block of code to refactor. For e.g., extract a method.
As a developer, you should know the above shortcuts as well as the debugging skills.