• Home
  • RSS
  • Contacts


IT consulting

we can help you create or build-up your project  though independent consulting and analysis, give you the opportunity to estimate your risks, design and implement your solution

more

Development

we implement bold ideas - developing fine web-solutions and complex databases; unordinary approach to realization of unique systems based on Java/Python, databases on PostgreSQL/MySQL using Linux/Unix platforms

more

hide

Products

GWT-PF product

GWT-PF - framework for developing rich user web-interfaces for database solutions

Pleso netNews product

Pleso netNews - solution for online media

Projects

Eclipse hotkeys

Posted by Nazar Leush - 24.03.2008, 22:52
Tags:        eclipse, java, tutorial

Using hotkeys in Eclipse significant improves developers' performance. This article is a short tutorial about main Eclipse functions and their hotkeys. This can help beginners to become experienced Eclipse user faster. This list of functions and hotkeys is made according to their usefulness in author's experience.

 

 

 

Show Key Assist

Control-Shift-L

Show Key Assist

Shows list of all configured in Eclipse hotkeys. If some dialog window is active - shows only enabled in it keys.

Keys Preferences Window

twice Control-Shift-L

Keys Preferences Window

If "show key assist" hotkey pressed twice - keys preferences window will be opened. Use this window to customize keys as you want. This article describes default keys for Eclipse v3.3 and v.3.2.

 

Views management

Maximize/Restore View

Ctrl-M

Maximize/Restore View

Each Eclipse view can be maximized. Frequently developer requires more screen area for code editor. In this case it is useful to maximize view pressing Ctrl-M. The same combination is used for restoring previous view size.

Switching Views

Ctrl-F7

Switching Views

Eclipse has special window for switching between between views (code editor, navigator, console etc). This window is showed when combination is pressed down once. After key releasing Eclipse hides window and switches to previous view. If key is pressed twice Eclipse will switch last but one view and so on. While switching window is opened you can use up and down arrow keys for navigating between opened views. Use enter of left mouse click to select view.

Switching Editors

Ctrl-F6

Switching Editors

Switching between editors works the same as switching between views. It works in editor view and switches opened in it files. This function is similar to Ctrl-Tab in many other multiwindow applications. If you wish you can set classical combination for this function in keys preferences window.

Quick Switch Editor

Ctrl+E

Quick Switch Editor

This function is alternative for editors switch. The difference is this one shows list with filter input.

Last Edit Location

Ctrl-Q

This navigation feature is useful after surfing source code when you want to return back to edit position.

Perspective Switch

Ctrl-F8

Perspective Switch

Besides views and editors Eclipse has perspectives. Perspective is customized views layout. Different perspectives used for different programming languages, debugging mode, synchronizing with repository mode and so on.

Show View

Alt-Shift-Q, Q

Show View

This view shows all available in environment views with filter input. If you closed needed view or want to open some new one - this feature could help you do this quickly.

 

Code navigation

Find/Replace

Ctrl-F

Find/Replace

Search and replace in open in editor file including use of regular expressions.

Find Next/Previous (when search dialog window is closed)

Ctrl-K

Ctrl-Shift-K

You can continue you last search in file using this keys when search window is closed.

Annotations Navigation

Ctrl-,

Ctrl-.

Annotations Navigation

Annotations - are some markings in the code (e.g. compilation errors). Using this keys you can navigate between annotations in the code. Toolbar menu allows you to select which annotations you want to navigate.

 

History Navigation

Alt-left arrow

Alt-right arrow

Eclipse stores opened files navigation history. This allows to navigate throught recently viewed or edited in editor files.

Open Declaration

F3

Opens source file and places cursor at the declaration of selected in the source code entity. This function is useful for code analyze when you need to know source of called function or source of instantiated class.

Call Hierarchy

Ctrl+Alt+H

Call Hierarchy

Opens view with selected in the code method's call hierarchy. This function allows to see places where selected method is called.

Hierarchy

F4

Hierarchy

Hierarchy - Lock View and Show Members in Hierarchy

Shows view with type hierarchy. Can be used for searching selected method overrides in "Lock View and Show Members in Hierarchy" mode.

CTRL-T

Type Hierarchy

Another view of type hierarchy with quick search field.

Open Type

Ctrl-Shift-T

Open Type

Shows view with quick search input for searhcing type by name in opened workspace. If you know desired type name this feature will be the fastest way to find it.

Open Resource

Ctrl-Shift-R

Shows similar to previous view for searching resources (e.g. xml, html, css files) in workspace.

 Find all references in workspace

Ctrl-Shift-G

Find all references in workspace

Shows all packages, classes and members where selected member is referenced.

Search

Ctrl-H

Search

Opens search window. It allows to search different type of data in workspace. Depending on installed plug-ins there can be simple text search, Java search, tasks search and so on. Search options are available - file mask, regular expression etc.

 

 

Code management

Quick Fix

Ctrl-1

Quick Fix

Place cursor on error marker (red underscore) and press Ctrl-1 to show context menu with fix choices.

Organize imports

Ctrl-Shift-O

This feature automatically organized imports in currently opened source file. It is also available in quick fix menu but this is faster way to execute.

Source menu

Alt-Shift-S

Source menu

This shortcut opens context menu for automatic code modifications.

Rename

Alt-Shift-R (in editor)

F2 (for classes in Package Explorer)

Rename in code

Rename - dialog window

Rename - preview

One of useful Eclipse refactor features is rename. It can be executed directly in the code for member under cursor or in Package Explorer for selected class. Preview window is available.

Format Source

Ctrl-Shift-F

Format Source - before

Format Source - after

Eclipse has code formatter which can help you format your source code according to specified rules. Formatter settings is can be found in: Window - Pereferences... - Java - Code Style - Formatter - Edit...

Comment/Uncomment

Ctrl-/

Коментувати/Розкоментувати

Automatic commenting allows you quickly comment or uncomment selected rows of code.

Code indent

Tab

Shift-Tab

This allows to indent to left or to right selected rows of code.

Copy row

Ctrl-Alt-up/down arrow

Copy row

Copies selected rows and pastes them below or before depending on which key is pressed (up or down).

Move row up/down

Alt-up/down arrow

Moves selected rows down or up depending on which key is pressed (up or down).

 

Outline

Quick outline

Ctrl-O

Quick outline

Shows quick class outline with member quick search input. This is the fastest way to navigate in big class structure. Eclipse also has Outline View which receives focus on Alt-Shift-Q, O shortcut. This view is more functional but it has no quick search and takes a lot of place on desktop (views are not hidden automatically) so it is less useful when talking about ergonomic.

Folding

Folding

Eclipse supports code structure folding. Particularly editor make folding for methods bodies, comments, imports section. Below folding functions is listed.

Expand in cursor position

Ctrl-+

Collapse in cursor position

Ctrl--

Expand All

Ctrl-*

Collapse All

Ctrl-Shift-/

 

References

This article was written due to small amount of related information in the Internet. Following resources was used:

 


Read also:

Development on GWT with Eclipse in team