[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:
Louis Vignier
2022-12-01 13:34:26 +01:00
committed by intellij-monorepo-bot
parent 603b1b5fa3
commit 04a88cf36c
2 changed files with 5 additions and 12 deletions

View File

@@ -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;
}
});
}

View File

@@ -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 {