diff --git a/platform/platform-api/src/com/intellij/ui/components/JBList.java b/platform/platform-api/src/com/intellij/ui/components/JBList.java index 6b7f176800b9..b60d7c3560b8 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBList.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBList.java @@ -35,7 +35,7 @@ import java.util.Collection; * @author Anton Makeev * @author Konstantin Bulenkov */ -public class JBList extends JList implements ComponentWithEmptyText, ComponentWithExpandableItems{ +public class JBList extends JList implements ComponentWithEmptyText, ComponentWithExpandableItems { private StatusText myEmptyText; private ExpandableItemsHandler myExpandableItemsHandler; @@ -76,8 +76,9 @@ public class JBList extends JList implements ComponentWithEmptyText, Compo public void removeNotify() { super.removeNotify(); - if (!ScreenUtil.isStandardAddRemoveNotify(this)) + if (!ScreenUtil.isStandardAddRemoveNotify(this)) { return; + } if (myBusyIcon != null) { remove(myBusyIcon); @@ -243,12 +244,17 @@ public class JBList extends JList implements ComponentWithEmptyText, Compo private @Nullable String itemToText(int index, E value) { ListCellRenderer renderer = getCellRenderer(); Component c = renderer == null ? null : renderer.getListCellRendererComponent(this, value, index, true, true); + if (c != null) { + c = ExpandedItemRendererComponentWrapper.unwrap(c); + } + SimpleColoredComponent coloredComponent = null; if (c instanceof JComponent) { coloredComponent = UIUtil.findComponentOfType((JComponent)c, SimpleColoredComponent.class); } return coloredComponent != null ? coloredComponent.getCharSequence(true).toString() : c instanceof JTextComponent ? ((JTextComponent)c).getText() : + c instanceof JLabel ? ((JLabel)c).getText() : value != null ? value.toString() : null; }