Eclipse Shortcuts

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3
At a glance
Powered by AI
The document discusses various keyboard shortcuts in Eclipse for tasks like navigation, code editing, refactoring etc.

Some commonly used Eclipse shortcuts for navigation include Ctrl + T for finding classes, Ctrl + R for finding resources, Ctrl + O for quick outline, Alt + right and Alt + left for going back and forth while editing.

Eclipse shortcuts for code editing include Ctrl + 1 for quick fix, Ctrl + Shift + o for organizing imports, Ctrl + o for quick outline, Selecting class and pressing F4 to see its Type hierarchy etc.

Essential Shortcuts

Ctrl+Shift+T

Find Java Type

Ctrl+Shift+R

Find Resource

Ctrl+E

Open Editor DropDown


Quick Outline

Ctrl+O

Ctrl+Space
Content Assist
Ctrl+Shift+SpaceContext Information
Ctrl+Shift+O

Organize Imports

F3

Open Declaration

Alt+Left
Alt+Right
Ctrl+L
F4

Backward History
Forward History
Go to Line
Open Type Hierarchy

Ctrl+Alt+H

Open Call Hierarchy

Ctrl+H

Open Search Dialog

Alt+Shift+R

Rename Refactoring
Extract Local
Variable
Extract Method

Alt+Shift+L
Alt+Shift+M

Start typing the name and the list gets smaller. Try typing the capital
letters of the class only (e.g. type "CME" to find
"ConcurrentModificationException")
Use this to look for XML files, text files, or files of any other type.
which are in your workspace.
Presents a popup window listing currently opened files. Start typing to
limit the list or simply use the down arrow key.
Use this to find a method or a member variable in a class. Start typing
to limit the choices. Press Ctrl+O a second time to include inherited
methods.
Context sensitive content completion suggestions while editing Java code.
If typing a method call with several parameters use this to show the
applicable parameter types. The current parameter where the cursor is
will be shown in bold.
After typing a class name use this shortcut to insert an import
statement. This works if multiple class names haven't been imported too.
Drills down to the declaration of the type, method, or variable the
cursor is on. This works much like a browser hyperlink.
This works like a browser's Back button.
This works like a browser's Forward button
Go to a specific line number.
Show the type hierarchy (downward tree) or the supertype hierarchy
(upward tree).
Show where a method is called from. In the Call Hierarchy view keep
expanding the tree to continue tracing the call chain.
Opens a search dialog with extensive search options for Java packages,
types, methods, and fields.
Use this to rename type, method, or field. All existing references will
be refactored as well.
Use this to create a local variable from the selected expression. This is
useful for breaking up larger expressions to avoid long lines.
Use this to extract a new method from existing code. The parameter list
and return type will be automatically created.

Additional Favorites
Alt+Shift+Up
Alt+Shift+Down
Alt+Shift+Left
Alt+Shift+Right
Ctrl+Up
Ctrl+Down
Ctrl+Shift+Up
Ctrl+Shift+Down
Ctrl+Shift+U
Alt+Shift+U
Ctrl+Shift+P
Ctrl+J
Ctrl+Shift+J
Shift+Enter
Ctrl+Shift+Enter
Ctrl+/
Ctrl+\
Ctrl+M

Select Enclosing Element


Restore Last Selection
Select Previous Element
Select Next Element
Scroll Line Up
Scroll Line Down
Go to Previous Member
Go to Next Member
Show Occurrences in File
Remove Occurrences
Annotations
Go to Matching Bracket

Ctrl+F6
Ctrl+F7
Ctrl+F8
Ctrl+Alt+Up
Ctrl+Alt+Down

Incremental Find
Reverse Incremental Find
Insert Line Below
Insert Line Above
Add Block Comment
Remove Block Comment
Maximize Active View or
Editor
Next Editor
Next View
Next Perspective
Duplicate Lines
Copy Lines

Alt+/

Word Completion

Useful for selecting context-sensitive blocks (e.g. surrounding


loop, method, class, etc.)
Very handy if you want to scroll by 1 line without changing your
cursor position or using the mouse.
Great for stepping down through the methods of a Java source
file.
Use this to search within the same file - useful for occurrences
of private fields and methods.
Helps to find the closing bracket of lengthly if-else
statements.
The first matching occurrence is shown with each typed letter.
Press again and the next matching occurrence is shown.
Insert a line above or below the current line.
Comment in/out blocks of code with a key stroke.
Maximize the current view or editor at the expense of all other
currently shown views. Press again to restore to normal view.
Learn these to switch among edited files, open views and
perspectives.
Doesn't seem like it at first but a great shortcut once you
learn to use it. Instead of select, copy and paste simply select
and duplicate without affecting the clipboard.
This is excellent for code editing or writing plain help files
with variables and other words having no English language

Ctrl+I

Correct Indentation

equivalents. The word completion is based on the set of words


already present in the current file.
Select a block of Java code or an entire class file and use this
shortcut to correct its indentation.

Eclipse Keyboard Shortcuts


1) Ctrl + T for finding class even from jar
This keyboard shortcut in Eclipse is my most used and favorite shortcut. While working with high speed trading system
which has complex code I often need to find classes with just blink of eye and this eclipse keyboard shortcut is just
made for that. No matter whether you have class in your application or inside any JAR, this shortcut will find it.
2) Ctrl + R for finding any resource (file) including config xml files
This is similar to above Eclipse shortcut with only difference that it can find out not only Java files but any files
including xml, configs and many others, but this eclipse shortcut only finds files from your workspace and doesnt dig at
jar level.
3) Ctrl + 1 for quick fix
This is another beautiful Eclipse shortcut which can fix up any error for you in Eclipse. Whether its missing
declaration, missing semi colon or any import related error this eclipse shortcut will help you to quickly short that
out.
4) Ctrl + Shift + o for organize imports
Another Eclipse keyboard shortcut for fixing missing imports. Particularly helpful if you copy some code from other file
and what to import all dependencies.
7) Ctrl + o for quick outline going quickly to method
9) Alt + right and Alt + left for going back and forth while editing.
12) Alt + Shift + W for show in package explorer
13) Ctrl + Shift + Up and down for navigating from member to member (variables and methods)
15) Ctrl + k and Ctrl + Shift +K for find next/previous
24) Go to a type declaration: F3, This Eclipse shortcut is very useful to see function definition very quickly.
5) Ctrl + / for commenting, un commenting lines and blocks
6) Ctrl + Shift + / for commenting, un commenting lines with block comment
8) Selecting class and pressing F4 to see its Type hierarchy
10) Ctrl + F4 or Ctrl + w for closing current file
11) Ctrl+Shirt+W for closing all files.
14) Ctrl + l go to line
16) Select text and press Ctrl + Shift + F for formatting.
17) Ctrl + F for find, find/replace
18) Ctrl + D to delete a line
19) Ctrl + Q for going to last edited place
20) Ctrl + T for toggling between super type and subtype
21) Go to other open editors: Ctrl + E.
22) Move to one problem (i.e.: error, warning) to the next (or previous) in a file: Ctrl +. For next, and Ctrl +, for
previous problem
23) Hop back and forth through the files you have visited: Alt + and Alt + , respectively.
25) CTRL+Shift+G, which searches the workspace for references to the selected method or variable
26) Ctrl+Shift+L to view listing for all Eclipse keyboard shortcuts.

27) Alt + Shift + j to add javadoc at any place in java source file.
28) CTRL+SHIFT+P to find closing brace. Place the cursor at opening brace and use this.
29) Alt+Shift+X, Q to run Ant build file using keyboard shortcuts in Eclipse.
30) Ctrl + Shift +F for Autoformating.

You might also like