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
idea-organize-imports
 
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.
posted @   zheting  阅读(3023)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示