The 15 most commonly used Eclipse development shortcut key skills

Introduction
       Those who do Java development often use Eclipse or MyEclise integrated development environment. Some practical Eclipse shortcut keys and usage skills can save a lot of time in normal development and improve work efficiency. Below I will combine the use in my own development with everyone. Share the shortcut keys and skills commonly used in Eclipse.

1. alt+? or alt+/: auto-completion code or prompt code

This is my favorite shortcut key combination, especially when two fingers easily press these two keys after entering a few characters of syso, automatic Just complete System.out.println();, and eclipse defaults to "." for method prompts. If the middle prompt is broken and you want to look again, you have to re-enter "." in front of the corresponding class or variable. See the prompt again, but if the combination of these two keys can also play a role as a prompt, you can try it, and if you enter for, if there are local variables that need to be traversed above, the option for each will pop up. Traverse or for (int;;) or while () and then automatically generate code.

2. ctrl+o: quick outline view

If you want to view the methods of the current class or a specific method, but you don’t want to pull the code up and down, and you don’t want to use the search function, use ctrl+o, especially to open it directly Or when you track a class with a lot of methods, this is very useful, you can directly see those methods and member variables, it can list all the methods and properties in the current class, you only need to enter what you want to query Method name, click enter to jump directly to the location you want to go to.

3. ctrl+shift+r: Open the resource list.

This may be the most time-saving of all shortcut key combinations, and I often use it, especially to find a file directly in the project or workspace based on its name. This group The shortcut key allows you to open any file in your workspace, and you only need to press the first few letters of the file name or mask name, such as applic*.xml. The fly in the ointment is that this set of shortcut keys does not work in all views.

4. ctrl+shift+f: The formatting code

will wrap after 80 characters by default. This can be set. It is also possible to reformat the code according to the code style setting, our team has a unified code format and we put it on our wiki. To do this, we open Eclipse, select Window Style, and set Code Formatter, Code Style and Organize Imports. Use the Export function to generate configuration files. We put these configuration files on the wiki, and then everyone on the team imported them into their own Eclipse.

5. ctrl+e: Quick Conversion Editor

This set of shortcut keys will help you browse between open editors, especially when many files are open, ctrl+e will be more efficient and very helpful.

6. ctrl+page down or ctrl+page up: Quickly switch between tabs

You can browse the front and back tabs. If you use it proficiently, the switching of each page will be very fast, which feels very good.

7. Shift+enter and ctrl+shift+enter: Create a blank above or below the current line

Shift+enter creates a blank line below the current line, regardless of whether the cursor is at the end of the line. Ctrl+shift+enter inserts a blank line before the current line. These 2 shortcut keys are also very helpful. You may not be used to them at first, but after using them many times, you will feel very convenient. Anyway, this is how I am.

8. Alt + arrow keys up and down: exchange content up and down or move the current line content up or down,

which is also a magic weapon to save time. This combination moves the content of the current line up or down. This shortcut works especially well in the try/catch section.

9. Control+Alt+Up and Down arrow keys: Copy the highlighted line or lines
This is also a very useful shortcut key, which is very convenient to copy the current code to the previous or next line, and I often use it.

10. ctrl+m:

It is well known that maximizing the large display screen of the current editing page window can improve work efficiency. Ctrl+m is the shortcut key for maximizing the editor window. Press it again to restore the normal window.

11. ctrl+/: Automatically comment out the current line or selected
multiple lines of code. Use // to comment, and ctrl+\ to uncomment.

12. ctrl+shift+/: Automatically comment out the selected code block.

This note is commented with /* */ (if it is a programming language code), which is also very useful in development. HTML, CSS, etc. can also use this comment to generate The corresponding comment label can be uncommented with ctrl+shift+\.

13. ctrl+d: delete the current line to

delete the current line, this is very useful, I also use it often, especially in debugging, delete the current error, combined with ctrl+z to edit the shortcut key of undo, it is easy to use.

14. ctrl+shift+x and ctrl+shift+y: conversion of English letters to uppercase and lowercase
This shortcut key is often used in the writing of SQL statements. It is recommended that all keywords in SQL statements should be capitalized, although The database is not case-sensitive, but this is helpful for others and yourself to read, especially when the SQL statement is very long, and it looks very standardized.

15. ctrl+shift+o: This shortcut key to automatically import packages and delete useless packages

is also very convenient. When we use a class in another package, if the corresponding package or class is not imported, a red squiggly line will appear. , at this time we can press this shortcut key, the red prompt will disappear automatically and return to normal, if there are multiple containing the same class, then you will be prompted to choose, if there is an unused package introduced, usually the code Copying and copying cause more, you can also use this key to quickly remove.

Attached some tips:
Lock the command line window: In the command line view (Window ->Show View ->Other ->Basic ->Console), try using the scroll lock button to lock the console output from scrolling.
Using the Ant View: In my Java or Debug mode, I like to show the Ant View so I can quickly run Ant tasks. This view can be found through Window Ant. Put the Ant view in the corner of the screen and add the build.xml file via the "Add à Other à Show View à Buildfiles" button. In version 3.1, the Ant debug scripting language is even supported.
Automatically iterate over a collection: for + Control-Space: If you don't know it yet, then you should remember that Control-Space is an autocomplete feature. In Eclipse, you can also autocomplete structures. Inside an array or collection, try typing "for" and pressing Control-Space. Eclipse will ask you which collection you want to iterate over and automatically complete the loop code.
Use hierarchical layout: The default layout (flat) in the Package Explorer view confuses me, it shows the full name of the package in the navigation tree. I prefer a package and filesystem view of my source, called Hierarchical Layout in Eclipse. To switch to this mode, click the down button in the package browser view, select Layout, then Hierarchial.
Show multiple files at once: You can browse multiple files at once. Drag an inactive edit window to the bottom or side scroll bar of the active window to open the edit window. This is the best way I can describe the trick.
Open two Eclipses at the same time: To merge changes from one CVS branch to the other, I like to do it by opening two different Eclipses at the same time in the Workspace. This way I can see all the changes by comparing the latest version on CVS (right click on the project and choose Compare Lastest from HEAD) and then merge each change into another CVS branch. The easiest way to launch multiple Eclipses is to use Eclipseàwith Launcher.
Implementors plugin: Installs a plugin that can jump to an implementation of an interface. If you're a dependency injection fan, or are working on well-written interfaces, then you need a plugin like this to speed up code navigation. You can find this plugin at SourceForge.
Automatically generate getter and setter methods: in the corresponding POJO, right-click on the blank space, select [Source], then select [Generate Getters and Setters], then select which properties to generate such methods for, and click [OK] to be OK , especially when there are a lot of member variables, it saves time.
Attached is a collection of Eclipse shortcut keys:
Ctrl+1 quick fix (the most classic shortcut, needless to say)
Ctrl+D: delete the current line
Ctrl+Alt+↓ copy the current line to the next line (copy increase)
Ctrl+Alt+↑ Copy the current line to the previous line (copy and increase)
Alt+↓ Interaction position between the current line and the next line (especially practical, you can save the first cut and paste)
Alt+↑ The current line and the above line interactive position (same as above)
Alt+← Previous Edited page
Alt+→ Next edited page (of course for the above one)
Alt+Enter Display the properties of the currently selected resource (project, or file or file)
Shift+Enter Insert a blank line in the next line of the current line (the mouse can be anywhere in the current line, not necessarily the last)
Shift+Ctrl +Enter inserts a blank line in the current line (the principle is the same as the previous one)
Ctrl+Q locates the last edit place
Ctrl+L locates in a certain line (good news for those with more than 100 programs)
Ctrl+M maximizes the current Edit or View (press again and vice versa)
Ctrl+/ Comment the current line, press again to uncomment
Ctrl+O Quickly display OutLine
Ctrl+T Quickly display the inheritance structure of the current class
Ctrl+W Close the current Editor
Ctrl+K Refer to the selected Word to quickly navigate to Next
Ctrl+E Quickly display the drop-down list of the current Editor (if the current page is not displayed in bold)
Ctrl+/(keyboard) Collapse all codes in the current class
Ctrl+×(keyboard) Expand all codes in the current class
Ctrl +Space The code assistant completes some code insertion (but generally it conflicts with the input method, you can modify the hotkey of the input method, or you can temporarily use Alt+/ instead)
Ctrl+Shift+E Display the management of all currently opened Views (you can choose to close, activate, etc.)
Ctrl+J Forward incremental search (after pressing Ctrl+J, each letter editor you enter provides quick matching to locate a word, if not, in the It is displayed in the stutes line that it is not found. When looking up a word, it is very useful. Idea has this function two years ago)
Ctrl+Shift+J Reverse incremental search (same as the previous one, but from back to front)
Ctrl+Shift+F4 Close all open editors
Ctrl+Shift+X Change all the currently selected text to lowercase
Ctrl+ Shift+Y Change all the currently selected text to lowercase
Ctrl+Shift+F Format the current code
Ctrl+Shift+P Position to the matching character (such as {}) (when positioning from the front to the back, the cursor should be inside the matching character , from the back to the front, and vice versa)
The following shortcut keys are commonly used in refactoring, and I like to sort out the ones I like and commonly use (Note: The shortcut keys for general refactoring all start with Alt+Shift)
Alt+Shift+ R Rename (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 Extraction method (this is one of the most commonly used 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)
Alt+Shift+L Extract local variables (you can directly put some Extract magic numbers and strings into a variable, especially when multiple calls)
Alt+Shift+F Change the local variable in the Class into a field variable (a more practical function)
Alt+Shift+I Merge variables (may say so A bit inappropriate Inline)
Alt+Shift+V Move functions and variables (not very common)
Alt+Shift+Z Refactoring regret medicine (Undo)
Please indicate - Author: Java My Life (Chen Leixing) The original source http://blog.csdn.net/chenleixing/article/details/44600587

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326434263&siteId=291194637