mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[ui] Make customization functions in GroupedComboBoxRenderer not abstract
If we override customize then getText, getSecondaryText and getIcon don't need to be overridden. GitOrigin-RevId: e8aa2f06aa628ed8aa1d973d52a185753917b077
This commit is contained in:
committed by
intellij-monorepo-bot
parent
603b1b5fa3
commit
04a88cf36c
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -77,12 +76,6 @@ public abstract class LanguageLevelCombo extends ComboBox<Object> {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon(Object value) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ abstract class GroupedComboBoxRenderer<T>(private val combo: ComboBox<T>) : Grou
|
||||
}
|
||||
|
||||
@NlsContexts.ListItem
|
||||
abstract fun getText(value: T): String
|
||||
open fun getText(value: T): String = ""
|
||||
@Nls
|
||||
abstract fun getSecondaryText(value: T): String?
|
||||
abstract fun getIcon(value: T): Icon?
|
||||
open fun getSecondaryText(value: T): String? = null
|
||||
open fun getIcon(value: T): Icon? = null
|
||||
|
||||
open fun customize(item: SimpleColoredComponent, value: T) {
|
||||
open fun customize(item: SimpleColoredComponent, value: T, index: Int) {
|
||||
val text = getText(value)
|
||||
item.append(text)
|
||||
|
||||
@@ -86,7 +86,7 @@ abstract class GroupedComboBoxRenderer<T>(private val combo: ComboBox<T>) : Grou
|
||||
cellHasFocus: Boolean): Component {
|
||||
coloredComponent.apply {
|
||||
clear()
|
||||
customize(this, value)
|
||||
customize(this, value, index)
|
||||
}
|
||||
|
||||
mySeparatorComponent.apply {
|
||||
|
||||
Reference in New Issue
Block a user