Override AnAction.update(AnActionEvent) and update the Presentation object obtained from com.intellij.openapi.actionSystem.AnActionEvent.getPresentation(). If your action is shown in other places than the toolbar you can check AnActionEvent.getPlace() to see what place is being updated.
And what if `StatusBarWidget` instance is used instead of `AnAction`? How would you update this presentation created with `StatusBarWidget.WidgetPresentation getPresentation()`?
Override AnAction.update(AnActionEvent) and update the Presentation object obtained from com.intellij.openapi.actionSystem.AnActionEvent.getPresentation(). If your action is shown in other places than the toolbar you can check AnActionEvent.getPlace() to see what place is being updated.
And what if `StatusBarWidget` instance is used instead of `AnAction`? How would you update this presentation created with `StatusBarWidget.WidgetPresentation getPresentation()`?
UPDATE: This has been answered on stackoverflow.