How to add import with asterisk using PSI and optimize them later?

已回答

I want to add imports with asterisk, normal and static,using PSI from my plugin.
Then I want IDEA to optimize imports according to user code style - perhaps, it shall replace asterisk imports with concrete classes/members.
What I can use?

0

The behavior of asterisks import is controlled via Java Code Style Settings (Preferences | Editor | Code Style | Java) in "Imports" tab.

See com.siyeh.ig.psiutils.ImportUtils and com.intellij.codeInsight.actions.OptimizeImportsProcessor and related classes on how to add/optimize imports programmatically.

1

It helps, thanks!

0

请先登录再写评论。