Very much content from the internet and known files, I only organize.
1. Ctrl+shift+r: Open Resource
这可能是全部快捷键组合中最省时间的了。这组快捷键能够让你打开你的工作区中不论什么一个文件。而你仅仅须要按下文件名称或mask名中的前几个字母,比方applic*.xml。美中不足的是这组快捷键并不是在全部视图下都能用。
2. Ctrl+o: High-speed outline
假设想要查看当前类的方法或某个特定方法,但又不想把代码拉上拉下,也不想使用查找功能的话,就用ctrl+o吧。它能够列出当前类中的全部方法及属性,你仅仅需输入你想要查询的方法名,点击enter就能够直接跳转至你想去的位置。
3. Ctrl+e: High-speed conversion editor
这组快捷键将帮助你在打开的各个开发模块(编辑器)之间浏览。使用ctrl+page down或ctrl+page up能够浏览前后的选项卡。可是在非常多文件打开的状态下,ctrl+e会更加有效率。
4. Ctrl+2,l: Assigning a value to a local variable
开发过程中,我经常先编写方法,如Calendar.getInstance(),然后通过ctrl+2快捷键将方法的计算结果赋值于一个本地变量之上。 这样我节省了输入类名。变量名以及导入声明的时间。
Ctrl+F的效果相似。只是效果是把方法的计算结果赋值于类中的域。
5. Alt+shift+r: Renaming
重命名属性及方法在几年前还是个非常麻烦的事,须要大量使用搜索及替换,以至于代码变得零零散散的。今天的Java IDE提供源代码处理功能。Eclipse也是一样。
如今,变量和方法的重命名变得十分简单。你会习惯于在每次出现更好替代名称的时候都做一次重命名。要使 用这个功能,将鼠标移动至属性名或方法名上,按下alt+shift+r,输入新名称并点击回车。就此完毕。假设你重命名的是类中的一个属性,你能够点击alt+shift+r两次,这会呼叫出源代码处理对话框,能够实现get及set方法的自己主动重命名。
Many other shortcut key combinations can be viewed in eclipse by pressing Ctrl+shift+l.
Some hotkey combinations according to the frequency of use
CONTROL-SHIFT-T: Opens type (open type). Suppose you didn't mean to skiving. Or forget how to open it through the source tree.
With eclipse very easy to open the implementation class of the interface, press CTRL+T to list the implementation class of the interface
Control-shift-r: Open resources (not just for Java files).
Tip: Use the yellow two-headed arrow button in the Navigator view to associate your edit form with the navigator.
This allows you to open files that appear in the hierarchy of the Navigator, which makes it easier to organize your information.
If this affects the speed, turn it off.
F3: Opens the Declaration (open declaration).
Alternatively, use Declaration Tab (in Java view mode, select Windows–> Show view–> Declaration).
When you select a method in the code, then press this button. It will show the whole method in the Declaration box.
Alt-left Arrow: Back in navigation history (Navigation).
Just like a Web browser's Back button, it's especially useful after jumping with F3. (Used to return to the original compiled place)
Alt-right Arrow: Navigates forward in history.
Control-q: Go back to the last editing place. This shortcut is also used when you jump in the code. Especially if you drill too deep. Forget what you were doing in the first place.
CONTROL-SHIFT-G: Search for references in Workspace (reference). This is the premise of refactoring. For the method, the function of this hotkey is exactly the opposite of F3. It puts you in the stack of methods. Up to find all callers of a method. One function associated with this is to turn on the "tagging" feature (occurrence marking). Select windows->preferences->java-> editor-> Mark occurrences and tick the option.
Then. When you click on an element, all of the elements in the code that exist will be highlighted.
I personally only use "Mark local variables" (Mark locally Variables). Note: Too much highlighting slows eclipse.
CONTROL-SHIFT-F: Codeàjavaàpreferencesà format code again according to the style of the code. Our team has a unified code format and we put it on our wiki. To do so. We open eclipse. Select the window style, and then set the Code formatter,code style and organize Imports. Use the export feature to generate a configuration file. We put these profiles on the wiki, and everyone in the team is imported into their eclipse.
Control-o: High Speed Overview (quick outline). With this shortcut, you can quickly jump to a method or property. You just need to enter the first few letters of the name.
control-/: Gazing at or canceling a gaze on a line. Same applies for multiple lines.
Control-alt-down Arrow: Copies the highlighted row or rows.
Alt-down Arrow: Moves one or more lines down. Alt-up Arrow will move up.
The other hotkeys are available in the menu. You can start by pressing CONTROL-SHIFT-L (starting with the 3.1 version). See a list of all the shortcut keys. Press Control-shift-l two times to display the Hotkey dialog box (Keys Preferences dialog), where you can set the hotkey yourself. I welcome your eclipse tips in the talkback section.
Other Eclipse Tips
Lock command Line form: In the command line view (Window->show view->other->basic->console). Try using the SCROLL LOCK button to lock the console output without scrolling.
Using Ant view: In my Java or debug mode, I like to show the ant view so that I can execute the ant task quickly. The view can be found through window ant. Place the ant view in the corner of the screen and add the Build.xml file by adding a compile file (addàotheràshow viewàbuildfiles) button.
In the 3.1 version number. It even supports the Ant debug scripting language.
Take the initiative to traverse a collection: For + control-space: If you do not know yet, then you should remember that Control-space is the active completion of the function.
In Eclipse, you can also take the initiative to complete the structure yourself. In an array or collection range, try entering "for" and then pressing the Control-space key. Eclipse will ask you which collection you want to traverse and then voluntarily complete the loop code.
Using hierarchical layouts: The default layout (flat) way in Package Explorer view is confusing to me. It displays the full name of the package in the Navigation tree (navigation). I prefer the package and file system view of my source code, which is called a hierarchical layout (hierarchical layouts) in eclipse.
To switch to this mode, click the Down button in the package browse view, select Layout, and then select Rating (hierarchial).
Show multiple files at once: You can browse multiple files at once. You can open an edit form that is not activated by dragging it to the bottom or side of the active form on the scroll bar. This is the best way I can describe the trick.
Open two eclipse at the same time: to merge the modifications from one CVS branch to another. I like to do this by opening two working folders (Workspace) different from eclipse at the same time.
This way I can see all the changes by comparing the latest version number on CVS (right-click Project. Then select Compare lastest from HEAD) and then merge each change onto another CVS branch. The simplest way to start multiple eclipse is to take advantage of Eclipseàwith Launcher.
Implementors plugin: Installs a plug-in that can jump to an implementation of an interface. Let's say you're a dependency injection fan, or you're working on a good-writing interface. Then you need a plugin like this to speed up code navigation.
You can find this plugin in SourceForge.
Ctrl+alt+h
If you want to know how a class's methods are called by those other classes, check this method name and press "Ctrl+alt+h".
Eclipse will show which methods this method is called and finally produce a call tree.
1. Ctrl + Left button
This is most commonly used by most people to see the definition of variables, methods, classes
- Ctrl+o
View an outline of a class. Lists its methods and member variables. Tip: Press Ctrl+o again to list the methods and variables inherited by this class.
Help Note: "O", "Outline", "outline"
- Ctrl+t
Look at the inheritance tree of a class, which is top-down, and then press once more ctrl+t, which is replaced by a bottom-up display structure.
Tip: Select a method name and press Ctrl+t. You can see the parent class, subclass, and interface of the method with this name.
Mnemonic: "T" ——-> "tree"-–> "Hierarchy tree"
4.alt+ left and RIGHT ARROW keys
We often encounter cases where the code is CTRL + left, layers are tracked, and then lost in the code. Just press the ALT + LEFT ARROW key
"You can go back to where you were last read. Press ALT + RIGHT ARROW key to advance to the reading position you just returned. Just like the browser's
Forward and Rewind buttons.
Frequently used Eclipse shortcut keys-also suitable for STS