dependency injection for menu / AnAction

How can I inject a component into an AnAction instance and how does DI work for plugin development?

0
5 comments

(I can inject dependencies to Components but not to AnAction)


0

Dependency injection is unfortunately not supported for AnAction instances. You need to use getComponent() or getService() to get your dependencies.

0

thanks, but which object has those methods? AnAction doesn't have them and I can't find them


0

see com.intellij.openapi.components.ServiceManager and Module/Project/Application to obtain Component from corresponding scope

0

Please sign in to leave a comment.