Eclipse shortcut keys 10 most useful shortcuts

Source: Internet
Author: User

10 most useful shortcut key combinations in eclipse an eclipse-level developer summarizes the shortcut key combinations he thinks are the most useful but less known.    These combinations make it easier to navigate through the source code, resulting in improved overall development efficiency and quality.  1. ctrl+shift+ r: Open a resource this may be 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 + o: Fast outline If you want to see the method of the current class or a specific method, but do not want to pull the code down, do not want to use the search function, you use the 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, and click Enter to jump directly to where you want to go.  3. Ctrl + E: Quick Convert editor This set of shortcuts will help you navigate between the open editors. Use CTRL+page down or ctrl+page up can be browsed before and after tabs, but in the case of many files open, CTRL +e will be more efficient.  4. Ctrl +2  , L: Assigning values to local variables 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. CTRL +f is similar in effect, but the effect is to assign the result of the method to a field in the class.  5. alt+shift+ R: renaming renamed Properties and methods a few years ago it was a very troublesome thing to use a lot of search and replace so that the code became fragmented. Today's Java IDE provides source-processing functionality, as is eclipse. Now, the renaming of variables and methods is very simple, and you'll get used to renaming each time a better alternative name appears. To use this feature, move the mouse over the property name or method name and press ALT+shift+r, enter a new name and click Enter. This is done. If you rename a property in the class, you can click alt+shift+R two times, this will call out the Source Processing dialog box, you can implement the get and set method of automatic renaming.  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 chunks of code. For example, to create a constant from a string, select the text and press ALT+shift+L can. 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.  7. 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.  8. ALT + arrow keys 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. Ctrl + m large display screen can improve work efficiency is known to everyone. Ctrl+m is the shortcut key for maximizing the editor window.  Ctrl +. And CTRL +1  : Next error and quick change 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 revised version of Eclipse suggestions are good to help you solve a lot of problems, such as missing parameters in the method,Throw/Catchexception, methods that are not executed, and so on. More shortcut key combinations you can press CTRL at Eclipse+shift+l view. Let's use the frequency to see some of my favorite hotkey combinations. (Note: The following are tested on Eclipse3.02 and one version) 1. CONTROL-SHIFT-T:Opens the type (open type). If you don't intentionally skiving, forget to open it through the source tree. With Eclipse it is easy to open an implementation class of an interface, press CTRL +T lists the implementation class list for the interface 2. control-shift- R: Open resources (not just for Java files). Tip: Use the yellow two-headed arrow button in the Navigator view to associate your editing window with the navigator. This allows you to open files that correspond to the hierarchy of the Navigator, which makes it easier to organize information. If this affects speed, turn it off.  3. F3:Open the Declaration (opening declaration). Or, with declaration Tab (in Java view mode, select 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.  4. alt-Left  Arrow: 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) 5. alt-Right  Arrow: forward in navigation history.  6. control- 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.  7. Control-shift-g:Search for references (reference) in workspace. 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, 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.  8. control-shift- F: codeàjavaàpreferencesà Reformat 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.  9. control- O: Fast Overview (Quick outline). With this shortcut, you can quickly jump to a method or property and just enter the first few letters of the name.  ten. control-/ : Comments on a line or uncomment it. This is also true for multiple lines .  control-alt-.Down  Arrow: copies the highlighted row or rows.  A. 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 do this by pressing the control-shift-l (starting with version 3.1), see a list of all the shortcut keys. Press the control-shift-L two times, the Hotkey dialog box is displayed (Keys Preferences dialog), where you can set the hotkey yourself. I welcome your eclipse tips in the talkback section. Other eclipse tips I've summed up a few related tips: locking the command line window: in the Command Line view (window->show View->other->basicConsole), try using the SCROLL LOCK button to lock the console output without scrolling the screen. 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,
It even supports the Ant debug scripting language. To automatically traverse a collection: for+ Control-space: If you do not know yet, 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 the input " for"Then press 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. So I can see all the changes by comparing the latest version on CVS (right-click the project and select Compare Lastest fromHEAD) 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. Ctrl +alt+ H If you want to know how a class's methods are called by those other classes, check the name of the method and press Ctrl+alt+H ", Eclipse will show which methods are called by this method, resulting in a call tree.
1. Ctrl + left button This is commonly used by most people to see the definition of variables, methods, classes 2. Ctrl + O View an outline of a class that lists its methods and member variables. Tip: Press CTRL one more time+O, you can list methods and variables that are inherited by this class. Help Note:"O"--->"Outline"--->"Outline" 3. Ctrl + T View the inheritance tree of a class, which is top-down, and press CTRL one more time+T, the bottom-up display structure is replaced. Tip: Select a method name and press CTRL+T, you can see the parent, subclass, and interface of the method with the same name. Help Note:"T"------->"Tree"----->"Hierarchy Tree" 4. ALT + left and RIGHT arrow keys we often encounter when looking at code CTRL+ Left-click, Layer-by-layer tracking, and then get lost in the code, just press "ALT +left ARROW key "can be returned to the last reading position, similarly, press" Alt+The right ARROW key advances to the reading position that you just returned, just like the browser's forward and back buttons. Import Package: Ctrl +shift+o

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.