[英]How to organize import in Eclipse but not *change* star imports
I'd like to configure the organize import in Eclipse with one caveat: I do NOT want Eclipse to CHANGE the imports related to star imports (like import javax.xml.parsers.*). 我想在Eclipse中配置Organize导入有一个警告:我不希望Eclipse更改与星号导入相关的导入(例如import javax.xml.parsers。*)。
I would like Eclipse not to expand (replace the star import with each specific ones) if there is already a star import, but also not automatically add the star when there is not. 我希望Eclipse不要扩展(用每个特定的星导入),如果已经有星导入,但也不要在没有星导入时自动添加星。
In fact, I would like the organize import to just organize the imports (ie reorder), not change them. 实际上,我希望组织导入只是组织导入(即重新订购),而不更改它们。 Any idea ? 任何的想法 ?
I like it when IDE do not mess with developer's will. 当IDE不干扰开发人员的意愿时,我会喜欢它。
The Organize Imports command can only be executed as a whole (see source code ) and the Sort Members command ignores import statements. “ 组织导入”命令只能整体执行 (请参阅源代码 ),而“ 排序成员”命令将忽略导入语句。
As workaround to reorder/sort the import statements alphabetical use the AnyEdit Tools plug-in: 解决方法是按字母顺序对导入语句进行重新排序/排序,请使用AnyEdit Tools插件:
For .*
import statements only , set the number of imports needed for .*
to 0 (see Eclipse help - Organize Imports Preferences ): 对于.*
只有import语句 ,设置所需的进口数量.*
0(见Eclipse帮助- 组织导入首选项 ):
For adding import statements manually or via content assist only , disable Organize Imports on save (see Eclipse help - Clean Up Preferences ): 要手动添加或仅通过内容辅助添加导入语句 ,请在保存时禁用组织导入 (请参阅Eclipse帮助- 清理首选项 ):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.