How to add import with asterisk using PSI and optimize them later?
Answered
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?
Please sign in to leave a comment.
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.
It helps, thanks!