Common Eclipse shortcut key summary

Source: Internet
Author: User
1. Ctrl+shift+r: Open Resources

This may be the most time-saving of all shortcut key combinations. This set of shortcuts allows you to open any file in your workspace, and you only need to press the filename or the first few letters in the mask name, such as Applic*.xml. The drawback is that this set of shortcuts is not available in all views.

2. Ctrl+o: Fast Outline

If you want to see the current class method or a specific method, but do not want to pull the code down, do not want to use the lookup function, then use Ctrl+o bar. It can list all the methods and attributes in the current class, you can just type the name of the method you want to query, and click Enter to jump directly to where you want to go.

3. Ctrl+e: Quick Transform editor

This set of shortcuts will help you navigate between open editors. Use ctrl+page down or ctrl+page up to browse the tabs before and after, but ctrl+e will be more efficient when many files are open.

4. ctrl+2,l: Assigning values to local variables

During the development process, I often write the method first, such as Calendar.getinstance (), and then assign the method's calculated result to a local variable through the Ctrl+2 shortcut key. This saves me the time to enter the class name, the variable name, and the import declaration. The effect of ctrl+f is similar, but the effect is to assign a method's calculated result to a field in the class. 5. Alt+shift+r: renaming

Renaming properties and methods a few years ago was a hassle, and it took a lot of searching and replacements to get the code to be fragmented. Today's Java IDE provides source-code processing, as does eclipse. Now that the renaming of variables and methods becomes very simple, you'll get used to renaming each time a better alternate name appears. To use this feature, move the mouse to the property name or method name, press Alt+shift+r, enter a new name, and click Return. To complete this. If you rename a property in a class, you can click Alt+shift+r two times, which will call out the Source Processing dialog box to implement the automatic renaming of Get and set methods. 6. Alt+shift+l and Alt+shift+m: Extracting local variables and methods

Source processing also includes the ability to extract variables and methods from large 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. Method extraction is also a very convenient function. Breaking large methods into smaller, fully defined methods can greatly reduce complexity and improve the testability of your code. 7. Shift+enter and Ctrl+shift+enter

Shift+enter creates a blank row 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. 8. ALT + Direction 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 handy. 9. Ctrl+m

It is known that large display screens can improve productivity. Ctrl+m is the shortcut key that maximizes the editor window. Ctrl +. and Ctrl+1: Next error and quick change

CTRL +. Moves the cursor to the next report fault or warning in the current file. This set of shortcuts I use in general with ctrl+1, that is, to modify the suggested shortcut keys. The new version of Eclipse's recommendations are very good, and can help you solve a lot of problems, such as missing parameters in the method, Throw/catch exception, methods not implemented, and so on.

More shortcut key combinations can be viewed in eclipse by pressing Ctrl+shift+l.

Let's use the frequency to see some of my favorite hotkey combinations. (Note: The following content is tested in Eclipse3.02 and one version)

1. Control-shift-t: Opening type (open). If you don't mean to be on your own, forget the way to open the source tree. With Eclipse it's easy to open the implementation class for an interface, press CTRL+T to list the implementation classes for the interface

2. Control-shift-r: Open resources (not just to find Java files). Tip: Use the yellow double-headed arrow button in the Navigator view to associate your edit window with the navigator. This will allow you to open the file corresponding to display in the navigator hierarchy, so as to facilitate the organization of information. If this affects the speed, turn it off.

3. F3: Open declaration. Alternatively, use declaration Tab (in Java view mode, select Windows–> Show view-> declaration). When you select a method in the code and press the key, it displays the entire method in the Declaration box.

4. Alt-left arrow: Back in navigation history (navigation History). Like the back button of a Web browser, it is especially useful after you have used F3 jumps. (Used to return to the place originally compiled)

5. Alt-right Arrow: Navigate the history forward.

6. Control-q: Back to the last editing place. This shortcut is also used when you jump in the code. Especially if you drill too deep and forget what you were doing at first.

7. Control-shift-g: Search for references (reference) in workspace. This is the premise of refactoring. For methods, this hotkey works just the opposite of F3. It allows you to find all callers of a method in the stack of methods. One feature associated with this is to turn on the "tag" feature (Occurrence marking). Select windows->preferences->java-> editor-> Mark occurrences and check the options. At this point, when you click on an element, all of the elements in the code that exist will be highlighted. I use only "Mark local variables" (Mark locals Variables) personally. Note: Too much highlighting slows down eclipse.

8. Control-shift-f: Codeàjavaàpreferencesà reformat code according to code style. Our team has a unified code format and we put it on our wiki. To do this, we open Eclipse, select window style, and then set Code formatter,code Style and organize Imports. Use the export function to generate a configuration file. We put these profiles on the wiki, and everyone in the team is importing into their eclipse.

9. Control-o: Rapid Overview (Quick outline). With this shortcut, you can quickly jump to a method or attribute, just enter the first few letters of the name.

control-/: Comment on one line or uncomment. The same applies for multiple lines.

Control-alt-down Arrow: Copy one or more highlighted lines.

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

The other hotkeys are available in the menu. You can see a list of all the shortcuts by pressing CONTROL-SHIFT-L (starting with version 3.1). Press Control-shift-l two times to display the Hotkey dialog box (Keys Preferences dialog), where you can set the hotkey yourself. I welcome you to post your eclipse tip in the talkback section. Other Eclipse Tips

I've summed up a couple of related tips:

Lock Command Line window: in command line view (Window->show view->other->basic->console), try using the SCROLL LOCK button to lock the console output and do not roll the screen.

Using Ant view: In my Java or debug mode, I like to display an ant view so that I can run the ant task quickly. The view can be found by window ant. Place the ant view in a corner of the screen and add the Build.xml file by adding the compile file (addàotheràshow viewàbuildfiles) button. In version 3.1, the Ant Debug script language is even supported.

Automatic traversal of a set: For + control-space: If you don't know yet, then you should remember that Control-space is the AutoComplete feature. In Eclipse, you can also automatically complete the structure. In an array or set range, try typing "for" and pressing the Control-space key. Eclipse will ask you which set you want to traverse and automatically complete the loop code.

Using a hierarchical layout: The default layout (flat) in Package browsing view (Package Explorer views) puzzles me by displaying the full name of the package in the Navigation tree (navigation). I prefer the package and file system view of my source code, called the Hierarchical layout (hierarchical Layout) in eclipse. To switch to this mode, click the Down button in the Package browsing view, select the layout (Layout), and then select the Rating (hierarchial).

Show multiple files at once: You can browse multiple files at once. You can open an edit window that is not active by dragging it to the bottom of the active window or to the side of the scroll bar. This is the best way I can describe the trick.

Open two eclipse at the same time: to merge changes from one CVS branch to another, I like to do this by opening two working directories (Workspace) with different eclipse. So I can see all the changes by comparing the latest version on CVS (right click on the project, then select Compare lastest from head) and merge each change into another CVS branch. The easiest way to start multiple eclipse is to use Eclipseàwith Launcher.

Implementors plugin: Installs a plug-in that can jump to an implementation of an interface. If you're a dependency injection fan, or you're working on a good interface, you'll need a plugin to speed up code navigation. You can find this plugin in SourceForge. ctrl+alt+h

If you want to know how a class's methods are called by those other classes, then select the method name and press "Ctrl+alt+h".

Eclipse will show you which methods are called by this method, resulting in a call tree.

1. Ctrl + Left

This is commonly used by most people to see the definition of variables, methods, classes

2. Ctrl+o

Review the outline of a class, listing its methods and member variables. Tip: Once more ctrl+o, you can list the methods and variables that the class inherits.

mnemonics: "O"-> "Outline"-> "outline"

3. Ctrl+t

View the inheritance tree of a class, which is the top down, and one more time ctrl+t, and it will be replaced by the bottom-up display structure.

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

mnemonics: "T" ——-> "tree"-–> "Hierarchy Trees"

4.alt+ left and right direction key

We often encounter Ctrl + left when we look at the code, layers of tracking, and then lost in the code, then simply press the "ALT + LEFT ARROW" can be returned to the last reading position, similarly, press "ALT + RIGHT ARROW" will advance to the reading position just returned, just like the browser forward and Back button.

Import Package: Ctrl+shift+o

Edit

scope function Shortcut keys

Global Find and replace Ctrl+f

Text Editor Find previous Ctrl+shift+k

Text Editor Find Next Ctrl+k

Global Undo Ctrl+z

Global Replication Ctrl + C

Global Restore Previous selection alt+shift+↓

Global clipping Ctrl+x

Global Quick Fix ctrl1+1

Global Content Assist alt+/

All globally selected CTRL + A

Remove delete globally

Global Context information ALT +.

Alt+shift+?

Ctrl+shift+space

The Java Editor displays a tooltip description F2

Java Editor Select encapsulation element alt+shift+↑

The Java editor selects the previous element alt+shift+←

The Java editor selects the next element alt+shift+→

Text Editor Incremental Lookup ctrl+j

Text Editor incremental reverse lookup ctrl+shift+j

Global Paste Ctrl + V

Global Redo Ctrl+y

View

scope function Shortcut keys

Global Amplification ctrl+=

Global Shrink ctrl+-

Window

scope function Shortcut keys

Global activation Editor F12

Global Toggle Editor Ctrl+shift+w

Global previous editor Ctrl+shift+f6

Global previous View Ctrl+shift+f7

Global previous Pivot Chart Ctrl+shift+f8

Global Next editor Ctrl+f6

Global Next View Ctrl+f7

Global Next Pivot Chart Ctrl+f8

The text editor displays the ruler context menu Ctrl+w

Global Display View menu CTRL+F10

Global Display System Menu alt+-

Navigation

scope function Shortcut keys

Java Editor Open Structure ctrl+f3

Global Open Type Ctrl+shift+t

Global Open type Hierarchy F4

Global Open Declaration F3

Global Open External Javadoc shift+f2

Global Open Resource Ctrl+shift+r

Global fallback history alt+←

Global forward History alt+→

The global last one CTRL +,

Global Next Ctrl +.

Java Editor Display outline Ctrl+o

Global open type in hierarchy Ctrl+shift+h

Global go to matching bracket ctrl+shift+p

Go global to previous edit location Ctrl+q

Java editor go to previous member ctrl+shift+↑

Java editor go to next member ctrl+shift+↓

Text editor go to row ctrl+l

Search

scope function Shortcut keys

Global appears in file Ctrl+shift+u

Global Open Search dialog box ctrl+h

Declarations in the global workspace Ctrl+g

References in the global workspace Ctrl+shift+g

Text editing

scope function Shortcut keys

Text Editor overwrite toggle Insert

Roll line ctrl+↑ on text editor

Text editor roll down line ctrl+↓

File

scope function Shortcut keys

Global Save Ctrl+x Ctrl+s

Global Print Ctrl+p

Global Shutdown CTRL+F4

Global all Save Ctrl+shift+s

Global all Close Ctrl+shift+f4

Global Properties Alt+enter

Global New CTRL + N

Project

scope function 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.