Drop the mouse and use the best Eclipse shortcut keys _eclipse

Source: Internet
Author: User

There are many articles about eclipse shortcuts, but most of them are not detailed and are not illustrated. This article will introduce a truly useful eclipse shortcut that can be developed programmatically without a mouse.

I'm also going to put some of the knowledge points related to eclipse, as a series, you can write "How to debug, set exception breakpoints, evaluate expressions in debug mode", "Refactor", "Practical Eclipse manipulation techniques," and so on, in addition to shortcuts, so you just learn Java friends, You can use eclipse in a more comprehensive way.

The more shortcuts you use, the more efficient your operations are, and the more efficient your development will be, and it will allow you to focus more on the code rather than always letting your mouse divide your God.

This article just lists some of the most common eclipse shortcuts, and you'll add some handy shortcuts in succession. The first recruit: three ways to switch files 1, Ctrl + E, display all the files currently open on the right.


2, Ctrl + PG UP, Ctrl + PG Dn, file hopping.

Press CTRL + Pg Dn, jump from Adconf.java to Adquaryserviceimpl.java

Before:


After:


Vice versa. 3, Ctrl + F6, in the current file to display all currently open files


I personally like Ctrl + E this way. Second trick: Copy the current line or the currently selected code block

In eclipse, if you need to copy a row without using CTRL + C, you just need to use CTRL + Alt +↓. Note that this shortcut is usually a conflict and can be modified on the Keys panel. I like to replace CTRL + ALT +↓ with CTRL + ALT + END.

public class TestString {

public static void Main (string[] args) {

String s = "";

System.out.println (s = = null);

}

}

Suppose you want to copy the line "String s =" ", just focus on the row it corresponds to, and then press CTRL + ALT +↓." This shortcut also supports copying blocks of code. The third trick: Show all the properties and methods of the current class

It used to be in Eclipse's outline, and now you can turn it off because you can use CTRL + O to display all the properties and methods of the current file. Note that the capital letter O, not the number 0.
Part Four: Ctrl + W Close the current file, CTRL + Shift + W Close all files Five strokes: Quickly locate the location of the current file in the project, that is, the position in the package view

One way is to click "Link with Editor" in the package view directly.


But this way has a disadvantage, that is, you must use the mouse to click "Link with Editor".

The second way is to use ALT + Shift +w to display the view and then select Package view, and also navigate to the position of the current file in the package view, thus avoiding the use of the mouse.


Recruit: Select the contents of the Java file

public string Get (@RequestParam (value = "key") string key) {

Object obj = oscacheservice.get (key);

if (obj!= null) {

return Jsonutil.tojson (obj);

}

Return "";

}

If you position the mouse over the Oscacheservice, you can use ALT + Shift +→ to select Oscacheservice the entire string without using the mouse.

This shortcut is very useful, and if you want to select all the content in the IF statement, you can also use this shortcut, and so on. Seventh recruit: Ctrl + T select Java File, CTRL + R Select Resource File

If you're just looking for Java classes, it's more efficient to use CTRL + T directly.

Eighth recruit: Ctrl + H for global search and local search in addition to "File search", other can be removed from the view

After using CTRL + H to pull up the search view, click Customize.



Only the "File Search" option is retained, and other options are not useful. Local Search

You can select a view in the


Perform a local search to improve efficiency.

Nineth Recruit Automatic Generation Get/set method, tostring method, hash method use ALT + Shift +s to bring up code generation view


Pull out the view, direct input R call Get/set generate view, input H call hash method to generate view, input s call tostring method to generate view


Tenth strokes View Toggle Ctrl + F7

This shortcut is also very useful, for example, in code view, you want to see the contents of the console, Ctrl + F7 can help you.


For example, if you want to start Tomcat, just press CTRL + F7, switch to Servers view, and then press CTRL + ALT + D, without using the mouse at all.

The 11th Recruit Classic Quick Access

Enter CTRL + 3 and you can use quick access. For example, if you want to configure the MAVEN environment for Eclipse, you usually need to click Windowàpreferencesàmaven, and with quick Access you just need to enter MAVEN directly. Use CTRL + 3 to enter keywords for the things you need to find in eclipse


12th strokes between the variable name and method of the jump

When you want to know what the next method of the current method is, just press CTRL + Shift +↓ to achieve your goal, and the shortcut key applies to the variable name as well.

13th Recruit Refactoring Modify name

Suppose you want to modify the parameter name of the method, or class variables, method variables, and these variables are referenced by a lot of code, then you can use the ALT + Shift + R Unified change once.

Focus on the variable name, then use ALT + Shift + R, and eclipse will prompt you to enter a new variable name and click Return to change it. The shortcut key also applies to modifying the class name and method name. Extraction class Method

If the code for a method is too long and you want to extract the child method, just select a block of code and then use ALT + Shift + M to eject the extraction view and enter the method name.


14th recruit Eclipse's breadcrumbs function Alt + Shift + B

Eclipse's breadcrumbs function is similar to the Package view feature, and you can display the breadcrumbs in eclipse by pressing ALT + Shift + B.


Skilled use of this tool, you do not need to package view, the direct use of bread crumbs navigation function. Here, by the way, how to copy the name of a class as quickly as you can. In the face-to-face class file, use ALT + Shift + B to bring up the eclipse crumbs and then click Enter, and Eclipse will automatically select the name of the class

Some friends don't like this feature, so you can cancel the crumbs by clicking the Toggle breadcrumb button in the Eclipse toolbar.


15th recruit Ctrl + Shift +g to find all classes that call a method

Sometimes you want to see what class of methods a Java method is called, and you can use CTRL + Shif + G directly.


To Getadorderbyid this method as an example, the mouse is positioned on this method, using CTRL + Shif + G.


All classes that call the Getadorderbyid method are listed on the search view

16th Recruit Ctrl + K and CTRL + Shfit + K, find text

When you select certain strings in a file, you can use CTRL + K to look down for the same string and use CTRL + Shfit +k to look up the same string.

17th recruit Ctrl + F, bring up the view of the search text

In this view, there are some options for filtering information, such as case sensitivity.


This view has so many options, how to avoid using the mouse to click it. A careful friend should be able to see that each option has an underscore on the text of the letter, for example:

, the letter C is underlined below, at this time, you only need to use the ALT key to select, for example, Alt +c can select the "Case sensivive" option.

There is another way, is to use the TAB key, did not press once, will choose an option.

18th strokes. How to close an open view without a mouse

If you open a view, such as Ctrl + F,ctrl + H, after you open the search view, you want to turn it off. You can use the ESC key directly to avoid using the mouse.

The 19th recruit review, after the code is modified, want to start Tomcat, with shortcut key how to operate using CTRL + F7 switch to servers view use CTRL + Alt + D to start Tomcat.

20th strokes how to quickly generate a for loop, switch, and other blocks of code

For example, if you want to write a switch code block, just type the switch, and then use ALT +/,eclipse to generate the following code:


Note in the newer version of Eclipse, Alt +/is the default code hint shortcut, and the default shortcut for the older version is CTRL + Space, which conflicts with the input. How to modify CTRL + Space this default shortcut key.

Note that using the previous knowledge points, you can use the shortcut keys to operate. Ctrl + 3 Enter keys, jump to Keys view


When you jump to the keys view, the default selection is how to jump to, and then enter the content. You can use the tag key.

Then enter the content assist, use ALT + B, jump to the binding option, and enter alt+/. Use the tag key to jump to the OK option, click Enter to take effect

21st Recruit closes the file

Use CTRL + W to close the current file, CTRL + Shift +W to close all currently open files.

If I close the current file and regret it, I want to reopen it. Use Alt +←.

22nd Strokes Case Conversion

CTRL + SHIFT + Y to lowercase, CTRL + SHIFT + X to uppercase.

23rd strokes Create various types of files

For example, to create a new class in the package where the current file is located, you can use ALT + Shift + N to create the view and select the relevant type.


If you want to create it in any directory, use CTRL + N.

24th strokes Delete When moving forward

Using CTRL + D, a very useful shortcut key

The 25th trick is to find the right brace based on the opening brace.


Press CTRL + Shift + p to jump to the right curly brace.

26th strokes, how to jump from the other view to the Code Editor view F12

Of course, you can switch the view through the CTRL + F7 mentioned above, but if you switch to the Code Editor view, press F12 directly.

27th strokes how to jump to a specific line in a file, Ctrl + L

Ctrl + L, and then enter the number of rows.


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.