ActionToolbar in Toolwindow has provision to change orientation of individual Action Button but not its text

Answered

If we add multiple actions in ActionToolbar and set its orientation to vertical, then individual actions are listed in multiple rows but if text is displayed it gets added beside the button horizontally and covering quite wide space for tollbar itself. Also tried multiple things but unable to change the orientation of text Horizontally. 

wanted it to display something like this: 

3 comments
Comment actions Permalink

Hi,

Could you please share the current code and what did you try? How do you show the action text?

1
Comment actions Permalink

Thank you for the details.

It seems it cannot be simply done.

Looking at all other action toolbars in tool windows, they never contain button labels and I recommend following this convention, so they are concise and consistent with the entire IDE UI. If the action may be unclear to a user, try to provide a clearer icon and this combined with a tooltip should be enough.

1
Comment actions Permalink

Following is the code snippet and by overriding displayTextInToolbar I am able to display the text for the Action: 

 

Creating Action Toolbar by passing action group and setting horizontal orientation to false. 

ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLWINDOW_TITLE, actionGroup, false);

Also tried to set the orientation of the font for toolbar component in two different ways but even that didn't work either. 

/*Font font = actionToolbar.getComponent().getFont();
        Font f = font.deriveFont(AffineTransform.getRotateInstance(90));
        actionToolbar.getComponent().setFont(f);*/

/*Font font = actionToolbar.getComponent().getFont();
        Font f = font.deriveFont(AffineTransform.getScaleInstance(1, -1));
        actionToolbar.getComponent().setFont(f);*/

Creating Action Class. 

public class MyAction extends AnAction implements DumbAware {

    public OpenCodeSweepRulesAction() {
        super("My Action", "My Action Desc", AllIcons.Actions.CheckOut);
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
        // Action Performed
    }

    @Override
    public boolean displayTextInToolbar() {
        return true;
    }
}

0

Please sign in to leave a comment.