IntelliJ组织进口 [英] IntelliJ Organize Imports

查看:97
本文介绍了IntelliJ组织进口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ是否具有类似于Eclipse中的Organize Imports功能?
我所拥有的是一个Java文件,其中有多个类缺少其导入。示例:

Does IntelliJ have an Organize Imports feature similar to that in Eclipse? What I have is a Java file with multiple classes missing their imports. Example:

package com.test;
public class Foo {
    public Map map;
    public JTable table;
}

在Eclipse中,我可以使用Organize Imports,它会自动导入 java.util.Map javax.swing.JTable 。在IntelliJ中,我必须单独转到每个类,选择它,然后按Alt-Enter。有一个Optimize Imports功能,但它似乎只是对现有导入进行排序和扩展。

In Eclipse I could use Organize Imports and it would automatically import both java.util.Map and javax.swing.JTable. In IntelliJ I have to individually go to each class, select it, then press Alt-Enter. There is an Optimize Imports feature but all it seems to do is sort and expand the existing imports.

我正在使用IntelliJ 10.5。

I'm using IntelliJ 10.5.

推荐答案

2015年7月 - 我得出结论,IntelliJ不支持使用单一功能自动解析导入。 组织导入只是删除未使用的导入,它不解析未导入的类型。 Control-Space解析单个未排序类型。没有一个操作来解决所有类型的导入。

July 2015 - I have concluded that IntelliJ does not support automatically resolving imports with a single function. "Organize imports" simply removes unused imports, it does not resolve unimported types. Control-Space resolves a single unimported type. There does not exist a single action to resolve all types' imports.

这篇关于IntelliJ组织进口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆