Eclipse shortcut keys

Source: Internet
Author: User

To view resources:

1. Ctrl+shift+r: Open Resource
This is probably the most time-saving combination of all shortcut keys. This set of shortcuts lets you open any file in your workspace, and you only need to press the first few letters of the file name or mask name, such as Applic*.xml. The drawback is that this set of shortcuts is not available in all views.

2. Ctrl+shift+t: Opens type (open type). If you don't intentionally skiving, forget to open it through the source tree. Using Eclipse to easily open an implementation class for an interface, press CTRL+T to list the implementation class of the interface

3.ctrl+shift+f: Reformat the code according to the Code style settings. Our team has a unified code format and we put it on our wiki. To do this, we open Eclipse, select the window Style, and then set the Code formatter,code style and organize Imports. Use the export feature to generate a configuration file. We put these profiles on the wiki, and everyone in the team is imported into their eclipse.

4.ctrl+o: Fast Outline
If you want to see the methods of the current class or a particular method, but do not want to pull the code down, and do not want to use the search function, then use Ctrl+o bar. It can list all the methods and properties in the current class, you just enter the method name you want to query, click Enter to jump to the location you want to go directly

5. Ctrl+e: Quick Convert Editor
This set of shortcut keys will help you navigate between the open editors. Use ctrl+page down or ctrl+page up to browse the tabs before and after, but ctrl+e is more efficient when many files are open.

6.ctrl+alt+h:

If you want to know how a class's methods are called by those other classes, select the method name, and then press "Ctrl+alt+h", and Eclipse will show which methods the method is called and eventually a call tree.

7.ctrl+t:

Look at the inheritance tree of a class, which is top-down, and then press once more ctrl+t, which is replaced by a bottom-up display structure.

Tip: Select a method name and press Ctrl+t to see the parent, subclass, and interface of the method with the same name.

Mnemonic: "T"-------> "tree"-----> "Hierarchy tree"

Shortcut in encoding process:

1. Ctrl+2,l: Assigning a value to a local variable
    during development, I often write methods such as Calendar.getinstance () and then CTRL + 2 shortcut keys assigns the computed result of a method to a local variable. This saves me the input class name, the variable name, and the time the declaration was imported. The ctrl+f effect is similar, but the effect is to assign the result of the method to a field in the class.
    2. Alt+shift+l and Alt+shift+m: Extracting local variables and methods
    source processing also includes the ability to extract variables and methods from chunks of code. For example, to create a constant from a string, select the text and press Alt+shift+l. If the same string appears elsewhere in the same class, it is automatically replaced. The method extraction is also a very convenient function. Breaking up large methods into smaller, well-defined methods can greatly reduce complexity and improve the testability of your code.
    3. Shift+enter and Ctrl+shift+enter
    Shift+enter creates a blank line below the current line, regardless of whether the cursor is at the end of the row. Ctrl+shift+enter inserts a blank line before the current line.
    4. ALT + arrow key
    This is also a magic weapon to save time. This combination moves the contents of the current line up or down. In the Try/catch section, this shortcut is especially useful.
    5. Ctrl+m
    Large display screen to improve productivity is known to all. Ctrl+m is the shortcut key for maximizing the editor window.
    6. CTRL +. And Ctrl+1: Next error and quick fix
    Ctrl +. Move the cursor to the next report fault or warning in the current file. This set of shortcut keys I generally use with ctrl+1, that is, modify the proposed shortcut keys. The new version of Eclipse suggestions are good to help you solve a lot of problems, such as missing parameters in the method, Throw/catch exception, non-executed methods and so on.

7. F3: Open the Declaration (opening declaration). Alternatively, use Declaration Tab (in Java view mode, choose Windows--Show View-> Declaration). When you select a method in the code and press the button, it will show the entire method in the Declaration box.

8. Alt+left: Back in navigation history (Navigation). Just like a Web browser's Back button, it is especially useful after jumping with F3. (Used to return to the original compiled place)

9. Alt+right: Forward in navigation history.

Ctrl+q: Go back to the last editing place. This shortcut is also used when you jump in the code. Especially when you're too deep, and forget what you were doing in the first place.

Ctrl+alt+down: Copies the highlighted row or rows.

Alt+down/up: Moves one or more lines down. Alt-up Arrow will move up.

13.alt+ left and RIGHT ARROW keys

We often encounter when looking at the code CTRL + left, layer tracking, and then lost in the code, then only need to press "ALT + LEFT ARROW key

"You can go back to where you last read, and by the same token, press ALT + RIGHT ARROW to go to the reading position you just returned, like the browser's

Forward and Back buttons are the same.

Import Package: Ctrl+shift+o

Comments:

ctrl+shift+/: Comment HTML code

Ctrl+shift+\: Uncomment HTML code

ctrl+/: Comment Java code

Refactoring Related:

Ctrl+shift+g: Search for references in Workspace (reference). This is the premise of refactoring. For the method, the function of this hotkey is exactly the opposite of F3. It enables you to find all the callers of a method in the stack of methods. One function associated with this is to turn on the "tagging" feature (occurrence marking). Select windows->preferences->java-> editor-> Mark occurrences and tick the option. At this point, when you click on an element, all of the elements in the code where the element exists will be highlighted. I personally only use "Mark local variables" (Mark locally Variables). Note: Too much highlighting slows eclipse.

Alt+shift+r rename (is my own favorite, especially the variables and classes of rename, than the manual method can save a lot of labor)

Alt+shift+m Extraction Method (This is one of the most common methods of refactoring, especially useful for a whole bunch of mud codes)

Alt+shift+c Modify the function structure (more practical, there are n functions called this method, modified once done)

Alt+shift+l extract Local variables (you can directly extract some magical numbers and strings into a variable, especially when multiple calls are made)

Alt+shift+f change the local variable in class to a field variable (more useful function)

Alt+shift+i Merge variables (this may be a bit inappropriate inline)

ALT+SHIFT+V moving functions and variables (not commonly used)

Alt+shift+z reconstruction of Regret medicine (Undo)

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.