Common eclipse shortcut keys and debugging methods, and eclipse shortcut key debugging

Source: Internet
Author: User

Common eclipse shortcut keys and debugging methods, and eclipse shortcut key debugging

Link: http://my.oschina.net/u/1054538/blog/741561

 

Common shortcut keys

Eclipse's most complete shortcut keys. Familiarity with shortcuts can help developers get twice the result with half the effort and save more time for meaningful things.

  • Ctrl + 1 quick fix (the most classic shortcut, you don't need to talk about it)
  • Ctrl + D: Delete the current row
  • Ctrl + Alt + ↓ copy the current row to the next row (copy added)
  • Ctrl + Alt + ↓ copy the current row to the previous row (copy added)
  • Alt + ↓ interaction position between the current row and the following row (especially practical, you can save cutting and pasting)
  • Alt + ↑ interaction between the current row and the previous row (same as above)
  • Alt + ↓ previous edited page
  • Alt + → next edited page (of course for the above)
  • Alt + Enter display the properties of the currently selected resource (project, or file)
  • Shift + Enter insert empty rows in the next row of the current row (the mouse can be at any position of the current row, not necessarily the last row)
  • Shift + Ctrl + Enter insert blank lines in the current line (same principle)
  • Ctrl + Q locate the Last edited location
  • 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 + O quick OutLine display
  • Ctrl + T quickly display the inheritance structure of the current class
  • Ctrl + W disable the current Editer
  • Ctrl + K quickly locate to the next one by referencing the selected Word
  • Ctrl + E: Click it to quickly display the drop-down list of the current Editer (if the current page is not displayed, it is displayed in bold)
  • Ctrl +/(keypad) collapse all code in the current class
  • Ctrl + × (keypad) show all the code in the current class
  • Ctrl + Space Code assistant inserts some code (but it is usually in conflict with the input method. You can modify the key of the input method or replace it with Alt +/for the moment)
  • Ctrl + Shift + E display the managers that manage all Opened Views (you can choose to close or activate them)
  • Ctrl + J forward incremental search (after pressing Ctrl + J, each letter editor you enter provides a quick match to locate a word. If no
  • Yes, it is not found in stutes line. It is particularly useful when querying a word. This feature was available two years ago)
  • Ctrl + Shift + J reverse incremental search (the same as the previous one, but only from the back to the front)
  • Ctrl + Shift + F4 close all open Editer
  • Ctrl + Shift + X convert all selected text to uppercase
  • Ctrl + Shift + Y change all selected text to lowercase
  • Ctrl + Shift + F format the current Code
  • Ctrl + Shift + P locate the matched character (for example, {}) (when positioning from the front, the cursor must be inside the matched character, followed by the front, and vice versa) the following shortcut keys are commonly used in refactoring. I like them and want to sort them out frequently (note: the keys for refactoring generally start with Alt + Shift)
  • Alt + Shift + R Rename (one of my favorite ones, especially the Rename of variables and classes, which saves a lot of labor compared with manual methods)
  • Alt + Shift + M extraction method (this is one of the most common methods in refactoring, especially useful for a lot of mud code)
  • Alt + Shift + C modify the function structure (more practical. N functions call this method and modify it once)
  • Alt + Shift + L extract local variables (you can directly extract some magic numbers and strings into one variable, especially when multiple calls are performed)
  • Alt + Shift + F convert the local variable in the Class to the field variable (more practical)
  • Alt + Shift + I merge variables (this may be a bit inappropriate Inline)
  • Alt + Shift + V moving functions and variables (not commonly used)
  • Alt + Shift + Z restructured regret medicine (Undo)

Several Eclipse debugging skills, hoping to be useful to Java programmers.

1. Conditional breakpoint

If you do not know how to add a breakpoint, click the breakpoint on the left panel (before the row number) to create the breakpoint. On the debugging page, the "breakpoint" view lists all created breakpoints. We can add a Boolean condition to the breakpoint, that is, the breakpoint will be activated and the breakpoint will be executed if the Boolean condition is true. Otherwise, the breakpoint will be skipped.

2. Exception breakpoint

In the breakpoint view, there is a J! Mark button! You can use this button to add a Java exception breakpoint. For example, if we want the program to continue debugging when it encounters a null pointer exception (NullPointerException), we can use this button to add an exception breakpoint!

3 Monitoring Points

This is a very good function. When the selected properties access or modify the program, the program stops running and allows debugging. Select a class variable in the Outline View and select to switch the monitoring point from the context menu. The attribute monitoring point will be created at the breakpoint (Breakpoints) view displays all monitoring points in the form of a list.

4. Evaluation/check

Press Ctrl + Shift + D or Ctrl + Shift + I to display the value of the selected variable or expression. We can also add permanent observation points to a variable or Expression. When the program is debugging, these observation points will be displayed in the Expression view.

5. Modify the variable value

You can modify the variable value during debugging. Select a variable and enter the variable view. Enter a Value in the corresponding Value column based on the variable type.

6 Drop to Frame

During the debugging, you can jump back to the beginning of the stack framework call and execute the command, and the variable value will return to the beginning. Adjust the depth of the stack according to the archive. The main purpose of this function is to quickly return the status of all variables to the method when the execution starts, and then you can execute it again, in this way, you can perform debugging multiple times in the area you are concerned about, but some side effects may occur during the execution process. For example, the data inserted into the database cannot be deleted!

7. Enter, jump out, and return

  • F5 -- Enter: move to the next step. If there is a method call in the current row, the control will jump to the first line of the called method for execution.
  • F6 -- jump out: Move to the next row. If there is a method call in the current row, it will be directly moved to the next row for execution. Does not enter the called method body.
  • F7 -- Return: jump out of the current method and continue to execute.
  • F8 -- move to the next breakpoint for execution.

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.