Eclipse hotkeysPosted 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
Shows list of all configured in Eclipse hotkeys. If some dialog window is active - shows only enabled in it keys.
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.
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.
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 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
This function is alternative for editors switch. The difference is this one shows list with filter input.
Last Edit Location
This navigation feature is useful after surfing source code when you want to return back to edit position.
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.
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.
Search and replace in open in editor file including use of regular expressions.
Find Next/Previous (when search dialog window is closed)
You can continue you last search in file using this keys when search window is closed.
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.
Eclipse stores opened files navigation history. This allows to navigate throught recently viewed or edited in editor files.
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.
Opens view with selected in the code method's call hierarchy. This function allows to see places where selected method is called.
Shows view with type hierarchy. Can be used for searching selected method overrides in "Lock View and Show Members in Hierarchy" mode.
Another view of type hierarchy with quick search field.
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.
Shows similar to previous view for searching resources (e.g. xml, html, css files) in workspace.
Find all references in workspace
Shows all packages, classes and members where selected member is referenced.
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.
Place cursor on error marker (red underscore) and press Ctrl-1 to show context menu with fix choices.
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.
This shortcut opens context menu for automatic code modifications.
Alt-Shift-R (in editor)
F2 (for classes in Package Explorer)
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.
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...
Automatic commenting allows you quickly comment or uncomment selected rows of code.
This allows to indent to left or to right selected rows of code.
Copies selected rows and pastes them below or before depending on which key is pressed (up or down).
Move row up/down
Moves selected rows down or up depending on which key is pressed (up or down).
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.
Eclipse supports code structure folding. Particularly editor make folding for methods bodies, comments, imports section. Below folding functions is listed.
Expand in cursor position
Collapse in cursor position
This article was written due to small amount of related information in the Internet. Following resources was used:
Read also: Click here to add a new comment »