Eclipse常用快捷键

来源:互联网 发布:数据库 oltp olap 编辑:程序博客网 时间:2024/06/06 13:05

导航

搜索资源

快捷键: 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

NewCreate 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 + NCloseClose the current editor. If the editor contains unsaved data, a save request dialog will be shown.Ctrl + F4Close AllClose all editors. If editor contains unsaved data, a save request dialog will be shown.Ctrl + Shift + F4SaveSave the content of the current editor. Disabled if the editor does not contain unsaved changes.Ctrl + SSave AsSave the content of the current editor under a new name. Save AllSave the content of all editors with unsaved changes. Disabled if no editor contains unsaved changes.Ctrl + Shift + SPrintPrints the content of the current editor. Enabled when an editor has the focus.Ctrl + PPropertiesOpens 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

UndoRevert the last change in the editorCtrl + ZRedoRevert an undone changeCtrl + YCutCopies 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 + XCopyCopies the currently selected text or elements to the clipboardCtrl + CPastePaste the current content as text to the editor, or as a sibling or child element to the a currently selected element.Ctrl + VDeleteDelete the current text or element selection.DeleteSelect AllSelect all the editor content..Ctrl + AFind / ReplaceOpen the Find / Replace dialog. Editor only.Ctrl + FFind NextFinds the next occurrence of the currently selected text. Editor only.Ctrl + KFind PreviousFinds the previous occurrence of the currently selected text. Editor only.Ctrl + Shift + KIncremental Find NextStarts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only.Ctrl + JIncremental Find PreviousStarts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only.Ctrl + Shift + JAdd TaskAdd a user defined task to the current text selection or selected element.Alt + EnterExpand Selection toEnclosing 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 KeysNext 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 DescriptionShows the value of a hover that would appear at the current cursor location. The dialog shown is scrollable and does not shorten descriptions.F2Content AssistOpens 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 + SpaceQuick FixIf 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 + 1Parameter HintsIf 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

OpenTries to resolve the element referenced at the current code selection and opens the file declaring the reference.F3Open 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.F4Open External JavadocOpens 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 + F2Open TypeBrings 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 + TOpen 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 + HShow OutlineOpens the lightweight outliner for the currently selected type.Ctrl + OGo to Next ProblemSelects the next problem. Supported in the Java editor.Ctrl + . (Period)Go to Previous ProblemSelects the previous problem. Supported in the Java editor.Ctrl + , (Comma)Go to Last Edit LocationReveal the location where the last edit occurred.Ctrl + QGo to LineOpens 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 dialogCtrl + HOccurrences in FileFinds all occurrences of the selected Java element in its fileCtrl + Shift + U

Project actions

Build AllBuilds 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

CommentComments out all lines containing the current selection.Ctrl + /UncommentUncomments all lines containing the current selection.Ctrl + \IndentIndent current line.Ctrl + IShift RightIncrements the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line.TabShift LeftDecrements the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line.Shift + TabFormatUses 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 + FOrganize ImportsOrganizes 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 + OAdd 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

UndoDoes 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 + ZRedoDoes 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 + YRenameStarts 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 + RMoveStarts 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 + VInlineStarts 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 + IExtract MethodStarts 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 + MExtract 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

原创粉丝点击