`
wutheringsea
  • 浏览: 258858 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Eclipse常用快捷键(英文整理版)及常用设置

    博客分类:
  • Java
阅读更多

CTRL + D

Delete row. Try it! You no more need to grab the mouse and select the line, no more Home, Shift + End, Delete. Quick and clean.

ALT + Up/Down Arrow

Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all. Notice, that it will be always correctly indented.

ALT + Left/Right Arrow

Move to the last location you edited. Imagine you just created a class Foo, and now you are working on a class Boo. Now, if you need to look at the Foo class, just press Alt+Left Arrow. Alt+Right Arrow brings you back to Boo.

CTRL+SHIFT+O

Organize imports. What happens when you first use a class you have not yet imported? You will see an error. But when you press this magical combination, all your missing classes will be imported, and the unused imports will vanish.

CTRL+1

Probably the most useful one. It activates the quick fix. Imagine you create a class, which implements some interface. You will get an error, because the inherited methods are not yet implemented. While you are on line where the error occurs, press this combination to activate the quick fix. Now, select the "Add unimplemented methods" option. You can use the quick fix at every error you ever receive.

Quick fix comes handy in other situations too. My favorite is the "Split variable declaration". Sometimes I need to broaden the scope of a variable. I activate the quick fix, split declaration, and use alt + arrow to put it where it belongs. You can find even more usages: Convert local variable to field, rename in file, Inline local variable..

You could use the "Split variable declaration" on the bar variable, and then move it with Alt+Arrows above the try block..

Or you could use the "Add unimplemented methods" fix here.

The best thing you can do if you see an error is to use the quick fix.

CTRL+SHIFT+T

Open Type. Imagine, that you need to have a look at the Foo class. But, where is the Foo class? Is it in the Boo project and in the foo.bar package? Or somewhere else? With this shortcut, you don't need to know. Just press it, type Foo and you are in.

CTRL+E

Shows you a list of all open editors.


CTRL+F6

Use to move between open editors. This is an slower alternative to Ctrl + E. Comes handy in a situation when you want to periodically switch between two editors, something, what is nearly impossible with Ctrl+E as it sorts entries quite randomly. Or you might just use Alt+Arrows..

CTRL+F7

Move between views. When in editor, press Ctrl+F7 to switch to the Package Explorer, or hold Ctrl and press F7 multiple times to switch to other views.

CTRL+F8

Move between perspectives. The same as previous.


CTRL + F11


Runs the application. What gets launched depends on your settings. It will either launch the last launched class (my preffered way) or it will launch currently selected resource (the default way). If you want to change its behavior read the previous post.

CTL + N


Open new type wizard. This is not very quick because you have to select the wizard type (weather you want to create new class, jsp, xml or something else) in the next step. Much faster way would be if you could just hit the shortcut and invoke the particular wizard. It is possible, just keep reading..

CTRL + M

Maximize or umaximize current tab.

CTRL + I


Corrects indentation.

CTRL + SHIFT + F

Formats code. You can make a beautiful looking code out of a mess with this. It requires a bit of setup, but it is well worth it. You can find its settings under Window->Preferences->Java->Code style->Formatter

CTRL + J


Incremental search. Similar to the search in firefox. It shows you results as you type. Don't be surprised, if you hit this combination, nothing happens - at the first glance. Just start typing and eclipse will move your cursor to the first ocurence.

CTRL + SHIFT + L

Shows you a list of your currently defined shortcut keys.

I don't like your shortcuts

Such is life nowadays. Remember, you can always change those bindings to match your preferences. Open Windows->Preferences->General->Keys. Now you can use the filter to find your shortcut and change its binding.
The real fun begins when you cannot find the command you are looking for. The key here, is to have the "Include unbounds commands" checkbox checked. It will show you all commands, even those, which have no keys bound.

While you are here, I recommend to add the following bindings:

CTRL+SHIFT+G

Bind this to "Generate getters and setters". This is a "must have".

ALT+C

Bind this to SVN/CVS "Commit".

ALT+U


Bind this to SVN/CVS "Update".

Now, type "new" (without quotes) in the filter text. You should see a list of all new type wizards. Choose the most frequently used and assign them a shortcut. For example, the most used wizard for me is the new class wizard. Thus I assigned it the CTRL+SHIFT+N keys.

Let me demonstrate a quick way to create new class now.

Hit CTRL + SHIFT + N (or the combination you assigned in the previous step). This should bring up new class wizard. Type in the name and press ALT+E. You can now select a class which will be a superclass for the newly created class. Hit ALT+A and select all implemented interfaces . Now hit ALT+F and your class will be generated. Eclipse will also provide the default implementation for all abstract and interface methods you inherited.

Did you notice the weird underscores everywhere in the dialog? They give you a hint about the shortcut key. Hit ALT and the underlined letter to press the button, check the checkbox or get focus for a textfield.

Did you notice the underscores?

I think that using shortcut keys is the fastest way to productivity and if not, then at least your wrists will say you a silent thanks. Now, don't wait, go on and assign keys to the features you use most.

One final tip from Andriy:

The problem is that there are so many keyboard shortcuts. I used to keep a printout with all the shortcuts I wanted to use. Finally I wrote an Eclipse plugin MouseFeed, which reminds the keyboard shortcuts for the actions called with mouse. You can even tell it to enforce some shortcuts - the action will run only if called with a keyboard shortcut.

So if you are struggling with yourself, if you want to use shortcuts, but always subconsciously touch the mouse, install the plugin and let it enforce the shortcuts - the mouse will be useless and you will be forced to use keyboard.

What shortcuts do you use?

 

CTRL+ALT+H Open Call Heirarchy. Find out where that method is used.

F4 Open Type Heirarchy. See the subclasses and/or superclasses. This one can be tricky sometimes. If there is a class under the cursor it will open that class's heirarchy, if not it will use the class that contains the cursor (including inner classes).

F3 Open Declaration. Jump to the declaration of the variable, method or class. It will try to find the most specific declaration it can for methods, but depending on your code you might end up in an Interface which is probably not what you want. Then just press F4 to get the type heirarchy and find the implementation you are looking for.

ALT+SHIFT+R Refactor->Rename. Works in the editor and in the package explorer. If you haven't learned the power of refactoring, do so now. Think of this one as a super-smart Find-Replace. The new 3.3 feature of inline rename is awesome.

ALT+SHIFT+V Refactor->Move. Again, works in both the edtor and package explorer. Move the method or field to another class.

ALT+SHIFT+M Extract to method. Break up that monolithic code, takes the selection and trys to make it into a method. Will optionally find duplicate code blocks and use the new method there as well. It might take a few trys to get this to work the way you want. Just try it, rearrange thee code a little and try again.

 

Europa version CTRL + 3 

It is an entry point for pratically everything inside Eclipse, fantstic in my opinion and very useful.

Go to line number N in the source file: Ctrl + L, enter line number

 

 

============================分割线===========================

Eclipse常用设置

设置工作空间的项目编码, 防止出现乱码 
    Window - Preferences - General - Workspace 
    将"Text file encoding"选为"Other" - "UTF-8" 
    改变现有项目的编码的步骤: 右击项目属性, 选择"Text file encoding"的编码 

设置其它文件的编码 
    Window -> Preferences -> General -> Content Types 
    将需要设置的文件设置编码, 最好统一设为UTF-8 
    设置后, 如Javascript文件可正常显示中文 

设置创建JSP页面时,将JSP的默认编码设为UTF-8 
    Window -> Preferences -> MyEclipse -> Files and Editors -> JSP 
    将"Encoding"选为"ISO10646/Unicode(UTF-8) 

去掉格式化JSP时页面中的空行 
    Window -> Preferences -> MyEclipse -> HTML -> HTML Source 
    勾选"Clear all blank lines" 

增强Eclipse的自动代码提示功能 
    默认下, 只有按"."或"Alt + /"才出现代码提示功能, 不够强大, 作小小设置, 可将代码提示功能像VS的一样方便 
    1. Window -> Preferences -> Java -> Editor -> Content Assist 
    2. 将"Auto Activation triggers for java"设置为".abc"(默认是"."), 点"Apply"应用 
    3. 导出目前的Eclipse配置文件: File -> Export -> General -> Perferences, 选择保存路径, 保存得到*.epf文件 
    4. 用文本编辑器打开刚才保存的*.epf文件, 搜索".abc", 将".abc"部分改为 
        ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(," (以上为自动提示的触发字符, 
        根据个人习惯设置), 保存此配置文件(个人觉得不太好用,容易出错) 
    5. 导入此配置文件: File -> import -> General -> Perferences, 导入修改后的配置文件. 

    第一个选项为反应时间,可设为100左右(默认200) 

高亮类中同一引用的使用位置 
    Window -> Perferences -> General - > Editors -> TextEditors -> Annotations 
    选择"Occurrences",勾引"Text as" -> "Highlighted"(块高亮)或"Squiggles"(虚线) 

Link with Editor 
    打开类后, 自动在包管理器这里显示类的位置 
    


取消Myeclipse的自动文件验证(卡傻的原因) 
    Windows –> Perferences –>Myeclipse –> Validation 
    保留manual(手动)部分,build下只留"classpath dependency Validator" 

    手动验证: 右键文件 -> Myeclipse -> Run Validation 

取消拼写错误检查 
    我爱故意写错单词, 不需要系统帮我检查 
    Windows –> perferences –> General –> Editors-> Text Editors -> Spelling 
    去掉"Enable spell checking"勾选 

关闭不需要的启动项 
    MyEclipse: 
    Windows –> Perferences–> General–> Startup and Shutdown 

    我只保留了 

    
    
    顺序下来: 
    1, Tomcat6: 必备的... 
    2, 内存监视器: 可以查看Myeclipse的使用内存, 我喜欢这工具(在菜单Myeclipse - Utilities - Show Heap Status打开) 
    3, JSP Debug工具, 其实我也没用过, 怕有一天用到... 
    4, 文件创建向导(个人经常用到) 
    5, 向后兼容的意思吧, 怕有一天会用到, 但其实很少用, 可去掉 
    6, 透视图, 应该可以去掉吧... 

    其实就只用选择Tomcat6 

关闭自动更新 
    1, Eclipse: 
        Windows –> Perferences–> Install/Update -> Automatic Updates 
        不勾选"Automatically find new updates and notify me" 

    2, Myeclipse: 
        1)Windows –> Perferences–> MyEclipse... -> Community Essentials 
     &nb sp;  不勾选"Search for new features at startup" 
        2)Windows –> Perferences–> MyEclipse... -> Maven4MyEclipse 
        不勾选"Download repository index updates on startup" 

原文:http://yafei.iteye.com/blog/1218507

分享到:
评论

相关推荐

    eclipse常用快捷键说明

    eclipse 快捷键 整理过的eclipse 快捷键,希望对大家的使用和学习有帮助

    eclipse快捷键整理

    对eclipse常用快捷键进行了整理,满足日常开发使用。使用eclipse版本为4.2.

    android开发中常用的Eclipse快捷键详细整理

    android开发中常用的Eclipse快捷键详细整理,本人试过了都比较实用,很好

    eclipse 3.7.1/3.5所有版本快捷键 (大全 )

    整理的常用的eclipse快捷键 比较重要的都有重点标注和描述 提高开发效率必不可少

    eclipse最常用的快捷键

    这是我个人从网上整理出来的快捷键,日常很常用的列在这里。而且比较清晰,欢迎大家下载。在eclipse提高开发效率

    Eclipse快捷键整理

    Eclipse常用的快捷键

    Eclipse默认快捷键

    Eclipse常用快捷键,加入个人整理。

    Eclipse快捷键.

    Eclipse快捷键.整理了常用的,和一些不太常用的快捷键。为初学者,提供便利。可以提高开发速度。

    Eclipse快捷键 超重点

    自己整理的,java常用Eclipse 超重点快捷键

    eclipse快捷键大全

    下面的快捷键是重构里面常用的,本人就自己喜欢且常用的整理一下(注:一般重构的快捷键都是Alt+Shift开头的了) Alt+Shift+R 重命名 (是我自己最爱用的一个了,尤其是变量和类的Rename,比手工方法能节省很多劳动力) ...

    Eclipse、MyEclipse快捷键使用大全

    Eclipse、MyEclipse快捷键使用大全,基本上完整的快捷键做了一个汇总,常用的快捷键也做了详细说明。最近整理的,有需要就下载吧

    Eclipse快捷键大全

    针对于使用Eclipse开发的人群,整理了常用的快捷键,掌握了可提升工作效率。

    Eclipse快捷键

    Eclipse有很多快捷键,但是正是因为太多所以不容易记忆,因此这里整理一些比较常用的快捷键,方便大家使用,可能以下对某些快捷键功能介绍不是太好,所以希望大家能够抽出一些时间,在Eclipse中实际试用一下,这对...

    idea快捷键收集.txt

    刚接触idea的时候跟eclipse的快捷键不一样,总是搞错,特别影响开发效率,现在从idea的文档整理处一些常用的快捷键,在这里记录下,方便随时查看

    eclipse常用的热键

    整理的一些eclipse常用的快捷键.供开发人员使用,以增加开发效率.

    韩顺平 java基础加强笔记整理

    内容包括eclipse常用快捷键,可变参数,枚举,反射,泛型等等

Global site tag (gtag.js) - Google Analytics