Eclipse shortcut keys

Source: Internet
Author: User
Tags ord

From: Eclipse common shortcut Keys and code templates

Eclipse Common shortcut key Rollup

Eclipse's editing capabilities are powerful, and mastering the Eclipse shortcut key capabilities can greatly improve development efficiency. There are several shortcut keys related to editing in Eclipse.
1. "Alt+/"
This shortcut is a good helper for the user to edit, can provide users with the content of the auxiliary, do not worry about the method and the name of the property, when not the whole class, methods and attributes of the name, more experience the "alt+/" shortcut to bring the benefits of it.

2. "Ctrl+o"
shows an outline of the methods and properties in a class that quickly locates the methods and properties of a class and is useful for finding bugs.

3. "Ctrl+/"
Quickly add comments, can quickly add a comment or uncomment the line of the cursor or the selected line, you may always need to annotate something or uncomment it when debugging, and now it's okay to repeat the comments on each line.

4. "Ctrl+d"
Delete the current row without deleting the key as many times as you would delete a row.

5. "Ctrl+m"
Window maximization and restore, when the user in the window to operate, always feel that the current window is small (especially when writing code), now good, try "ctrl+m" shortcut keys.

Viewing and locating shortcut keys

In the program, quickly locate the location of the code, quickly find where the bug is a very difficult thing, Eclipse provides a powerful search function, you can use the following shortcut keys to help complete the job of locating.
1. "Ctrl+k", "Ctrl++shift+k"
quickly look down and up the selection, and you no longer need to click the Find dialog box with your mouse.

2. The Java class file can be found in the "ctrl+shift+t"
Find Workspace (Workspace) build path, not to find the class, and you can use "*", "? "And so on wildcard characters.

3. "Ctrl+shift+r" and "ctrl+shift+t" correspond to

Find all the files (including Java files) in the workspace (Workspace), or use wildcard characters.

4. "Ctrl+shift+g"
Find references to classes, methods, and properties. This is a very useful shortcut key, such as to modify the code that refers to a method, you can quickly locate all references to this method by using the "ctrl+shift+g" shortcut key.

5. "Ctrl+shift+o"
Quickly generate import, when copying a program from the Internet, do not know how to import into the called class, try "ctrl+shift+o" shortcut keys, there will be surprises.

6. "Ctrl+shift+f"
Format code, write the code of the format specification is a compulsory lesson for every programmer, when see a piece of code is very uncomfortable, select and press "ctrl+shift+f" shortcut key can format this code, if the code is not selected the default format of the current file (Java file).

7. "Alt+shift+w"
Find the path in the project where the current file is located, and you can quickly locate the location of the browser view, which is useful if you want to find a package that contains a file (especially in larger projects).

8. "Ctrl+l"
Navigates to a row in the current editor and is also valid for non-Java files.

9. "Alt+←", "alt+→"
Backward history and forward history are useful in tracking code, and users may find several associated places, but they may not be able to remember the order in which they are located by these two shortcut keys.

10. "F3"
Quickly locates the original definition of a class, method, and property at the cursor position.

11. "F4"
Displays the inheritance relationship for the class and opens the Class inheritance view.

12. "Ctrl + ALT + H"
Find a reference location for a method

debugging shortcut keys

There are several shortcut keys in eclipse that are related to running debugging.
1. "Ctrl+shift+b": Sets a breakpoint at the current line or cancels the set breakpoint.

2. "F11": Debug the Last executed program.

3. "Ctrl+f11": Run the last executed program.

4. "F5": Trace into the method, when the program executes to a method, you can press the "F5" key to trace to the method.

5. "F6": Step Into the program.

6. "F7": Executes the method, returning to the next statement that called this method.

7. "F8": Continue execution to the next breakpoint or end of the program.

Common editor shortcut keys

Usually the text editor provides some shortcut keys related to editing, which you can also use to edit text in eclipse.
1. "Ctrl + C": Copy.

2. "Ctrl+x": Cut.

3. "Ctrl + V": Paste.

4. "Ctrl+s": Save the file.

5. "Ctrl + Z": Undo.

6. "Ctrl+y": Repeat.

7. "Ctrl+f": Find.

Other shortcut keys

There are many shortcuts in eclipse that cannot be enumerated, and users can find out how to use them through the Help document, as well as several common shortcut keys.

1. "Ctrl+f6": Switch to the next editor.

2. "Ctrl+shift+f6": Switch to the previous editor.

3. "CTRL+F7": Switch to the next view.

4. "CTRL+SHIFT+F7": Switch to the previous view.

5. "Ctrl+f8": Switch to the next perspective.

6. "Ctrl+shift+f8": Switch to the previous perspective.

Code template features for Eclipse

In addition to using ALT + '/', Eclipse also provides many code templates by default. Open windows->preferences->java->editor->templates to see a list of all defined code templates.

Sometimes there are other kinds of problems in programming, such as I want to add some code to the Try/catch block for exception detection. With the help of the code template, you do not have to manually type this part of the code, and do not have to control the code indentation, you only need to select the code block to be processed, and then press Alt+shift+z, enter, Eclipse will automatically pack the Try/catch statement for the selected code block.

Although Eclipse has provided us with many useful templates by default, it is certainly not enough, so we need to try to create our own code templates.

As a practical example, we will often need to test the execution time of a piece of code in real-world development, in general we will use the following methods:

Record the time stamp before and after the code is executed, and then calculate the difference of two timestamps. This code is very solid, if you manually typed it every time, it is very frustrating, but if you use the "Code template" function to do, it is much more convenient.

Open Windows->preferences->java->editor->templates, click New ..., create a new code template, and enter the code as shown, creating a template named "Xinneng".

(Note: All "”are Yes modulo board change volume as "are template variables, such as {line_selection}, which represents the code fragment currently selected by the cursor, ${cursor} indicates where the cursor is at the end of the code generation, and there are many parameters that you can refer to from the Help documentation provided by Eclipse. )

When you're done, select the block of code you want to test, use the shortcut key alt+shift+z, you can see a xinneng in the menu, click Xinneng (), and Eclipse automatically adds the test code we just entered in the selected code block.

Through the simple introduction above, you should have a general understanding of the "Code template" function of Eclipse, if you want to do a more in-depth study of this function, you can consult the relevant help documents and materials.

Resources

1, http://www.cnblogs.com/mailingfeng/archive/2013/02/22/2922131.html

2, http://blog.csdn.net/weasleyqi/article/details/7896576

3, http://developer.51cto.com/art/201103/249292.htm

Eclipse shortcut keys

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.