Eclipse Common shortcut keys

Source: Internet
Author: User

Java development, often with eclipse or myeclise integrated development environment, some practical eclipse shortcuts and usage skills, can save a lot of time in normal development to improve productivity, Here I will combine the use of my own development and share with you the shortcuts and tips commonly used in eclipse.

1, Alt +? or alt+/: Auto-complete code or prompt code


This is my most proud shortcut key combination, especially when the input syso a few characters, 2 fingers easily press the 2 keys, the automatic completion of the SYSTEM.OUT.PRINTLN (), and Eclipse default is "." The method hints, if the middle tip is broken and want to see again, you have to re-enter the corresponding class or variable in front of "." Before you can see the hint, but if the 2 key combination is the same can play the role of the hint, you can try, and if the input for after, if there is a need to traverse the local variables, will pop up to choose with for each traversal or for (int;; ) or while () and then automatically generate the code.

2. Ctrl+o: Quick outline view


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 lookup function, it is very useful to use ctrl+o, especially directly open or trace to a very many methods of the class, this is very helpful, directly see those methods and member variables, It can list all the methods and properties in the current class, you just enter the method name you want to query, and click Enter to jump directly to where you want to go.

 3. Ctrl+shift+r: Open Resource list


This is probably the most time-saving in all shortcut key combinations, and I often use it, especially if you find a file directly in the project or workspace by name, this set of shortcuts lets you open any file in your workspace, and you just 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.

4. Ctrl+shift+f: Format Code

The default 80 characters will be wrapped, this can be set. You can also reformat code based on code style, our team has a unified code format, 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.

5. Ctrl+e: Fast Conversion editor


This set of shortcuts will help you navigate between the open editors, especially when many files are open, and the ctrl+e will be more efficient and helpful.

6. Ctrl+page down or ctrl+page up: quick Switch between tabs


Can browse before and after the tab, if the use of skilled words, the individual page switch will be very fast, feel very good.

7, Shift+enter and Ctrl+shift+enter: Create a blank on the current line or below


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. These 2 shortcuts are also very helpful, at first you may not get used to, but after many times, you will feel very convenient, anyway I am.

 8, Alt + key: Up or down the line to exchange content or the current line content to move up or down


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.

9, control+alt+ direction: Copy the highlighted row or lines

This is also very useful shortcut keys, it is very convenient to copy the current code to the previous line or the next line, I often use.

 10. Ctrl+m: Maximize the current edit page window

Large display screen can improve productivity is known to everyone. Ctrl+m is the shortcut key for maximizing the editor window, and pressing again restores the normal window.

11, ctrl+/: Automatically comment on the current line or select multiple lines

Automatically comment out the current line or multiple lines of code, with//comments, with ctrl+\ can uncomment.

 12, ctrl+shift+/: Automatically comment out the selected code block


This note is used with/* */annotated (if it is a programming language code), development is also very useful, html,css, etc. can also use this comment, generate the corresponding annotation tag, with ctrl+shift+\ can uncomment.

13. Ctrl+d: Delete the current line


Delete the current line, this is very useful, I also often use, especially in debugging, delete the current error, combined with CTRL + Z editor undo shortcut Keys, with ease.

14, Ctrl+shift+x and Ctrl+shift+y: English letter Case Conversion

This shortcut key commonly used in the writing of SQL statements, I also often use, it is recommended that all the keywords in the SQL statement are capitalized, although the database case is not differentiated, but this is beneficial to others and their own reading especially SQL statements very long circumstances, and this look is also very normative.

15, Ctrl+shift+o: Automatically introduce the package and delete the useless package

This shortcut is also very convenient, when we use a class in another package, if the corresponding package or class is not introduced, there will be a red wavy line hint, at this time we can press this shortcut, red hints automatically disappear back to normal, if there are more than one containing the same class, then you will be prompted to choose, If there is no use of the package to introduce the situation, usually the code copied to copy to create more, can also be quickly removed with this key.


Attach some tips:

Lock Command Line window: In the Command line view (Window->show view->other->basic->console), try using the SCROLL LOCK button to lock the console output without scrolling.

Using Ant view: In my Java or debug mode, I like to show the ant view so I can run the ant task quickly. This view can be found through window ant. Place the ant view in the corner of the screen and add the Build.xml file with the add compiled file (addàotheràshow viewàbuildfiles) button. In version 3.1, even the Ant debug scripting language is supported.

Automatically traverse a collection: For + control-space: If you do not yet know, then you should remember that Control-space is the AutoComplete feature. In Eclipse, you can also automate the structure. In an array or collection range, try entering "for" and then pressing the Control-space key. Eclipse will ask you which collection you want to traverse and automatically complete the loop code.

Using hierarchical layouts: The default layout (flat) In Package Explorer View makes me confused, and it shows the full name of the package in the Navigation tree (navigation). I prefer the package and file system view of my source code, which is called the hierarchical layout (hierarchical layouts) in eclipse. To switch to this mode, click the Down button in the package browse view, select Layout, and then select Rating (hierarchial).

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

Open two eclipse simultaneously: to merge the changes from one CVS branch to another, I like to do this by opening two working directories (Workspace) to different eclipse. This way I can see all the changes by comparing the latest version on CVS (right-click the project and then select Compare lastest from HEAD) and then merge each change into another CVS branch. The simplest way to start multiple eclipse is to take advantage of 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 an excellent interface, you'll need a plugin like this to speed up code navigation. You can find this plugin in SourceForge.

Automatically generate getter and setter methods: in the corresponding Pojo, right-click on the space, select "Source", then select "Generate Getters and Setters", and then choose which properties you have to generate such a method, click "OK" is OK, Especially in the case of very many member variables, it saves time.

attach Eclipse shortcut key Daquan:

Ctrl+1 Quick Fix (the most classic shortcuts, you don't have to say more)

Ctrl+d: Delete When moving forward

Ctrl+alt+↓ Copy the current row to the next row (replication incremented)

Ctrl+alt+↑ Copy the current line to the previous row (replication incremented)

Alt+↓ the current line and the next line of interaction (especially useful, can be omitted first cut, then pasted)

Alt+↑ the current line and the upper row interaction position (IBID.)

alt+← the previous edited page

alt+→ next Edit page (of course, for the above article)

Alt+enter displays the properties of the currently selected resource (project, or file or file)

Shift+enter inserts a blank row on the next line of the current row (at which point the mouse can be at any position in the current row, not necessarily the last)

Shift+ctrl+enter Insert blank line in current line (principle above)

Ctrl+q positioning to the last edited place

Ctrl+l positioning in a row (for people with programs over 100 have the gospel)

Ctrl+m maximize the current edit or view (and vice versa)

ctrl+/comment on the current line, and then uncomment it

Ctrl+o Quick Display OutLine

Ctrl+t quickly displays the inheritance structure of the current class

Ctrl+w Closing the current editer

Ctrl+k the selected word quickly navigates to the next

Ctrl+e quick display of the current Editer drop-down list (in bold if the current page does not appear)

ctrl+/(numpad) collapses all code in the current class

Ctrl+x (keypad) expands all code in the current class

Ctrl+space Code Helper to complete the insertion of some code (but the general and IME conflict, you can modify the input method hotkey, you can also take up alt+/to replace)

Ctrl+shift+e Display manager that manages all of the currently open view (you can choose to close, activate, and so on)

Ctrl+j forward Incremental lookup (after pressing CTRL+J, each letter editor you enter provides a quick match to navigate to a word, if not, it is not found in the Stutes line, check a word, especially useful, this function idea two years ago)

CTRL+SHIFT+J Reverse incremental lookup (same as above, except forward)

Ctrl+shift+f4 Close all open editer

Ctrl+shift+x the text that is currently selected is all stale lowercase

Ctrl+shift+y turns the currently selected text to lowercase

Ctrl+shift+f formatting of the current code

Ctrl+shift+p position to the match (for example {}) (after locating from the front, the cursor is in the match, back to front, or vice versa)

The following shortcut keys are commonly used in refactoring, I like and commonly used to tidy up (note: General refactoring of the shortcut keys are alt+shift beginning of the)

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 Common 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.