mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-199540: fix default list renderer to support unfocused state
This commit is contained in:
+3
-1
@@ -21,6 +21,7 @@ import com.intellij.ide.fileTemplates.FileTemplateUtil;
|
||||
import com.intellij.ui.ListSpeedSearch;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -51,7 +52,7 @@ abstract class FileTemplateTabAsList extends FileTemplateTab {
|
||||
private class MyListCellRenderer extends DefaultListCellRenderer {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, false);
|
||||
Icon icon = null;
|
||||
if (value instanceof FileTemplate) {
|
||||
FileTemplate template = (FileTemplate) value;
|
||||
@@ -73,6 +74,7 @@ abstract class FileTemplateTabAsList extends FileTemplateTab {
|
||||
}
|
||||
}
|
||||
setIcon(icon);
|
||||
if (isSelected) setBackground(UIUtil.getListSelectionBackground(cellHasFocus));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1363,6 +1363,10 @@ public class UIUtil {
|
||||
return new JBColor(UNFOCUSED_SELECTION_COLOR, new Color(13, 41, 62));
|
||||
}
|
||||
|
||||
public static Color getListSelectionBackground(boolean focused) {
|
||||
return focused ? getListSelectionBackground() : getListUnfocusedSelectionBackground();
|
||||
}
|
||||
|
||||
public static Color getTreeSelectionBackground(boolean focused) {
|
||||
return focused ? getTreeSelectionBackground() : getTreeUnfocusedSelectionBackground();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user