Eclipse Ctrl + Shift + O in IntelliJ IDEA

Posted 每天进步一点

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Eclipse Ctrl + Shift + O in IntelliJ IDEA相关的知识,希望对你有一定的参考价值。

In Eclipse, you press CTRL + SHIFT + O “Organize Imports” to import packages automatically. For IntelliJ IDEA, if you press CTRL + ALT + O “Optimize Imports”, it just removes some unused imports, never imports any package. And the worst is you need click on the class name and press ALT + ENTER keys to import the package one by one.

Solution

The IDEA is working a bit differently, the “unambiguous imports” are imported on the fly, and you need to enable this feature manually.

File –>> Settings –>> Editor –>> General –>> Auto Import –>> Checked these options :

  1. Add unambiguous imports on the fly
  2. Optimize imports on the fly
技术分享
 
Note
For ambiguous imports (same class name in a different package), you still need click on the class name and press ALT + ENTER keys to import the package manually.

以上是关于Eclipse Ctrl + Shift + O in IntelliJ IDEA的主要内容,如果未能解决你的问题,请参考以下文章

使用eclipse

Eclipse快捷键

eclipse使用

idea中啥键相当于eclipse中的ctrl+shift+o

Eclipse快捷键

Eclipse小技巧