1.1. Using shortcuts in Eclipse
Using shortcuts make a developer more productive. Eclipse provides keyboard shortcuts for the most common actions. Using shortcuts is usually preferable as you can perform actions much faster.
Eclipse supports of course the typical shortcuts, e.g. Ctrl+S for saving, Ctrl+C for copying the selected text or file and Ctrl+V for pasting the element currently in the clipboard.
1.2. Shortcuts on Mac OS
This description uses the shortcuts based on Windows and Linux. Mac OS uses the Cmd key frequently instead of the Ctrl key.
2. Quick Access
The Ctrl+3 shortcut allows you to perform all available actions in Eclipse. This shortcut puts the focus into the Quick Access (quick access) search box which allows you to execute any Eclipse command. For example you can open a Preference, a Wizard, a view and a Preference page.
You can also use QuickAccess to search for an opened editor by typing in the name of the resource which the editor shows.
The following screenshot shows how you the available commands in quick access for the “New Java” search term.
3. Navigation and text selection
Table 1. Navigation Shortcut Description
Search dialog for resources, e.g., text files
Search dialog for Java Types
Shortcut for switching perspectives
Table 2. Navigation between editors Shortcut Description
Search dialog to select an editor from the currently open editors
Go to previous opened editor. Cursor is placed where it was before you opened the next editor
Similar Alt + ← but opens the next editor
Go to editor and the position in this editor where the last edit was done
Switch to previous opened editor
Switch to next opened editor
Table 3. Navigation between views Shortcut Description
Shortcut for switching views. Choose the view to switch to with your mouse or cycle through the entries with repeating the keystroke
Open menu for switch view keybindings
Show package explorer
4. Start Java programs
Table 4. Running programs Shortcut Description
Run last launched
Run last launched in debug mode
Skip all breakpoints. Let’s you use debug mode for code reloading
Run current selected class as Java application
Run JUnit test
Run JUnit Plug-in test
5. Editing in the Java editor
Table 5. Handling the editor Shortcut Description
Selects enclosing elements.,result depending on cursor position
Table 6. Handling the editor Shortcut Description
Quickfix; result depending on cursor position
Content assist/ code completion
Show the inheritance tree of the current Java class or method.
Show all methods of the current class, press Ctrl + O again to show the inherited methods.
Maximize active editor or view
Format source code
Correct indentation, e.g., format tabs/whitespaces in code
Opens the find dialog
Adds a link break at the end of the line
Organize the imports; adds missing import statements and removes unused ones
Wrap the select block of code into a block, e.g. try/catch.
Table 7. Cursor navigation and text selection Shortcut Description
Ctrl+← or Ctrl+→
Move one text element in the editor to the left or right
Ctrl+↑ or Ctrl+↓
Scroll up / down a line in the editor
Go to the matching bracket
Select text from the starting position of the cursor
Alt+Shift ↑ / ↓
Select the previous / next syntactical element
Alt+Shift ↑ / ↓ / ← / →
Extending / reducing the selection of the previous / next syntactical element
Table 8. Copy and move lines Shortcut Description
Copy current line below the line in which the cursor is placed
Copy current line above the line in which the cursor is placed
Move line one line up
Move line one line down
Table 9. Delete Shortcut Description
Delete until end of line
Delete next element
Delete previous element
Table 10. Create new lines Shortcut Description
Adds a blank line below the current line and moves the cursor to the new line. The difference between a regular enter is that the currently line is unchanged, independently of the position of the cursor.
Same as Shift + Enter but above
Table 11. Variable assignment Shortcut Description
Assign statement to new local variable
Assign statement to new field
Table 12. Coding Shortcut Description
Show the Javadoc for the selected type / class / method
Shortcut for the menu to create new objects
Surround block with try and catch
Table 13. Refactoring Shortcut Description
Rename locally (in file), faster than Alt + Shift + R
Opens the context-sensitive refactoring menu, e.g., displays
The following shortcuts are the absolute minimum a developer should be familiar with to work efficient in Eclipse.
Table 14. Must known shortcuts Shortcut Description
Saves current editor
Quickfix; shows potential fixes for warnings, errors or shows possible actions
Content assist/ code completion
Goes to the last edited position
Deletes current line in the editor
Adjusts the imports statements in the current Java source file
Ctrl+2+L or F
Assign statement to new local variable or field
Open Type Dialog
Shows quick outline of a class
Run last launched application
Opens context menu. Keyboard equivalent to Mouse2
Opens view menu for current view.