Eclipse operation skills

1. Eclipse can open multiple windows at the same time, select from the menu bar: Window -> New Window to open multiple windows.
To switch between multiple windows, you can use Alt + Tab to switch back and forth.

2. Set the character set of the workspace Select Window -> Preferences -> General -> Workspace -> Text file encoding
in the menu bar, click Other in Text file encoding, and select UTF-8.

3. Use content assistance
In Eclipse, we can use code prompts to speed up the development. The default is to enter "." and an automatic prompt will appear, which is used for automatic prompting of class members.
The configuration for setting automatic prompts is in: window->Preferences->Java->Editor->Content Assist:

4. Using floating prompts
The java editor contains different types of floating prompts, and the floating prompts provide additional information about the element that the mouse pointer points to . All relevant hover prompts in the java editor can be configured through the Hovers page of preference (input "hover" in the search box

5. Find
Eclipse in the workspace The search dialog allows users to use words on the specified workspace or alphabetic mode to find files. Or you can search for a specific project or select a specific folder on the package explorer view.
The search box can be invoked by:
Select Search or File or Java on the Search menu
Press the shortcut key : Ctrl + H

6. The three menu items Open Type, Open Type in Hierarchy and Open Resource in the above picture are very useful.


7. Refactoring with Eclipse
In project development, we often need to modify the class name, but if other classes depend on this class, we need to spend a lot of time modifying the class name.
But Eclipse's refactoring feature can automatically detect class dependencies and modify class names, saving us a lot of time.
The refactoring menu can be opened in the following ways:
Right-click the Java element in the Package Explorer view and select the Refactor (refactoring) menu item

8. About bookmarks
In Eclipse, bookmarks can be added to any line in the editor. You can use bookmarks as prompts, or use bookmarks to quickly navigate to specific lines in a file.
Adding Bookmarks
If you want to set bookmarks, you just need to right-click on the vertical ruler and select "Add Bookmark".
Open Bookmarks (bookmarks) view The way to
open Bookmarks view is:
Click the Window menu, select Show View > Other , enter Bookmark in
the search input box
, and select Bookmarks under General

9. Manage tasks
In Eclipse, use the TODO tag to manage tasks. Using this function, you can It is convenient to record some tasks that need to be dealt with in the project.
We can mark a task by adding the word TODO to the comments in the Java code, and the task can be viewed through the Tasks (task) view

10. Eclipse also provides a lot of code templates. We can see a list of all defined code templates through Windows->Preferences->Java->Editor->Templates (you can enter Templates in the search box to find it).

11. Eclipse common shortcut keys
Shortcut description
Edit
Ctrl+1 Quick fix (the most classic shortcut, needless to say, can solve many problems, such as import class, try catch surround, etc.)
Ctrl+Shift+F Format current Code
Ctrl+Shift+M Add class import
Ctrl+Shift+O Organize class import (both Ctrl+Shift+M can help you remove useless imports, very useful)
Ctrl+Y Redo (Contrary to undoing Ctrl+Z)
Alt+/ Content assist (it saves you how many times of keystrokes, it is too common)
Ctrl+D Delete the current line or multiple lines
Alt+↓ The current line and the next line interactive position (especially practical, you can save Go to cut first, then paste)
Alt+↑ the current line and the above line interactive position (same as above)
Ctrl+Alt+↓ copy the current line to the next line (copy increase)
Ctrl+Alt+↑ copy the current line to the previous line (copy increase)
Shift +Enter Inserts a blank line in the next line of the current line (the mouse can be anywhere in the current line, not necessarily the last)
Ctrl+/ Comment the current line, press again to cancel the comment
Select
Alt+Shift+↑ Select the package element
Alt+Shift+← Select the previous element
Alt+Shift+→ Select the next element
Shift+← Select the character from the cursor to the left
Shift+→ Select the character to the right from the cursor
Ctrl+Shift+← Select the word to the left of the cursor
Ctrl+Shift+→ Select The word with the cursor on the side
Move
Ctrl+← The cursor moves to the beginning of the word on the left, which is equivalent to vim's b
Ctrl+→ The cursor moves to the end of the right word, which is equivalent to vim's e
Search
Ctrl+K Refer to the selected Word to quickly locate to the next ( If the word is not selected, search for the word that was last used to search)
Ctrl+Shift+K Refer to the selected word to quickly locate to the previous
Ctrl+J Forward incremental search (after pressing Ctrl+J, each The letter editors all provide quick matching to locate a word. If not, it will display in the status bar that it is not found. It is especially useful when looking up a word. To exit this mode, press escape)
Ctrl+Shift+J Reverse Incremental search (same as the previous one, but from back to front)
Ctrl+Shift+U List all lines containing strings
Ctrl+H Open search dialog
Ctrl+G Declaration in workspace
Ctrl+Shift+ G References in Workspace
Navigation
Ctrl+Shift+T Search for classes (including projects and associated third jars)
Ctrl+Shift+R Search for files in a project
Ctrl+E Quickly display the drop-down list of the current Editor (if the current page is not displayed in bold)
F4 Open the type hierarchy
F3 Jump to the declaration
Alt+← Previous edited page
Alt+→ Next edited page (of course for The above one said)
Ctrl+PageUp/PageDown In the editor, switch the opened file
Debug
F5 Step into
F6 Step over
F7 Step back to
F8 Continue
Ctrl+Shift+D Display the value of the variable
Ctrl+ Shift+B Set or remove the breakpoint in the current line
Ctrl+R Run to the line (super easy to use, can save a lot of breakpoints)
Refactoring (generally, the shortcut keys for refactoring start with Alt+Shift)
Alt+Shift +R Rename method name, property or variable name (it is my favorite one, especially the Rename of variables and classes, which can save a lot of labor than manual methods)
Alt+Shift+M Extract the code in a function into a 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, there are N functions that call this method, modify it once Get it)
Alt+Shift+L Extract local variables (you can directly extract some magic numbers and strings into a variable, especially when calling multiple times)
Alt+Shift+F Change the local variable in the Class into a field variable (compare useful function)
Alt+Shift+I Merge variables (may be a bit inappropriate to say Inline)
Alt+Shift+V Move functions and variables (not very common)
Alt+Shift+Z Refactoring regret medicine (Undo)
Other
Alt+Enter Display the currently selected resource Attribute, the attribute of viewing file under windows is this shortcut key, which is usually used to view the actual path of the file in windows
Ctrl+↑ Scroll up the
text editor Ctrl+↓ Scroll down the text editor
Ctrl+M Maximize the current Edit Or View (press again and vice versa)
Ctrl+O Quickly display OutLine (for students who do not open the Outline window, this shortcut key is essential)
Ctrl+T Quickly display the inheritance structure of the current class
Ctrl+W Close the current Editor (under windows This is also the case for closing the opened dialog box, as well as qq, Wangwang, browser, etc.)
Ctrl+L Text editor go to line
F2 Display tooltip description

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326573320&siteId=291194637