Eclipse utility to improve development efficiency

Source: Internet
Author: User
Tags hash tomcat

Reproduced from: http://www.codeceo.com/article/eclipse-guide.html

工欲善其事, its prerequisite. For programmers, Eclipse is a "device". This article starts with an introduction to the two chapters of Eclipse shortcuts and practical tips. Eclipse shortcut keys are cooked, without a mouse, you can program development, to avoid the mouse divided your God. And mastering some of the practical techniques of eclipse can greatly improve development efficiency. 1, lost the mouse the Eclipse shortcut key article 1.1 File switching three ways 1.1.1 Ctrl + E, display all currently open files on the right

1.1.2 Ctrl + PG UP, Ctrl + PG Dn, file hopping

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

Before:

After:

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

I personally like Ctrl + E this way. 1.2 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);

   }

1.3 Display all properties and methods of the current class

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.

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.

1.4 Ctrl + W close the current file, CTRL + Shift + W close all files

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 +←. 1.5 quickly locates the location of the current file in the project, that is, the location 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.

1.6 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 "";

 }

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. If you position the mouse over the Oscacheservice, you can use ALT + Shift +→ to select Oscacheservice the entire string without using the mouse. 1.7 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. 1.8 Ctrl + H for global search and local search

1, in addition to "FileSearch", 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.

2. Local Search

You can select a view in the

Perform a local search to improve efficiency. 1.9 Automatic generation of Get/set method, tostring method, hash method

1. Use ALT + Shift+s to bring up code generation view

2, pull out the view, direct input R call Get/set generate view, input H pull hash method to generate view, input s up tostring method to generate View 2.0 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. 2.1 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.

1. Use CTRL + 3

2. Enter the keywords you need to find in eclipse

2.2 Jumps between variable names and methods

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

1, modify the 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.

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

2.4 Eclipse's crumb 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.

1, in the face of the class file, use ALT + Shift + B to pull out the eclipse crumbs

2, then click Enter, 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.

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

The search view lists all classes that call the Getadorderbyid method 2.6 Ctrl + K and CTRL + Shfit + K to find the 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. 2.7 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:

There is an underscore below the letter C, at which point you only need to use the ALT key to select, for example, Alt +c to select the "Case sensivive" option.

There is another way, is to use the TAB key, did not press once, will choose an option. 2.8 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. 2.9 Review, after the code has been modified, want to start Tomcat, with shortcut keys how to operate

1. Switch to servers view with CTRL + F7

2, use CTRL + ALT + D to start Tomcat. 3.0 How to quickly generate a for loop, switch, and other blocks of code

For example, you want to write a switch code block,

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.