Can Eclipse the Organize Import (ctrl+shift+o) command's handling of static imports be modified?

后端 未结 1 754
梦如初夏
梦如初夏 2020-12-17 07:32

I use the Eclipse keyboard shortcut Ctrl + Shift + O all the time (Organize Imports).

However, it has one particularly annoying beha

相关标签:
1条回答
  • 2020-12-17 08:04

    Sure: Window -> Preferences -> Java -> Code Style -> Organize Imports

    Adjust the value for "Number of static imports needed for .*" to 1, and it will always use .*. Of course, that's not quite the same as saying, "Just leave static imports alone" but hopefully it's what you want.

    Basically, this number says "Use all of the methods or fields of this import if I'm importing this many items" So if the number is 2, it will add the asterisk only if you use two or more imports. That will fix the problem you said in the response.

    0 讨论(0)
提交回复
热议问题