Eclipse tool usage tips

Source: Internet
Author: User
Eclipse tool usage tips

First, we recommend a very good article on how to use eclipse, which describes all aspects of eclipse usage and is very practical. We recommend it to you!

I. Common shortcut keys:
CTRL + F11 run
CTRL + Shift +/Add/*... */comment in the code window
CTRL + Shift + \ remove/*... */comment
CTRL + Shift + O Add the missing import statement to Ctrl + 1 to quickly fix the problem (the most typical shortcut key is unnecessary)
CTRL + l locate in a line (for those with more than 100 programs, there will be good news)
CTRL + M maximize the current edit or view (then press it, and vice versa)
CTRL +/comment out the current row, and then press it to cancel the comment
CTRL + Shift + F format the current Code
F3 jump to declaration or definition
F4 display class diagram
CTRL + ALT + ↑: copy the row down (up)

Ii. Shortcut Keys in breakpoint debugging:
F5 step into single step
F6 step over skip one step
F7 step return jump out in one step

Iii. Common configurations:
1. display the row number: window-> preferences> General-> editors-> text editors-> check show line numbers.
2. enhanced the code auto-Prompt function of eclipse and myeclipse

Windows → preferences → Java → editor → content assist
The default value of autoactivation delay is 200 (in milliseconds). That is to say, the smart sensing prompt is displayed only after "." is played. After you change it to 20, the system prompts a significant increase in speed.

Principle: The "Auto activation triggers for Java" option refers to the option that triggers the code prompt. "to". abcdefghijklmnopqrstuvwxyz (, "refers to 26 letters and ., (These symbols trigger the code prompt function. (You can rest assured later.) How can I configure the code prompting function of eclipse and myeclipse? The procedure is as follows:
(1) Open eclipse, and then "window" → "Preferences"
(2) Select "Java", expand, "Editor", and select "content assist ".
(3) Select "content assist" and then see the "auto activation triggers for Java" option under "auto-activation" on the right. Actually, the code prompt is triggered by the "." symbol.
(4). the "auto activation triggers for Java" option should be followed by an ABC letter after "." To facilitate later search and modification. Then, "Apply" and click "OK ".
(5). Then, "file" → "Export", select "perferences" in the pop-up window, and click "Next ".
(6) Select the export file path, export it to the desktop, enter "test" as the file name, and click "save ".
(7) Find the file "test. EPF" you just saved on the desktop, right-click and choose "open with Notepad ".
(8). You can see a lot of eclipse configuration information.
(9) press the "Ctrl + F" shortcut key, enter ". ABC", and click "find next ".
(10). Find the configuration information of ". ABC.
(11). Change ". ABC" to ". abcdefghijklmnopqrstuvwxyz (,", save and disable "test. EPF ".
(12 ). return to the myeclipse 6.0.1 interface, "file" → "import", select "perferences" in the pop-up window, click "Next", and select the modified "test. open the EPF file and click Finish ". This step is similar to the preceding export step.
(13) Finally, of course, the Code test was conducted. Create a project and a class.
Conclusion: The "auto activation triggers for Java" option refers to the option that triggers the code prompt. "to". abcdefghijklmnopqrstuvwxyz (, "refers to 26 letters and ., (These symbols trigger code prompts. By the way, you can modify the class name and interface name highlighted in different colors. You can configure it in "Java"> "enditor"> "syntac ", expand "Java"> "classes" on the right side, check the "enable" option, and select your preferred color. Of course there are other related color configurations. Not to mention it. In fact, there are many items that can be configured in the "Preferences" to optimize myeclipse. Specifically, You need to configure them according to your personal preferences.

Iv. myeclipse font settings
Choose WINDOW> perferences> General> appearance> colors and fonts> text font and click Change to modify

V. How to open a Java project in eclipse

Use File> Import and select general> existing projects into workspace. Click next and then browse to the directory contain the project directory.

 

6. Call Stack in eclipse

In the "Debug perspective", show the view named "debug ". for each thread that is currently halted, this view shows the full call stack. clicking on one element of this stack switches the editor view to display the corresponding class, and "variables" view will show variables of this stack element.

7. debugging skills (from csdn)

1. Step into (also F5) Jump
2. Skip step over (also F6)
3. Step return (also F7) after executing the current method, return jumps out of this method
4. Step filter: gradually filter and execute until unfiltered locations or breakpoints are encountered (set filter: window-preferences-Java-debug-step filtering)
5. Resume re-runs debug until it encounters a breakpoint.
For example, if two breakpoints A and B are found to be useless during the debug process, and the breakpoint is removed, running resume will skip a and directly reach the B breakpoint.
6. hit count: Set the execution times to be appropriate for the for loop in the Program (Set breakpoint view-right-click hit count)
7. Inspect check operation. Execute an expression to display the execution Value
8. Watch monitors changes of objects, methods, or variables in real time.
9. We often say that the breakpoint refers to line breakpoints. In addition to line breakpoints, there are other breakpoint types: field (watchpoint) breakpoint, method breakpoint, and exception breakpoint.
10. Field breakpoint is also called watchpoint. It is temporarily suspended when the member variables are read or modified.
11. Run-method breakpoint)
12. When exception breakpoint is added to catch execption (To be continued ...)
Breakpoint attributes:
1. How many times of hit count execution will be suspended for Loop
2. When enable condition meets your input conditions (true/change), it will be suspended temporarily.
3. This thread is temporarily suspended when suspend thread is multithreading.
4. The suspend VM is temporarily attached to the VM.

13. variables in the variables view can change the variable value. In the variables view, right-click the variable and choose change value. One time for quick debugging.
14. After some code is modified during the debug process --> Save & build --> resume from the breakpoint
15. When the debug debugging runs abnormally, run resume and start debugging again from the breakpoint.

8. Eclipse advanced debugging skills

 

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.