`
ppju
  • 浏览: 79754 次
  • 性别: Icon_minigender_1
  • 来自: 西安
文章分类
社区版块
存档分类
最新评论

eclipse 快捷键

阅读更多
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快捷键 idea导入用 keymap.zip

    标题中的“eclipse快捷键 idea导入用 keymap.zip”表明这是一个关于在IntelliJ IDEA(简称IDEA)中导入Eclipse快捷键设置的资源。这个压缩包包含了一个名为“eclipse-keymap.jar”的文件,该文件是用于将Eclipse的...

    eclipse 快捷键图片可做桌面(绝对原创)

    将Eclipse快捷键壁纸设为桌面,不仅可以帮助初级开发者熟悉并记住这些高效的操作方式,对于经验丰富的开发者来说,也是一个不错的提醒工具,特别是在处理多任务或者切换不同IDE时,能够快速找回特定的快捷键。...

    Eclipse快捷键壁纸大图

    "Eclipse快捷键壁纸大图"通常是一张包含众多Eclipse常用快捷键的大图,旨在帮助开发者快速记忆和使用这些快捷键,从而提升开发速度。 Eclipse的快捷键可以分为多种类型,包括编辑、导航、搜索、重构、调试等。以下...

    如何配置Eclipse快捷键

    下面将详细介绍如何配置Eclipse快捷键。 首先,打开Eclipse IDE。在主菜单栏上选择“Window”选项,然后在下拉菜单中找到并点击“Preferences”。这将打开一个新的窗口,展示Eclipse的偏好设置。 在左侧的树形目录...

    IntelliJ IDEA中的Eclipse快捷键插件

    在这种情况下,"IntelliJ IDEA中的Eclipse快捷键插件"就显得尤为重要,它允许用户在IntelliJ IDEA中使用与Eclipse相同的快捷键,从而提高工作效率并减少学习新IDE的过渡期。 这个插件的主要目标是为Eclipse的忠实...

    Eclipse快捷键大全.

    ### Eclipse 快捷键大全详解 #### 一、编辑与操作类快捷键 **Ctrl+1**:自动修复代码中的错误或警告。 **Ctrl+D**:删除当前行。 **Ctrl+Alt+Shift+Enter**:在当前行下方创建新行。 **Alt+Down/Up**:移动当前...

    IDEA快捷键转Eclipse快捷键(jar包)

    对于那些习惯于Eclipse快捷键的开发人员,当切换到IDEA时,可能会面临学习新快捷键的困扰。为了解决这个问题,有一个名为“IDEA快捷键转Eclipse快捷键(jar包)”的资源应运而生。 这个资源是一个jar包,它的主要...

    eclipse快捷键jar.rar

    1、导入keymap的jar包 file——>import Settings… 选中该选项(默认已选中)——>再点击ok ...重启。 2.重启后,进入file——>settings——>keymap中就可以看到Eclipse_wyj了,我们选中它,然后应用ok

    IDEA转Eclipse快捷键的jar包

    标题中的"IDEA转Eclipse快捷键的jar包"是一款专为解决这一问题设计的工具。它允许用户在Eclipse中模拟IntelliJ IDEA的快捷键设置,使得那些已经熟悉IDEA快捷键的开发者能在Eclipse中无缝切换,提高开发效率,减少...

    Eclipse快捷键壁纸.zip

    这款名为"Eclipse快捷键壁纸"的压缩包文件显然是为了帮助那些想要提升编程效率、尤其是初学者,通过壁纸的形式直观地学习和记忆Eclipse的常用快捷键。 Eclipse快捷键通常分为几个主要类别,包括编辑、导航、搜索、...

    Eclipse 快捷键 完整版

    熟练掌握Eclipse快捷键是每一个程序员提升开发速度的关键步骤。以下是一些主要的Eclipse快捷键及其用途: 1. **Ctrl+1**:快速修复。当Eclipse检测到代码中有错误或警告时,此快捷键可以快速提供解决方案。 2. **...

    eclipse快捷键

    eclipse 快捷键;常用的Eclipse快捷键; eclipse 快捷键;常用的Eclipse快捷键

    Eclipse快捷键大全.pdf

    本文将根据提供的“Eclipse快捷键大全.pdf”文件中的内容,详细介绍这些快捷键的功能与应用场景。 #### 二、基本编辑操作 1. **快速修复**:`Ctrl+1` - 当代码出现错误或警告时,按下此快捷键可快速弹出修复选项。...

    IDEA使用eclipse快捷键

    IDEA中导入eclipse的快捷键。对于使用习惯了eclipse快捷键的朋友有帮助。

    eclipse快捷键桌面壁纸,就做了一张,也是参考别人的快捷键

    eclipse快捷键桌面壁纸,根据多年使用eclipse经常使用的快捷键,做了一张eclipse快捷键壁纸,希望能够帮到你

    Eclipse快捷键大全.txt

    ### Eclipse快捷键大全知识点 #### 一、编辑与操作类快捷键 **1. 基础编辑操作** - **Ctrl+D**: 删除当前行 - **Ctrl+Shift+X**: 将当前选中的文本全部转换为大写 - **Ctrl+Shift+Y**: 将当前选中的文本全部转换为...

    Eclipse快捷键大全,Eclipse快捷键

    Eclipse快捷键大全,Eclipse快捷键

Global site tag (gtag.js) - Google Analytics