ActionToolbarImpl (AnAction @NotNull ... actions) { ActionToolbarImpl toolbar = new ActionToolbarImpl(ActionPlaces.EDITOR_TOOLBAR, new DefaultActionGroup(actions), true) { @Override protected @NotNull ActionButton createToolbarButton(@NotNull AnAction action, ActionButtonLook look, @NotNull String place, @NotNull Presentation presentation, Supplier<? extends @NotNull Dimension> minimumSize) { if (!ExperimentalUI.isNewUI()) { return super.createToolbarButton(action, look, place, presentation, minimumSize); } ActionButtonWithText result = new ActionButtonWithText(action, presentation, place, minimumSize){ @Override protected @NotNull Insets getMargins() { return JBInsets.addInsets(super.getMargins(), new JBInsets(4, 2, 4, 2)); } }; result.setLook(look); result.setBorder(JBUI.Borders.emptyRight(4)); result.setFont(JBFont.medium()); return result; } }; toolbar.setForceMinimumSize(true); toolbar.setTargetComponent(toolbar); toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY); return toolbar; }