<script type="text/javascript"> </script>
希望通过介绍Eclipse集成开发环境中的一些基本设置和快捷键, 使开发人员能够快速进入工作状态.
IDE
- 常用的窗口: Package Explore, Outline
- Ctrl+Shift+L: Show all key assists. 显示所有的快捷键.
Project
- 可以通过Project->Properties->Java Build Path->Source->Link Source来关联外部的代码目录.
- 可以Project->Properties->Java Build Path->Source->Browse来修改默认输出目录
Editor
- Ctrl+Space: Show completion (also templates). 显示自动完成.
- Ctrl+E or Ctrl+Shift+E: Switch to an opened Editor. 输入文件名, 切换到一个已经打开的编辑窗口.
- 可以通过Window->Preferences->Java->Code Style来配置代码格式或导入已有格式.
- Ctrl+Shift+F: Format the selected text. 格式化选中的内容.
- Ctrl+Shift+O: Evaluate all required imports and replace the current imports. 重新组织imports.
- Ctrl+1: Suggest possible fixes for a problem. 查看当前问题/错误的可能的解决方法.
- Ctrl+L: Go to line. 跳到某一行.
- Ctrl+/: Toggle comment the selected lines. 注释选中的内容或取消注释.
- Ctrl+D: Delete the current line or selected lines. 删除当前行或者选中的多行内容.
- Ctrl+Up/Down: Scroll up/down the current line or selected lines. 上下移动一行或选中的多行内容.
- Shift+Tab or Alt+Shift+Tab: Ident a region. 对选中区域进行缩进.
Search
- Ctrl+G: Search for declarations of the selected element in the workspace. 在工作区内查找选中元素的所有声明.
- Ctrl+Shift+G: Search for references to the selected element in the workspace. 在工作区内查找选中元素的所有引用.
- Ctrl+H: Open Search Dialog. 打开多文件查找对话框.
- Ctrl+J or Ctrl+Shift+J: Incremental find or reserve find in a file. 增量向下查找或增量向上查找.
- Ctrl+F: 打开单文件查找对话框.
- Ctrl+K or Ctrl+Shift+K: Find next or find previous item. 查找下一个或上一个.
Browing Code
- Ctrl+T: Show the quick hierarchy of the selected element. 查看当前元素(类,函数等)的继承/重载关系.
- Ctrl+Shift+T: Open a type in a Java Editor. 快速打开工作区中的某个类. (支持模糊匹配)
- Ctrl+Shift+R: Open an editor on a particular resource. 快速打开工作去中的一个资源文件(.xml, .txt). (支持模糊匹配)
- Ctrl+O: Show the quick outline for the editor input. 快速跳转到当前文件中的某个成员.
- Hold Ctrl then Click one item: 跳转到一个item的定义.
Debug
- F11: Run Debug
- F5: Step in
- F6: Step over
- F8: Resume
Refactoring
- Alt+Shift+R: Rename
- Alt+Shift+V: Move
- 可以在右键菜单中选择:
- Generate getters/setters: 自动生成getters/setters
- Generate constructor with fields: 自动生成constructor
- Override/implement methods: 重载/实现父类方法
Source Control
- SVN plug-in: http://subclipse.tigris.org/install.html