作为一个java开发工作者,工欲善其事必先利其器。我们经常用的就是eclipse 和 IEDA这两个主流的开发工具。使用的一段时间,作为一个使用习惯eclipse转化到IDEA需要知道什么?
1,了解IDEA与eclipse之间概念区别
以是官方文档给出的区别,这样就避免了我们在使用过程出现问题;
2,我们在写代码经常会用到一些文本编辑的快捷,IEDA原生不做任何修改有如下的快捷键:
Eclipse | IntelliJ IDEA | ||
Action | Shortcut | Action | Shortcut |
Code completion | Ctrl+Space | Basic completion | Ctrl+Space |
- | - | Smart completion | Ctrl+Shift+Space |
- | - | Statement completion | Ctrl+Shift+Enter |
Quick access | Ctrl+3 | Search everywhere | Shift x 2 |
Maximize active view or editor | Ctrl+M | Hide all tool windows | Ctrl+Shift+F12 |
Open type | Ctrl+Shift+T | Navigate to class | Ctrl+N |
Open resource | Ctrl+Shift+R | Navigate to file | Ctrl+Shift+N |
- | - | Navigate to symbol | Ctrl+Shift+Alt+N |
Next view | Ctrl+F7 | - | - |
- | - | Recent files | Ctrl+E |
- | - | Switcher | Ctrl+Tab |
Quick outline | Ctrl+O | File structure | Ctrl+F12 |
Move lines | Alt+Up/Down | Move lines | Shift+Alt+Up/Shift+Alt+Down |
Delete lines | Ctrl+D | Delete lines | Ctrl+Y |
Quick fix | Ctrl+1 | Show intention action | Alt+Enter |
Quick switch editor | Ctrl+E | Switcher | Ctrl+Tab |
- | - | Recent files | Ctrl+E |
Quick hierarchy | Ctrl+T | Navigate to type hierarchy | Ctrl+H |
- | - | Navigate to method hierarchy | Ctrl+Shift+H |
- | - | Show UML popup | Ctrl+Alt+U |
Last edit location | Ctrl+Q | Last edit location | Ctrl+Shift+Backspace |
Next editor | Ctrl+F6 | Select next tab | Alt+Right |
Run | Ctrl+Shift+F11 | Run | Shift+F10 |
Debug | Ctrl+F11 | Debug | Shift+F9 |
Correct indentation | Ctrl+I | Auto-indent lines | Ctrl+Alt+I |
Format | Ctrl+Shift+F | Reformat code | Ctrl+Alt+L |
Surround with | Ctrl+Alt+Z | Surround with | Ctrl+Alt+T |
- | - | Surround with live template | Ctrl+Alt+J |
Open declaration | F3 | Navigate to declaration | Ctrl+B |
- | - | Quick definition | Ctrl+Shift+I |
Open type hierarchy | F4 | Navigate to type hierarchy | Ctrl+H |
- | - | Show UML popup | Ctrl+Alt+U |
References in workspace | Ctrl+Shift+G | Find usages | Alt+F7 |
- | - | Show usages | Ctrl+Alt+F7 |
- | - | Find usages settings | Ctrl+Shift+Alt+F7 |
Open search dialog | Ctrl+H | Find in path | Ctrl+Shift+F |
Occurrences in file | Ctrl+Alt+U | Highlight usages in file | Ctrl+Shift+F7 |
Copy lines | Ctrl+Alt+Down | Duplicate lines | Ctrl+D |
Extract local variable | Ctrl+Alt+L | Extract variable | Ctrl+Alt+V |
Assign to field | Ctrl+2/Ctrl+F | Extract field | Ctrl+Alt+F |
Show refactor quick menu | Ctrl+Alt+T | Refactor this | Ctrl+Shift+Alt+T |
Rename | Ctrl+Alt+R | Rename | Shift+F6 |
Go to line | Ctrl+L | Navigate to line | Ctrl+G |
Structured selection | Shift+Alt+Up/Shift+Alt+Down | Select word at caret | Ctrl+W/Ctrl+Shift+W |
Find next | Ctrl+J | Find next | F3 |
Show in | Ctrl+Alt+W | Select in | Alt+F1 |
Back | Ctrl+[ | Back | Ctrl+Alt+Left |
Forward | Ctrl+] | Forward | Ctrl+Alt+Right |
3,写代码我们经常会忘记后面的这里我们需要提示我们就可以使用下面的快捷键
Eclipse | IntelliJ IDEA | ||
Action | Shortcut | Action | Shortcut |
Code completion | Ctrl+Space | Basic completion | Ctrl+Space |
- | - | Smart completion | Ctrl+Shift+Space |
- | - | Statement completion | Ctrl+Shift+Enter |
4,写代码还会经常遇到是我们要快速的打印出内容或者写一个for循环IDEA有如下的快捷键
Template | Eclipse | IntelliJ IDEA |
Define a main method | main | psvm |
Iterate over an array | for | itar |
Iterate over a collection | for | itco |
Iterate over a list | for | itli |
Iterate over an iterable using foreach syntax | foreach | iter |
Print to System.out | sysout | sout |
Print to System.err | syserr | serr |
Define a static field | static_final | psf |
5,说完写代码,现在我们要怎么样快速找到一个代码,或者其引用可以用
Eclipse | IntelliJ IDEA | ||
Action | Shortcut | Action | Shortcut |
Open search dialog | Ctrl+H | Find in path | Ctrl+Shift+F |
References in workspace | Ctrl+Shift+G | Find usages | Alt+F7 |
- | - | Show usages | Ctrl+Alt+F7 |
- | - | Find usages settings | Ctrl+Shift+Alt+F7 |
Occurrences in file | Ctrl+Alt+U | Highlight usages in file | Ctrl+F7 |
6,格式化代码
Eclipse | IntelliJ IDEA | ||
Action | Shortcut | Action | Shortcut |
Format | Ctrl+Shift+F | Reformat code | Ctrl+Alt+L |
7,Debugging 调试代码需要使用到的快捷键
Eclipse | IntelliJ IDEA | ||
Action | Shortcut | Action | Shortcut |
Step into | F5 | Step into | F7 |
- | - | Smart step into | Shift+F7 |
Step over | F6 | Step over | F8 |
Step out | F7 | Step out | Shift+F8 |
Resume | F8 | Resume | F9 |
Toggle breakpoint | Ctrl+Shift+B | Toggle breakpoint | Ctrl+F8 |
- | - | Evaluate expression | Alt+F8 |
8,从eclipse工程导入到IDEA
我们可以在打开的欢迎页面,点击 Import Project 导入, 或者选择 File | New | Project 导入已经存在的源码。
如下我们要导入的工程是maven工程或者是gradle工程可以如下图进行导入: