Refresh action after change
Answered
I have code which sets the enabled flag of an action like this:
templatePresentation.isEnabled = runEnabled
But this never seems to redraw the icon (they don't grey out. It works if I hard code it on startup).
Do I need to do something to tell the toolbar / action group / action to refresh it's display ?
Please sign in to leave a comment.
I figured this out by reading this thread.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206109039-Disable-the-Presentation-of-AnAction?flash_digest=f25f8b43e3c010afa06b5c935ac0044c4db34df4
tl;dr override the update method in your action and just check the state in there. That method is called frequently.