Eclipse常用快捷键

导航

搜索资源

快捷键: Ctrl + Shift + R

作用:搜索并打开文件, 支持通配符?*搜索




编辑器切换

快捷键:Ctrl + E

切换编辑器 ctrl e 或者 ctrl PageDown 或者ctrl PageUp

ctrl e 可以弹出一个小框在里面选择需要的文件,

ctrl PageDown和ctrl PageUp在当前编辑器的下一个和前一个之间切换


关闭编辑器

快捷键:Ctrl + W 或者 Ctrl + F4

全部关闭可以使用 ctrl shift w 或者ctrl shift F4


最大化编辑器

快捷键: Ctrl + M

如果想专心致志的写代码,最大化当前编辑器是个不错的主意,再ctrl M就可以回到正常的多窗口模式.


搜索文件中的字符串

快捷键:Ctrl + H



查看大纲 

快捷键: Ctrl + O

这个快捷键会列出当前文件的功能单元,宏定义,文件引入,类,函数,变量等等。



转到函数定义的地方

快捷键:F3

示例图:


回到上次浏览的地方 

快捷键:Alt + Left

注释:一个回家键,当你有F3走到很远的地方的时候,alt Left可以带你一步一步回退。

F3: A() -> B() -> C()
Alt Left: C() -> B() -> A()

函数调用链

快捷键:Ctrl + Alt + H

注释:选中一个函数, 按住Ctrl + Alt + H 可以在call architecture窗口中显示函数调用链,非常利于分析代码



单词定位

快捷键: Ctrl + K 或者 Ctrl + Shift + K

示例图:


编辑

大小写转换

快捷键:CTRL + SHIFT + X 以及 CTRL + SHIFT + Y


注释

快捷键:CTRL + /


取消注释

快捷键:CTRL + \ 或者 CTRL + SHIFT + /


复制一行

快捷键:CTRL + ALT + DOWNARROW


格式化代码

快捷键:CTRL + SHIFT + F


多个编辑器同时显示

用鼠标拖到想要分屏显示的窗口(该窗口当前没有显示,不是激活状态)到激活窗口的底部或者右侧,可以分频显示,

这个选项可以同时参考2分文件的代码做对比





官方文档

===================================================================================================

File actions

New Create a Java element or a new resource. Configure which elements are shown in the submenu in Window > Customize Perspective. In a Java perspective, by default action for creating a project, package, class, interface , source folder, scrapbook, file and folder are available. Ctrl + N
Close Close the current editor. If the editor contains unsaved data, a save request dialog will be shown. Ctrl + F4
Close All Close all editors. If editor contains unsaved data, a save request dialog will be shown. Ctrl + Shift + F4
Save Save the content of the current editor. Disabled if the editor does not contain unsaved changes. Ctrl + S
Save As Save the content of the current editor under a new name.  
Save All Save the content of all editors with unsaved changes. Disabled if no editor contains unsaved changes. Ctrl + Shift + S
Print Prints the content of the current editor. Enabled when an editor has the focus. Ctrl + P
Properties Opens the property pages of the select elements. Opened on Java projects the Java Build Path page and the Javadoc Location page are available. For JAR archives, configure the JAR's Source Attachment and Javadoc Location here. Alt + Enter

Edit actions

Undo Revert the last change in the editor Ctrl + Z
Redo Revert an undone change Ctrl + Y
Cut Copies the currently selected text or element to the clipboard and removes the element. On elements, the remove is not performed before the clipboard is pasted. Ctrl + X
Copy Copies the currently selected text or elements to the clipboard Ctrl + C
Paste Paste the current content as text to the editor, or as a sibling or child element to the a currently selected element. Ctrl + V
Delete Delete the current text or element selection. Delete
Select All Select all the editor content.. Ctrl + A
Find / Replace Open the Find / Replace dialog. Editor only. Ctrl + F
Find Next Finds the next occurrence of the currently selected text. Editor only. Ctrl + K
Find Previous Finds the previous occurrence of the currently selected text. Editor only. Ctrl + Shift + K
Incremental Find Next Starts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only. Ctrl + J
Incremental Find Previous Starts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only. Ctrl + Shift + J
Add Task Add a user defined task to the current text selection or selected element. Alt + Enter
Expand Selection to Enclosing Element: Selects the enclosing expression, block, method in the code. This action is aware of the Java syntax. It may not function properly when the code has syntax errors. (Arrow Up). Alt + Shift + Arrow Keys
Next Element: Selects the current and next element. (Arrow Right)
Previous Element: Selects the current and the previous element (Arrow Left)
Restore Last Selection: After an invocation of Expand Selection to restore the previous selection. (Arrow Down)
Show Tooltip Description Shows the value of a hover that would appear at the current cursor location. The dialog shown is scrollable and does not shorten descriptions. F2
Content Assist Opens a context assist dialog at the current cursor position to bring up Java code assist proposals and templates. See the Templates preference page for available templates (Window > Preferences > Java > Editor > Templates) and go to the Editor preference page (Window > Preferences > Java > Editor > Code Assist) for configuring the behavior of code assist. Ctrl + Space
Quick Fix If the cursor is located at a location with problem indication this opens a context assist dialog at the current cursor to present possible corrections. Ctrl + 1
Parameter Hints If the cursor is located at the parameter specification for method reference, this actions shows a hover with parameter types information.The parameter at the current cursor location is shown in bold. Ctrl + Shift + Space

Navigate actions

Open Tries to resolve the element referenced at the current code selection and opens the file declaring the reference. F3
Open Type HierarchyTries to resolve the element referenced at the current code selection and opens the element in the Type Hierarchy view. Invoked on elements, opens the type hierarchy of the element. Supported in the Java editor and views showing Java elements. F4
Open External Javadoc Opens the Javadoc documentation of the currently selected element or text selection. The location of the Javadoc of a JAR or a project is specified in the Javadoc Location property page on projects or JARs. Note that this external Javadoc documentation may not be up to date with the Javadoc specified in the current code. You can create Javadoc documentation for source files in a Java project using the Javadoc export wizard. Shift + F2
Open Type Brings up the Open Type selection dialog to open a type in the editor.The Open Type selection dialog shows all types existing in the workspace. Ctrl + Shift + T
Open Type In HierarchyBrings up the Open Type selection dialog to open a type in the editor and the Type Hierarchy view. The Open Type selection dialog shows all types that exist in the workspace. Ctrl + Shift + H
Show Outline Opens the lightweight outliner for the currently selected type. Ctrl + O
Go to Next Problem Selects the next problem. Supported in the Java editor. Ctrl + . (Period)
Go to Previous Problem Selects the previous problem. Supported in the Java editor. Ctrl + , (Comma)
Go to Last Edit Location Reveal the location where the last edit occurred. Ctrl + Q
Go to Line Opens an a dialog which allows entering the line number to which the editor should jump to. Editor only. Ctrl + L

Search actions

Search... Opens the search dialog Ctrl + H
Occurrences in File Finds all occurrences of the selected Java element in its file Ctrl + Shift + U

Project actions

Build All Builds the all projects in the workspace. This is an incremental build, means that the builder analyzes the changes since the last time of build and minimizes the number of changed files. Ctrl + B

Source actions

Comment Comments out all lines containing the current selection. Ctrl + /
Uncomment Uncomments all lines containing the current selection. Ctrl + \
Indent Indent current line. Ctrl + I
Shift Right Increments the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. Tab
Shift Left Decrements the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. Shift + Tab
Format Uses the code formatter to format the current text selection. The formatting options are configured on the Code Formatter preference page (Window > Preferences > Java > Code Formatter) Ctrl + Shift + F
Organize Imports Organizes the import declarations in the compilation unit currently open or selected. Unnecessary import declarations are removed, and required import declarations are ordered as specified in the Organize Import preference page (Window > Preferences > Java > Organize Import). Organize import can be executed on incomplete source and will prompt you when a referenced type name can not be mapped uniquely to a type in the current project. You can also organize multiple compilation units by invoking the action on a package or selecting a set of compilation units. Ctrl + Shift + O
Add ImportCreates an import declaration for a type reference currently selected. If the type reference if qualified, the qualification will be removed if possible. If the referenced type name can not be mapped uniquely to a type of the current project you will be prompted to specify the correct type. Add Import tries to follow the import order as specified in the Organize Import preference page.Ctrl + Shift + M

Refactor actions

Undo Does an Undo of the last refactoring. The refactoring undo buffer is only valid as long as no other source changes than refactoring have been performed. Alt + Shift + Z
Redo Does a Redo of the last undone refactoring. The refactoring undo/redo buffer is only valid as long as no other source changes than refactoring have been performed. Alt + Shift + Y
Rename Starts the Rename refactoring dialog: Renames the selected element and (if enabled) corrects all references to the elements (also in other files). Is available on methods, fields, local variables, method parameters, types, compilation units, packages, source folders, projects and on a text selection resolving to one of these element types. Alt + Shift + R
Move Starts the Move refactoring dialog: Moves the selected elements and (if enabled) corrects all references to the elements (also in other files). Can be applied to one instance method (which can be moved to a component), one or more static methods, static fields, types, compilation units, packages, source folders and projects and on a text selection resolving to one of these element types. Alt + Shift + V
Inline Starts the Inline refactoring dialog. Inlines local variables, methods or constants. This refactoring is available on methods, static final fields and text selections that resolve to methods, static final fields or local variables. Alt + Shift + I
Extract Method Starts the Extract Method refactoring dialog. Creates a new method containing the statements or expression currently selected and replaces the selection with a reference to the new method. You can use Expand Selection from the Edit menu to get a valid selection range. This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods. Alt + Shift + M
Extract Local VariableStarts the Extract Variable refactoring dialog. Creates a new variable assigned to the expression currently selected and replaces the selection with a reference to the new variable. This refactoring is available on text selections that resolve to local variables. You can use Expand Selection from the Edit menu to get a valid selection range.Alt + Shift + L

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值