diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java index e3e386563b60..bbe00a5fbb69 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java @@ -282,10 +282,6 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent return createActionPopup(getDataContext(), this, onDispose); } - private ComboBoxAction getMyAction() { - return ComboBoxAction.this; - } - protected DataContext getDataContext() { return DataManager.getInstance().getDataContext(this); } @@ -321,15 +317,6 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent setToolTipText(!tooltip.isEmpty() ? tooltip : null); } - @Override - public void updateUI() { - super.updateUI(); - //if (!UIUtil.isUnderGTKLookAndFeel()) { - // setBorder(UIUtil.getButtonBorder()); - //} - //((JComponent)getParent().getParent()).revalidate(); - } - protected class MyButtonModel extends DefaultButtonModel { @Override public boolean isPressed() { @@ -363,20 +350,6 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent } } - @Override - public Insets getInsets() { - final Insets insets = super.getInsets(); - insets.right += getArrowIcon(isEnabled()).getIconWidth(); - return insets; - } - - @Override - public Insets getInsets(Insets insets) { - final Insets result = super.getInsets(insets); - result.right += getArrowIcon(isEnabled()).getIconWidth(); - return result; - } - @Override public boolean isOpaque() { return !isSmallVariant(); @@ -384,13 +357,12 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent @Override public Dimension getPreferredSize() { - final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText()); - int width = isEmpty ? JBUI.scale(10) + getArrowIcon(isEnabled()).getIconWidth() : super.getPreferredSize().width; - if (isSmallVariant() && !UIUtil.isUnderDefaultMacTheme()) { - width += JBUI.scale(4); - if (UIUtil.isUnderWin10LookAndFeel()) { - width += JBUI.scale(8); - } + boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText()); + int width = isEmpty ? JBUI.scale(10) : super.getPreferredSize().width; + width += getArrowIcon(isEnabled()).getIconWidth(); + if (isSmallVariant()) { + int extraWidth = UIUtil.isUnderDefaultMacTheme() || UIUtil.isUnderWin10LookAndFeel() ? 0 : JBUI.scale(4); + width += extraWidth; } int height = UIUtil.isUnderWin10LookAndFeel() ? JBUI.scale(24) : JBUI.scale(19); @@ -479,7 +451,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent } } - Insets insets = super.getInsets(); + Insets insets = getInsets(); Icon icon = getArrowIcon(isEnabled()); int x = size.width - icon.getIconWidth(); @@ -506,6 +478,11 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent g.setPaintMode(); } + @Override public void updateUI() { + super.updateUI(); + updateButtonSize(); + } + protected void updateButtonSize() { invalidate(); repaint(); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java index c1b3eea0198b..586153d3fa58 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonBorder.java @@ -82,14 +82,12 @@ public class WinIntelliJButtonBorder implements Border, UIResource { @Override public Insets getBorderInsets(Component c) { - if (DarculaButtonUI.isComboButton((JComponent)c)) { - return JBUI.insets(2).asUIResource(); - } else if (UIUtil.getParentOfType(ActionToolbar.class, c) != null) { - return JBUI.insets(4, 16, 4, 19).asUIResource(); - } else if (isSquare(c)) { + if (isSquare(c)) { return JBUI.insets(2).asUIResource(); } else if (DarculaButtonUI.isHelpButton((JComponent)c)) { return JBUI.insets(0, 0, 0, 10).asUIResource(); + } else if (DarculaButtonUI.isComboButton((JComponent)c)) { + return JBUI.insets(4, 10).asUIResource(); } else { return JBUI.insets(4, 18).asUIResource(); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonUI.java index 2a705bfc327d..e14a4c5cf0f7 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJButtonUI.java @@ -114,7 +114,9 @@ public class WinIntelliJButtonUI extends DarculaButtonUI { } if (isComboButton(b)) { - rect.x += JBUI.scale(5); + int delta = JBUI.scale(6); + rect.x += delta; + rect.width -= delta; } else if (b instanceof JBOptionButton) { rect.x -= JBUI.scale(4); }