Common eclipse Java shortcut keys (eclipse shortcut cut keys for Java Top10)

Source: Internet
Author: User
Tags dateformat

Common eclipse Java shortcut keys (eclipse shortcut cut keys for Java Top10)
0. Background
Eclipse, as the Java opensource development IDE, is already the first choice for developers to develop Java applications (not limited to). Although there are many other optional ides, however, other tools are either paid tools, such as intellij, IBM Rational Application Developer (eclipse + IBM plugins), and JBuilder; or they are not very powerful, for example, some small and medium-sized integrated development tools or building tools such as ant.
For a comparison of various Java IDE, see: http://www.apl.jhu.edu /~ Hall/Java/ides.html # Java-ides
The open-source nature of eclipse is one of the main reasons for its wide application. At the same time, the characteristics of plugable make any plug-in can be easily integrated into the IDE, so that the IDE functions become easy to scale, you can add any multiple plug-ins on the basic platform.
1. Description
A. in eclipse, you can use window-> preferences-> General-keys to customize the shortcut keys, which can be customized according to your personal preferences.
B. If other shortcut keys that conflict with eclipse are defined in the operating system, whether or not the eclipse shortcut keys are valid depends on the operating system.
(For example, in the operating system, CTRL + space is used as the shortcut key for the switchover of the simplified Chinese input method. In the eclipse Java Editor, this shortcut key is used for content assist .)
(If you use the Google Pinyin input method, the software uses Ctrl + Shift + S, CTRL + Shift + k, CTRL + Shift + T as the shortcut key by default, CTRL + Shift + T are commonly used shortcut keys in eclipse .)
C. the shortcut keys introduced in this article refer to the time when you use the mouse, such as the Code Formatting Function. If you use the mouse, right click-> source-> Format, because there are many options in the right-click menu, you need to first find the source, then there are many sub-Menus under the source menu, and then find the format, so that there is no convenient shortcut key.
However, if you want to format multiple classes in the entire package, you can open the Java class files one by one and then Ctrl + Shift + F. You can directly select the package, right click-> source-> Format. Therefore, whether the mouse or shortcut key is used depends on developers' personal preferences. This article only describes commonly used shortcut keys.
D. this article does not introduce the inherent shortcut keys of the editor, such as Ctrl + C, CTRL + X, CTRL + V, CTRL + f (find & replace), CTRL + N (new ), f5.
E. Some Complex shortcut keys. For example, if you want to press the four keys at the same time, my fingers are not flexible enough.
1. Introduction to Java Development shortcuts
I. Automatic formatting: Ctrl + shif + F
Although I still like to use spaces for formatting when writing code, this shortcut key is sometimes used for formatting, after all, handwriting is prone to errors.
Ii. Content help: Ctrl + Space
When you enter a class, remember only the first few characters of the class, for example, for Java. text. messageformat: Remember to start with message. after entering the message, use Ctrl + space to try. All available classes starting with message can be seen.
When you define a variable, but the name of the variable is relatively long (although long variable names are not recommended, it is still difficult to avoid it sometimes, because we need to see what it means ), in this way, each input is time-consuming and labor-consuming, for example, priceofpotato and priceoftomato. In this case, you only need to enter P and then use this shortcut key to display some available content, the appearance of the data sequence is that the local variables and member variables are in front, followed by classes and interfaces.
Iii. view the Declaration/Open Type hierarchy: F3/F4
Select the package, class, method, variable, and press the F3 shortcut key to jump to the definition of the package, class, method, and variable.
You can use the F4 shortcut key to view the hierarchy (inheritance, implementation) Relationships of classes and interfaces, which are displayed in a tree.
Iv. Quick modification: Ctrl + 1
What should I do if there is a red wavy line (error)? The first choice is to check the suggestions for eclipse. CTRL + 1 can display the suggestions for eclipse modification, and then select the correct modification method.
V. Open the resource (type): Ctrl + Shift + R/T
If there are hundreds of classes in a project, it is too difficult to locate a class by searching in the hierarchy tree. You can use Ctrl + Shift + R to find resources, resources include Java source code and various resource files.
To view the classes in the jar package, you need to use Ctrl + Shift + T to view the types.
Vi. debug shortcut: F5, F6, F7, F8 --- run/debug the last start: Ctrl + F11/F11
F5 is the method used for debugging. For example
Public void print (){
String today = dateformat. getdatetimeinstance (dateformat. Long, dateformat. Long). Format (new date ());
}
Press F5 during debugging to enter the format method.
The method returned from the format Method to the print method is to automatically return after the format method is executed, or press the F7 shortcut key to return.
The F6 shortcut is used for single-step execution.
The F8 shortcut is used to continue to the next breakpoint.
You can press Ctrl + F11 and F11 to perform the last run or the last debug.
VII. Reconstruction: Alt + Shift + R
Refactoring is an important function in eclipse. Classes, methods, and so on can be reconstructed, and the associated references can be reconstructed synchronously.
VIII. Organization import: Ctrl + Shift + O
In the Java editor, you can use this shortcut key to import missing classes and delete unnecessary imports.
IX. Add Comment: Ctrl +/
You can use this shortcut to easily comment on the current row or selected multiple rows. The comment type is single row comment.
X. Quick outline: Ctrl + O
Press Ctrl + O in the current class to display all methods of the current class (excluding inherited methods). If you press the shortcut key twice, you can view all methods of the current class and its parent class.
4. Other common shortcut keys
Although not only used in Java development, the following shortcut keys are also frequently used.
Delete line: Ctrl + d
Next (top) position: Ctrl + k/Ctrl + Shift + k
Locate a specific line: Ctrl + L
Move the selected row up (down): Alt + up/down arrow
Number of times the file appears: Ctrl + Shift +
Open the Search dialog box: Ctrl + H
Automatic completion of words: Alt +/
5. Summary
This article describes the common shortcut keys used for Java Development Using eclipse.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.