Eclipse Cheat Sheet: Shortcuts
Eclipse Cheat Sheet: Shortcuts
Eclipse Cheat Sheet: Shortcuts
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
SHORTCUTS
These are some of the most useful shortcuts in eclipse. You can find others listed beside their function in eclipses menus.
Menu
Key Combination
Use
Source
Ctrl+Space
Ctrl+1
Ctrl+D
Ctrl+Alt+Up
Alt+Up
Alt+Shift+Z
Ctrl+I
Ctrl+Shift+F
Ctrl+/
Alt+Shift+M
Alt+Shift+R
Ctrl+Shift+G
Ctrl+H
Alt+Shift+X, J
Alt+Shift+X, D
Refactor
Search
Run
AUTO-COMPLETE
These are some of the most useful options given to you after using the Ctrl+Space auto-complete shortcut.
Text Written So Far
You can also create your own auto-complete statements. Go to Window->Preferences, then on the left pane go to
Java->Editor->Templates
For example the following template creates a println outputting the contents of a specific variable:
NAME:
debug
PATTERN: System.err.println("${word_selection}: " + ${word_selection}); ${cursor}
This can be used now in eclipse by selecting a variable and pressing Ctrl+Space, then typing debug and pressing enter.
1
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
VIEWS IN ECLIPSE
Eclipse displays various views on the left and bottom of the screen that you may find useful. You can add new views if they are
not already displayed by going to Window->Show View, or by clicking on the following icon at the bottom left of your
workspace:
TASK MANAGEMENT
The task pane (pictured below) is a useful way of keeping track of incomplete sections of code, or places where code needs
tidied up.
Comments will automatically be shown in the task pane if you start a comment with either XXX or TODO.
You can also create your own custom markers by clicking on the down arrow in the top right of the task pane and opening
Configure Contents. Duplicate the TODO task you can then use your own custom tag by changing the description section.
2
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
PROBLEMS
The problems tab displays compiler warnings and errors.
You can filter the contents of this tab so that it only displays local problems by clicking on the down arrow (in the top right) and
opening Configure Contents. Here you can change the scope of the problems shown for various types of errors and warnings.
You can also filter the projects and classes that are shown in the package explorer to allow you to focus on only relevant classes.
To do this click on the down arrow at the top of the package explorer and click on SELECT WORKING SET (shown above in
Figure 4). You can then create new working sets that filter on various conditions. For example, you can filter certain projects or
show on classes with specific debugging breakpoints. The menu with these options is illustrated below in Figure 5.
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
BREADCRUMBS
To enable the breadcrumb feature in eclipse, click on the
Breadcrumbs can be a quicker way of navigating between methods, classes, or packages in eclipse (as shown below).
Figure 6: Breadcrumbs
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
MENU OPTIONS
The next couple of pages summarise some of the most useful menu options that eclipse provides.
Correct indentation
and spacing for the
current selection.
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
Wrap a number of
method parameters into
a single class.
Add a selected
expression as a
parameter to a method
call.
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
http://blogs.cs.st-andrews.ac.uk/angus/2010/09/eclipse-cheat-sheet/
Run a program.
Debug a program.
Analyse execution
time, memory
utilization (requires
profiling plugin).
Breakpoints stop
execution of a program
at the line on which
they are added.
Stop execution of a
program when a
specified variable is
declared or accessed.