简体   繁体   中英

Remove unused import from All projects in eclipse

Is there a way , a shortcut or any setting which removes unused import from all projects ? effectively from workspace?

I found following question which states about removing from single file. How to remove unused imports from Eclipse .

But I need from whole workspace?

PS: Let me know if there are in any case ,a plug ins available for performing same.

Key combination Ctrl+ Shift + O - will trigger the Organize Imports that will remove and add missing imports.

To apply it on whole workspace you just have to select the project in the view Package Explorer and then use the key combination

Right click your working set node, or all projects that you need and select Source->Organize Imports.

Shortcut is Ctrl+Shift+O, it is basically written in the menu so if you are using a different OS, you should be able to find it. It works on single files as well as project nodes in the Package Explorer

如前所述, Ctrl+ Shift + O手动执行或 Window -> Preferences -> Java -> Editor -> Save Actions -> Organize Imports 以在您保存类时自动组织它。

Eclipse Workspace -> Java Resources -> 右键单击​​ (src/main/java) 文件夹 -> 从菜单中选择 Sorce -> 现在最后选择 Organize import 就完成了。

对于 macOS ,您可以使用 -->control+option+O 组合。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM