Saturday 31 December 2011

How to Shortcuts in Eclipse for Selenium automation


1. Shortcuts

Using shortcuts make a developer more productive. The following lists the most important shortcuts for Eclipse.

1.1. Master Shortcut

Eclipse provides keyboard shortcuts for the most common actions. Using shortcuts is usually preferable as you can perform actions much faster.
The master shortcut is CTRL+3. This shortcut opens the Quick Access dialog. In the quick access dialog, you can type the name of any command, preference, wizard, view, perspective, etc. You can also type only parts of the name and the dialog shows you possible matching elements.

CTRL+3 shortcut dialog

1.2. Navigation


Table 1.  Navigation
ShortcutDescription
CTRL + SHIFT + ROpen / Search for resources, e.g. files
CTRL + SHIFT + TOpen / Search for Types
CTRL + EAllows to select an editor from the currently open editors
CTRL + F8Shortcut for switching perspectives
ALT + ← or ALT + →Go to previous/ next editor position in history
Ctrl-PageUp/PageDownSwitch to previous/next editor
F3Go to the declaration of this variable
CTRL + SHIFT + PGo to the matching bracket


Table 2. Search
ShortcutDescription
Ctrl + .Go to the next problem / error
Ctrl + ,Go to the previous problem / error
F4 on a variableShow type hierarchy
CTRL + J , CTRL + KIncremental search, find next
CTRL + SHIFT + GSearch for references in the workspace

1.3. Run


Table 3. Running programs
ShortcutDescription
Ctrl + F11Run last launched
Alt + Shift + X - JRun current selected class as Java application

1.4. Editing


Table 4.  Handling the editor
ShortcutDescription
CTRL + 1Quickfix; result depending on cursor position
CTRL + SpaceContent assist/ code completion
CTRL + TShow the inheritance tree of the current Java class
CTRL + OShow all methods of the current class, press CTRL + O again to show the inherited methods.
F12Focuses on the editor (especially helpful if you work with Fast Views).
Ctrl + MMaximize Java editor
CTRL + Shift + FFormat source code
CTRL + Shift + OOrganize the imports; will import the missing import statements.
CTRL + QGo to position the cursor at the last changed position in the editor.


Table 5.  Arrow Keys
ShortcutDescription
CTRL + LeftMove one element to the left
CTRL + RightMove one element to the right
CTRL + ALT + Up/DownCopy line
ALT + Up / DownMove line up / down
ALT + SHIFT Up / DownSelect the previous / next syntactical element
ALT + SHIFT Up / Down / Left / RightExtending / Reducing the selection of the previous / next syntactical element
CTRL + Up / DownScroll up / down a line in the editor


Table 6. Delete
ShortcutDescription
Ctrl + DDeletes line
CTRL + SHIFT + DELDelete until end of line
CTRL + DELDelete next element
CTRL + BACKSPACEDelete previous element


Table 7. Variable assignment
ShortcutDescription
Ctrl + 2 + LAssign statement to new local variable
Ctrl + 2 + FAssign statement to new field

1.5. Coding


Table 8. Coding
ShortcutDescription
Shift + F2Show the Javadoc for the selected type / class / method
Alt+Shift + N + LetterType shortcut for the command, e.g. njc to create a new Java class or npip to create a new Plugin project
Alt + Shift + ZSurround block with try and catch

1.6. Refactoring

Table 9. Refactoring
ShortcutDescription
ALT + SHIFT + RRename
CTRL+2, RRename locally (in file), faster then ALT + SHIFT + R
ALT + SHIFT + TOpens the quick refactoring menu