自动整理导入 [英] Organize Imports Automatically

查看:87
本文介绍了自动整理导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Eclipse时,我发现自己多次输入Ctrl + Shift + O,以组织导入(通常是不再需要的导入,产生警告)。

When using Eclipse, I find myself typing Ctrl+Shift+O several times, to organize imports (usually imports which are no longer required, generating warnings).

有没有办法让Eclipse每隔一段时间组织我的导入,或至少每次保存文件?

Is there a way to make Eclipse organize my imports every once in a while or, at least, every time I save a file?

推荐答案

p>首选项 - > Java->编辑器 - >保存操作 - >配置...

Preferences->Java->Editor->Save Actions->Configure...

您可以配置从不必要的代码选项卡保存时删除未使用的导入。

You can configure the removal of unused imports when saving from the Unnecessary Code tab.

添加导入通常会在您编写代码时进行,否则将无法编译。

Adding imports would normally be done as you are writing the code otherwise it won't compile.

是如何看起来像:

这篇关于自动整理导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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