MyEclipse shortcut keys

Source: Internet
Author: User

An eclipse-level developer summarizes what he thinks is the most useful but less known shortcut key combination. Through these combinations can be more easy to browse the source code, so that the overall development efficiency and quality is improved (red font for I often use the shortcut keys ), who use who know, quickly try it . Personal advice to everyone in the inside all the shortcut keys to learn, including a lot of special convenient shortcut keys. Press Ctrl+shift+l, and all the shortcuts will pop up.

To add a shortcut comment to the Java class: Select the method, and then use Alt+shift+j.

MyEclipse Automatic Format adjustment: Shortcut key is: ctrl+shift+f

Select an open page and drag to open two pages. For ease of operation and comparison.

Select the method name of the method in the interface and press Ctrl+t to find the method of the method's implementation class.

Eclipse commented out some code: CTRL+SHIFT+C, adding an empty comment to the current

ctrl+shift+/

Convert all selected characters to lowercase: ctrl+shift+y

Cleanup Console information: Right-click the mouse button, and then press R

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.

You can also select the file name of a file and press this key to quickly locate the file.

2. 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, and click Enter to jump directly to where you want to go.

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

4. Ctrl+2,l: Assigning a value to a local variable

During development, I often write methods, such as calendar.getinstance (), and then assign the results of a method to a local variable by ctrl+2 shortcut keys. 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.

5. Alt+shift+r: Renaming

Renaming properties and methods was a hassle a few years ago, requiring a lot of searching and replacing 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, press Alt+shift+r, enter a new name, and then 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. 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 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.

9. Ctrl+m

Large display screen can improve productivity 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 +. Moves 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.

11,ctrl+home (end), the cursor returns to the initial (end) position of this page.

More shortcut key combinations can be viewed at Eclipse Press Ctrl+shift+l.

—————————————————————————————————————————-。

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

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). Alternatively, use 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 .

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

8. control-shift-f: Codeàjavaàpreferencesà reformat the code according to the code style. 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 .

control-/: Comments on a line or uncomment. This is also true for multiple lines.

Control+alt+down Arrow: Copies the highlighted row or rows.

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 shortcut keys by pressing CONTROL-SHIFT-L (starting with version 3.1). Press Control-shift-l two times to display the Hotkey dialog (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:

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.

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 often used by most people to see the definition of variables, methods, classes

2. Ctrl+o

View a schema for a class that lists its methods and member variables. Tip: If you press Ctrl+o again, you can list the methods and variables that the class inherits.

Help Note: "O", "Outline", "outline"

3. 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"

4.alt+ left and RIGHT ARROW keys

we often encounter the code when you CTRL + left-click, Layer-by-layer tracking, and then get lost in the code, just 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.

5,ctrl+shift+ Upper and Lower arrow keys

The mouse switches directly to each method name, regardless of where the cursor is located before the operation.

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 Restore Previous selection alt+shift+↓

Global Quick Fix ctrl1+1
Global Content Assist alt+/

Delete one line: ctrl+d

Global context information ALT +?
Alt+shift+?
Ctrl+shift+space
Java Editor display tooltip description F2
Java Editor Select encapsulated element alt+shift+↑
The Java editor selects the previous element alt+shift+←
The Java editor selects the next element alt+shift+→
Text Editor incremental find Ctrl+j
Text Editor incremental reverse lookup ctrl+shift+j

Global Redo Ctrl+y

MyEclipse shortcut keys

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.