Icon not shown for Action in ActionToolbar of ToolWindow

I created a DefaultActionGroup and added an Action to it. Using that I created the ActionToolbar for my ToolWindow. Now the thing is, for my Action, I have declared the icon in the <action /> tag in plugin.xml. The icon for the Action gets reflected in the Menu and PopupMenu, but doesn't not get reflected in the ActionToolbar.
I then removed the icon declaration from the plugin.xml and added the icon in my java implementation of the Action class (in the AnAction contructor).

public MyAction(){

When I do this, the Icon gets reflected in the ActionToolbar also. So my question is why is it when I put the icon in the plugin.xml, it's not shown in ActionToolbar ?

Comment actions Permalink

If you create a new instance of your action class directly, the attributes specified in the plugin.xml will not apply, because the code loading the attributes will not be executed. You can use ActionManager.getAction() to get an instance of your action that was loaded from plugin.xml with all the attributes applied.

Comment actions Permalink

Yes, got it. Thanks.


Please sign in to leave a comment.