diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java index 44b4c8c5c3f0..e7c0c7aace78 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,8 +84,6 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup { myBranchLabel.setBackground(getBackground()); myBranchLabel.setForeground(JBColor.GRAY); // different foreground than for other elements } - - adjustOpacity(myBranchLabel, isSelected); } else { myBranchLabel.setVisible(false); @@ -111,4 +109,3 @@ public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup { }; } } - diff --git a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java index 5fb4b53175c9..4a2abb304aa2 100644 --- a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java @@ -73,13 +73,13 @@ public abstract class GroupedElementsRenderer { setDeselected(myTextLabel); } - adjustOpacity(myTextLabel, isSelected); - myRendererComponent.setPrefereedWidth(preferredForcedWidth); return myRendererComponent; } + /** @deprecated backgrounds are set uniformly via setSelected() / setDeselected() (to be removed in IDEA 16) */ + @SuppressWarnings("UnusedDeclaration") protected static void adjustOpacity(JComponent component, boolean selected) { if (selected) { if (UIUtil.isUnderNimbusLookAndFeel()) { @@ -94,13 +94,12 @@ public abstract class GroupedElementsRenderer { } protected final void setSelected(JComponent aComponent) { - aComponent.setBackground(getSelectionBackground()); + UIUtil.setBackgroundRecursively(aComponent, getSelectionBackground()); aComponent.setForeground(getSelectionForeground()); } - protected final void setDeselected(JComponent aComponent) { - aComponent.setBackground(getBackground()); + UIUtil.setBackgroundRecursively(aComponent, getBackground()); aComponent.setForeground(getForeground()); } diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 4ae0c69fc005..f9895a149168 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -2880,6 +2880,15 @@ public class UIUtil { } } + public static void setBackgroundRecursively(@NotNull Component component, @NotNull Color bg) { + component.setBackground(bg); + if (component instanceof Container) { + for (Component c : ((Container)component).getComponents()) { + setBackgroundRecursively(c, bg); + } + } + } + public static void addInsets(@NotNull JComponent component, @NotNull Insets insets) { if (component.getBorder() != null) { component.setBorder(new CompoundBorder(new EmptyBorder(insets), component.getBorder()));