mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-330211 cleanup
GitOrigin-RevId: 10b15fbde8537f9dbef450c7b43d7aa6b9298f17
This commit is contained in:
committed by
intellij-monorepo-bot
parent
75d7c35138
commit
c354f484e6
@@ -3,6 +3,7 @@ package com.intellij.ide.ui
|
||||
|
||||
import com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
@@ -10,10 +11,8 @@ import org.jetbrains.annotations.ApiStatus
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
interface ThemesListProvider {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): ThemesListProvider = ApplicationManager.getApplication().getService(ThemesListProvider::class.java)
|
||||
fun getInstance(): ThemesListProvider = ApplicationManager.getApplication().service<ThemesListProvider>()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,5 +20,4 @@ interface ThemesListProvider {
|
||||
* Themes are divided to groups, groups should be split by separators in all UIs
|
||||
*/
|
||||
fun getShownThemes(): List<List<UIThemeLookAndFeelInfo>>
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public final class QuickChangeLookAndFeel extends QuickSwitchSchemeAction implem
|
||||
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
|
||||
UIThemeLookAndFeelInfo initialLaf = LafManager.getInstance().getCurrentUIThemeLookAndFeel();
|
||||
|
||||
for (List<UIThemeLookAndFeelInfo> list : ThemesListProvider.getInstance().getShownThemes()) {
|
||||
for (List<UIThemeLookAndFeelInfo> list : ThemesListProvider.Companion.getInstance().getShownThemes()) {
|
||||
if (group.getChildrenCount() > 0) group.addSeparator();
|
||||
for (UIManager.LookAndFeelInfo lf : list) group.add(new LafChangeAction(lf, initialLaf == lf));
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
UiThemeProviderListManager.getInstance().getLaFsWithUITypes()
|
||||
}
|
||||
}
|
||||
private val lafList
|
||||
private val lafList: Set<UIThemeLookAndFeelInfo>
|
||||
get() = lafMap.value.keys
|
||||
|
||||
private val defaultDarkTheme = SynchronizedClearableLazy {
|
||||
@@ -266,7 +266,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
val theme = currentTheme!!
|
||||
if (theme is UIThemeLookAndFeelInfoImpl) {
|
||||
if (!theme.isInitialised) {
|
||||
doSetLaF(theme, false)
|
||||
doSetLaF(lookAndFeelInfo = theme, installEditorScheme = false)
|
||||
}
|
||||
}
|
||||
selectComboboxModel()
|
||||
@@ -332,13 +332,13 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
if (systemIsDark) {
|
||||
expectedTheme = preferredDarkTheme
|
||||
if (expectedTheme == null) {
|
||||
expectedTheme = getDefaultDarkLaf()
|
||||
expectedTheme = defaultDarkLaf
|
||||
}
|
||||
}
|
||||
else {
|
||||
expectedTheme = preferredLightTheme
|
||||
if (expectedTheme == null) {
|
||||
expectedTheme = getDefaultLightLaf()
|
||||
expectedTheme = defaultLightLaf
|
||||
}
|
||||
}
|
||||
if (currentIsDark != systemIsDark || currentTheme !== expectedTheme) {
|
||||
@@ -349,7 +349,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
override fun loadState(element: Element) {
|
||||
val oldTheme = currentTheme
|
||||
val newTheme = loadThemeState(element, ELEMENT_LAF) ?:
|
||||
// We try to read 'class-name' attribute for backward compatibilities IDE's before 2023.3.
|
||||
// We try to read `class-name` attribute for backward compatibilities IDE's before 2023.3.
|
||||
// Only for Darcula theme. We could drop it in future when we will stop bundle Darcula.
|
||||
if (element.getChild("laf")?.getAttribute("class-name")?.value == "com.intellij.ide.ui.laf.darcula.DarculaLaf") {
|
||||
findLafByName("Darcula") ?: loadDefaultTheme()
|
||||
@@ -403,10 +403,10 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
if (currentTheme?.theme?.id != defaultThemeId) {
|
||||
getThemeState(element, ELEMENT_LAF, currentUIThemeLookAndFeel)
|
||||
}
|
||||
if (preferredLightTheme != null && preferredLightTheme !== getDefaultLightLaf()) {
|
||||
if (preferredLightTheme != null && preferredLightTheme !== defaultLightLaf) {
|
||||
getThemeState(element, ELEMENT_PREFERRED_LIGHT_LAF, preferredLightTheme)
|
||||
}
|
||||
if (preferredDarkTheme != null && preferredDarkTheme !== getDefaultDarkLaf()) {
|
||||
if (preferredDarkTheme != null && preferredDarkTheme !== defaultDarkLaf) {
|
||||
getThemeState(element, ELEMENT_PREFERRED_DARK_LAF, preferredDarkTheme)
|
||||
}
|
||||
|
||||
@@ -457,11 +457,13 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun findLaf(reference: LafReference): UIThemeLookAndFeelInfo = lafList.singleOrNull { it.theme.id == reference.themeId }
|
||||
?: error("Theme not found for themeId: ${reference.themeId}")
|
||||
override fun findLaf(reference: LafReference): UIThemeLookAndFeelInfo {
|
||||
return lafList.singleOrNull { it.theme.id == reference.themeId } ?: error("Theme not found for themeId: ${reference.themeId}")
|
||||
}
|
||||
|
||||
@Suppress("removal")
|
||||
override fun getCurrentLookAndFeel(): UIManager.LookAndFeelInfo? = currentTheme
|
||||
|
||||
override fun getCurrentUIThemeLookAndFeel(): UIThemeLookAndFeelInfo? = currentTheme
|
||||
|
||||
override fun getLookAndFeelReference(): LafReference = createLafReference(currentUIThemeLookAndFeel)
|
||||
@@ -479,7 +481,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
}
|
||||
}
|
||||
}
|
||||
return getDefaultDarkLaf()
|
||||
return defaultDarkLaf
|
||||
}
|
||||
|
||||
private fun findLafByName(name: String): UIThemeLookAndFeelInfo? = installedLookAndFeels.firstOrNull { name == it.name }
|
||||
@@ -488,7 +490,9 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
* Sets current LAF. The method doesn't update component hierarchy.
|
||||
*/
|
||||
override fun setCurrentLookAndFeel(lookAndFeelInfo: UIManager.LookAndFeelInfo, lockEditorScheme: Boolean) {
|
||||
setLookAndFeelImpl(lookAndFeelInfo = lookAndFeelInfo as UIThemeLookAndFeelInfo, installEditorScheme = !lockEditorScheme, processChangeSynchronously = true)
|
||||
setLookAndFeelImpl(lookAndFeelInfo = lookAndFeelInfo as UIThemeLookAndFeelInfo,
|
||||
installEditorScheme = !lockEditorScheme,
|
||||
processChangeSynchronously = true)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -582,10 +586,8 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
if (oldLaf is TempUIThemeLookAndFeelInfo || currentTheme is TempUIThemeLookAndFeelInfo) {
|
||||
return
|
||||
}
|
||||
if (currentTheme is UIThemeLookAndFeelInfo) {
|
||||
if ((currentTheme as UIThemeLookAndFeelInfo).theme.editorSchemeName != null) {
|
||||
return
|
||||
}
|
||||
if (currentTheme is UIThemeLookAndFeelInfo && (currentTheme as UIThemeLookAndFeelInfo).theme.editorSchemeName != null) {
|
||||
return
|
||||
}
|
||||
|
||||
val editorColorManager = EditorColorsManager.getInstance()
|
||||
@@ -600,7 +602,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
|
||||
val dark = StartupUiUtil.isDarkTheme
|
||||
val wasUITheme = oldLaf is UIThemeLookAndFeelInfo
|
||||
if (dark != ColorUtil.isDark(current.defaultBackground) || wasUITheme) {
|
||||
if (wasUITheme || dark != ColorUtil.isDark(current.defaultBackground)) {
|
||||
var targetScheme = defaultNonLaFSchemeName(dark)
|
||||
val properties = PropertiesComponent.getInstance()
|
||||
val savedEditorThemeKey = if (dark) DARCULA_EDITOR_THEME_KEY else DEFAULT_EDITOR_THEME_KEY
|
||||
@@ -619,8 +621,6 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun defaultNonLaFSchemeName(dark: Boolean) = if (dark) DarculaLaf.NAME else EditorColorsScheme.DEFAULT_SCHEME_NAME
|
||||
|
||||
/**
|
||||
* Updates LAF of all windows. The method also updates font of components as it's configured in `UISettings`.
|
||||
*/
|
||||
@@ -856,7 +856,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
oldTheme.setProviderClassLoader(null)
|
||||
val isDark = oldTheme.isDark
|
||||
val defaultLaF = if (oldLaF === currentUIThemeLookAndFeel) {
|
||||
if (isDark) getDefaultDarkLaf() else getDefaultLightLaf()
|
||||
if (isDark) defaultDarkLaf else defaultLightLaf
|
||||
}
|
||||
else {
|
||||
null
|
||||
@@ -914,10 +914,9 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
|
||||
private val lafGroups: ActionGroup
|
||||
get() {
|
||||
val allLaFs = ThemesListProvider.getInstance().getShownThemes().flatten()
|
||||
val lightLaFs = ArrayList<UIThemeLookAndFeelInfo>()
|
||||
val darkLaFs = ArrayList<UIThemeLookAndFeelInfo>()
|
||||
for (lafInfo in allLaFs) {
|
||||
for (lafInfo in ThemesListProvider.getInstance().getShownThemes().flatten()) {
|
||||
if (lafInfo.theme.isDark) {
|
||||
darkLaFs.add(lafInfo)
|
||||
}
|
||||
@@ -941,7 +940,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
|
||||
val result = ArrayList<AnAction>()
|
||||
result.add(Separator.create(separatorText))
|
||||
lafs.mapTo(result) { LafToggleAction(it.name, it, isDark) }
|
||||
lafs.mapTo(result) { LafToggleAction(name = it.name, lafInfo = it, isDark = isDark) }
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -951,41 +950,29 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
private val isDark: Boolean) : ToggleAction(name) {
|
||||
override fun isSelected(e: AnActionEvent): Boolean {
|
||||
return if (isDark) {
|
||||
(preferredDarkTheme?.name ?: getDefaultDarkLaf().name) == lafInfo.name
|
||||
(preferredDarkTheme?.name ?: defaultDarkLaf.name) == lafInfo.name
|
||||
}
|
||||
else {
|
||||
(preferredLightTheme?.name ?: getDefaultLightLaf().name) == lafInfo.name
|
||||
(preferredLightTheme?.name ?: defaultLightLaf.name) == lafInfo.name
|
||||
}
|
||||
}
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
if (isDark) {
|
||||
if (preferredDarkTheme?.name != lafInfo.name) {
|
||||
if (lafInfo.name == getDefaultDarkLaf().name) {
|
||||
preferredDarkTheme = null
|
||||
}
|
||||
else {
|
||||
preferredDarkTheme = lafInfo
|
||||
}
|
||||
preferredDarkTheme = if (lafInfo.name == defaultDarkLaf.name) null else lafInfo
|
||||
detectAndSyncLaf()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (preferredLightTheme?.name != lafInfo.name) {
|
||||
if (lafInfo.name == getDefaultLightLaf().name) {
|
||||
preferredLightTheme = null
|
||||
}
|
||||
else {
|
||||
preferredLightTheme = lafInfo
|
||||
}
|
||||
detectAndSyncLaf()
|
||||
}
|
||||
else if (preferredLightTheme?.name != lafInfo.name) {
|
||||
preferredLightTheme = if (lafInfo.name == defaultLightLaf.name) null else lafInfo
|
||||
detectAndSyncLaf()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
override fun isDumbAware(): Boolean = true
|
||||
override fun isDumbAware() = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,7 +996,11 @@ private class LafCellRenderer : SimpleListCellRenderer<LafManager.LafReference>(
|
||||
return if (value === SEPARATOR) separator else super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
|
||||
}
|
||||
|
||||
override fun customize(list: JList<out LafManager.LafReference>, value: LafManager.LafReference, index: Int, selected: Boolean, hasFocus: Boolean) {
|
||||
override fun customize(list: JList<out LafManager.LafReference>,
|
||||
value: LafManager.LafReference,
|
||||
index: Int,
|
||||
selected: Boolean,
|
||||
hasFocus: Boolean) {
|
||||
text = value.toString()
|
||||
}
|
||||
}
|
||||
@@ -1020,9 +1011,10 @@ open class IJColor internal constructor(color: Color?, private val name: String)
|
||||
override fun toString(): String = "${super.toString()} Name: $name"
|
||||
}
|
||||
|
||||
class IJColorUIResource internal constructor(color: Color?, name: String) : IJColor(color, name), UIResource
|
||||
private class IJColorUIResource(color: Color?, name: String) : IJColor(color, name), UIResource
|
||||
|
||||
private val SEPARATOR = LafManager.LafReference("", null)
|
||||
|
||||
private val fileChooserTextKeys = arrayOf(
|
||||
"FileChooser.viewMenuLabelText", "FileChooser.newFolderActionLabelText",
|
||||
"FileChooser.listViewActionLabelText", "FileChooser.detailsViewActionLabelText", "FileChooser.refreshActionLabelText"
|
||||
@@ -1043,9 +1035,10 @@ private fun fixMenuIssues(uiDefaults: UIDefaults) {
|
||||
|
||||
private class OurPopupFactory(private val delegate: PopupFactory) : PopupFactory() {
|
||||
companion object {
|
||||
const val WEIGHT_LIGHT = 0
|
||||
const val WEIGHT_MEDIUM = 1
|
||||
const val WEIGHT_HEAVY = 2
|
||||
const val WEIGHT_LIGHT: Int = 0
|
||||
const val WEIGHT_MEDIUM: Int = 1
|
||||
const val WEIGHT_HEAVY: Int = 2
|
||||
|
||||
private fun fixPopupLocation(contents: Component, x: Int, y: Int): Point {
|
||||
@Suppress("NAME_SHADOWING") var y = y
|
||||
if (contents !is JToolTip) {
|
||||
@@ -1065,6 +1058,7 @@ private class OurPopupFactory(private val delegate: PopupFactory) : PopupFactory
|
||||
}
|
||||
return Point(x, y)
|
||||
}
|
||||
|
||||
val info = try {
|
||||
MouseInfo.getPointerInfo()
|
||||
}
|
||||
@@ -1073,6 +1067,7 @@ private class OurPopupFactory(private val delegate: PopupFactory) : PopupFactory
|
||||
// may happen under Mac OSX 10.5
|
||||
return Point(x, y)
|
||||
}
|
||||
|
||||
var deltaY = 0
|
||||
if (info != null) {
|
||||
val mouse = info.location
|
||||
@@ -1096,64 +1091,56 @@ private class OurPopupFactory(private val delegate: PopupFactory) : PopupFactory
|
||||
}
|
||||
var popup = delegate.getPopup(owner, contents, point.x, point.y)
|
||||
val window = ComponentUtil.getWindow(contents)
|
||||
val isHeavyWeightPopup = window is RootPaneContainer && window !== ComponentUtil.getWindow(owner)
|
||||
if (isHeavyWeightPopup) {
|
||||
popup = HeavyWeightPopup(popup, window!!) // disable popup caching by runtime
|
||||
val rootPane = (window as RootPaneContainer?)!!.rootPane
|
||||
rootPane.glassPane = IdeGlassPaneImpl(rootPane, false)
|
||||
rootPane.putClientProperty(WINDOW_ALPHA, 1.0f)
|
||||
window.addWindowListener(object : WindowAdapter() {
|
||||
override fun windowOpened(e: WindowEvent) {
|
||||
// cleanup will be handled by AbstractPopup wrapper
|
||||
if (PopupUtil.getPopupContainerFor(rootPane) != null) {
|
||||
window.removeWindowListener(this)
|
||||
}
|
||||
}
|
||||
if (window !is RootPaneContainer || window === ComponentUtil.getWindow(owner)) {
|
||||
return popup
|
||||
}
|
||||
|
||||
override fun windowClosed(e: WindowEvent) {
|
||||
// disable popup caching by runtime
|
||||
popup = HeavyWeightPopup(popup, window)
|
||||
val rootPane = (window as RootPaneContainer?)!!.rootPane
|
||||
rootPane.glassPane = IdeGlassPaneImpl(rootPane, false)
|
||||
rootPane.putClientProperty(WINDOW_ALPHA, 1.0f)
|
||||
window.addWindowListener(object : WindowAdapter() {
|
||||
override fun windowOpened(e: WindowEvent) {
|
||||
// cleanup will be handled by AbstractPopup wrapper
|
||||
if (PopupUtil.getPopupContainerFor(rootPane) != null) {
|
||||
window.removeWindowListener(this)
|
||||
DialogWrapper.cleanupRootPane(rootPane)
|
||||
DialogWrapper.cleanupWindowListeners(window)
|
||||
}
|
||||
})
|
||||
if ((IdeaPopupMenuUI.isUnderPopup(contents) || (SystemInfoRt.isWindows || IdeaPopupMenuUI.isUnderMainMenu(contents)))
|
||||
&& WindowRoundedCornersManager.isAvailable()) {
|
||||
if ((SystemInfoRt.isMac && StartupUiUtil.isDarkTheme) || SystemInfoRt.isWindows) {
|
||||
WindowRoundedCornersManager.setRoundedCorners(window, JBUI.CurrentTheme.Popup.borderColor(true))
|
||||
}
|
||||
else {
|
||||
WindowRoundedCornersManager.setRoundedCorners(window)
|
||||
}
|
||||
if (SystemInfoRt.isMac) {
|
||||
val contentPane = (window as RootPaneContainer?)!!.contentPane as JComponent
|
||||
contentPane.isOpaque = true
|
||||
contentPane.background = contents.background
|
||||
}
|
||||
}
|
||||
|
||||
override fun windowClosed(e: WindowEvent) {
|
||||
window.removeWindowListener(this)
|
||||
DialogWrapper.cleanupRootPane(rootPane)
|
||||
DialogWrapper.cleanupWindowListeners(window)
|
||||
}
|
||||
})
|
||||
if ((IdeaPopupMenuUI.isUnderPopup(contents) || (SystemInfoRt.isWindows || IdeaPopupMenuUI.isUnderMainMenu(contents)))
|
||||
&& WindowRoundedCornersManager.isAvailable()) {
|
||||
if ((SystemInfoRt.isMac && StartupUiUtil.isDarkTheme) || SystemInfoRt.isWindows) {
|
||||
WindowRoundedCornersManager.setRoundedCorners(window, JBUI.CurrentTheme.Popup.borderColor(true))
|
||||
}
|
||||
else {
|
||||
WindowRoundedCornersManager.setRoundedCorners(window)
|
||||
}
|
||||
if (SystemInfoRt.isMac) {
|
||||
val contentPane = (window as RootPaneContainer?)!!.contentPane as JComponent
|
||||
contentPane.isOpaque = true
|
||||
contentPane.background = contents.background
|
||||
}
|
||||
}
|
||||
return popup
|
||||
}
|
||||
}
|
||||
|
||||
private fun getThemeState(element: Element, attributeName: @NonNls String?, suggestedLaf: UIThemeLookAndFeelInfo?) {
|
||||
var laf = suggestedLaf
|
||||
if (laf is TempUIThemeLookAndFeelInfo) {
|
||||
laf = laf.previousLaf as UIThemeLookAndFeelInfo
|
||||
}
|
||||
if (laf == null) {
|
||||
return
|
||||
}
|
||||
|
||||
val laf = (if (suggestedLaf is TempUIThemeLookAndFeelInfo) suggestedLaf.previousLaf else null) ?: return
|
||||
val child = Element(attributeName)
|
||||
child.setAttribute(ATTRIBUTE_THEME_NAME, laf.theme.id)
|
||||
element.addContent(child)
|
||||
}
|
||||
|
||||
private fun createLafReference(laf: UIThemeLookAndFeelInfo?): LafManager.LafReference {
|
||||
var themeId: String? = null
|
||||
if (laf is UIThemeLookAndFeelInfo) {
|
||||
themeId = laf.theme.id
|
||||
}
|
||||
val themeId = if (laf is UIThemeLookAndFeelInfo) laf.theme.id else null
|
||||
return LafManager.LafReference(laf!!.name, themeId)
|
||||
}
|
||||
|
||||
@@ -1341,8 +1328,7 @@ private fun repaintUI(window: Window) {
|
||||
return
|
||||
}
|
||||
window.repaint()
|
||||
val children = window.ownedWindows
|
||||
for (aChildren in children) {
|
||||
for (aChildren in window.ownedWindows) {
|
||||
repaintUI(aChildren)
|
||||
}
|
||||
}
|
||||
@@ -1352,8 +1338,10 @@ private fun applyDensity(defaults: UIDefaults) {
|
||||
val oldDensityName = defaults.get(densityKey) as? String
|
||||
val newDensity = UISettings.getInstance().uiDensity
|
||||
if (oldDensityName == newDensity.name) {
|
||||
return // re-applying the same density would break HiDPI-scalable values like Tree.rowHeight
|
||||
// re-applying the same density would break HiDPI-scalable values like Tree.rowHeight
|
||||
return
|
||||
}
|
||||
|
||||
defaults.put(densityKey, newDensity.name)
|
||||
if (newDensity == UIDensity.DEFAULT) {
|
||||
// Special case: we need to set this one to its default value even in non-compact mode, UNLESS it was already set by the theme.
|
||||
@@ -1364,6 +1352,7 @@ private fun applyDensity(defaults: UIDefaults) {
|
||||
defaults.put(JBUI.CurrentTheme.VersionControl.Log.rowHeightKey(), JBUI.CurrentTheme.VersionControl.Log.defaultRowHeight())
|
||||
}
|
||||
}
|
||||
|
||||
if (newDensity == UIDensity.COMPACT) {
|
||||
// toolbars
|
||||
defaults.put(JBUI.CurrentTheme.Toolbar.horizontalInsetsKey(), cmInsets(2, 4))
|
||||
@@ -1448,4 +1437,6 @@ private fun cmInsets(topAndBottom: Int, leftAndRight: Int): Insets = Insets(topA
|
||||
@Suppress("UseDPIAwareInsets")
|
||||
private fun cmInsets(top: Int, left: Int, bottom: Int, right: Int): Insets = Insets(top, left, bottom, right)
|
||||
|
||||
private fun JBInsets.withTopAndBottom(topAndBottom: Int) = JBInsets(topAndBottom, unscaled.left, topAndBottom, unscaled.right)
|
||||
private fun JBInsets.withTopAndBottom(topAndBottom: Int) = JBInsets(topAndBottom, unscaled.left, topAndBottom, unscaled.right)
|
||||
|
||||
private fun defaultNonLaFSchemeName(dark: Boolean) = if (dark) DarculaLaf.NAME else EditorColorsScheme.DEFAULT_SCHEME_NAME
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.ui.laf
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import java.awt.Component
|
||||
import java.awt.Graphics
|
||||
import javax.swing.Icon
|
||||
@@ -8,7 +9,10 @@ import javax.swing.JMenu
|
||||
import javax.swing.JMenuItem
|
||||
import javax.swing.plaf.UIResource
|
||||
|
||||
open class MenuArrowIcon(val icon: () -> Icon, val selectedIcon: () -> Icon, val disabledIcon: () -> Icon) : Icon, UIResource {
|
||||
@Internal
|
||||
open class MenuArrowIcon(@JvmField val icon: () -> Icon,
|
||||
@JvmField val selectedIcon: () -> Icon,
|
||||
@JvmField val disabledIcon: () -> Icon) : Icon, UIResource {
|
||||
override fun paintIcon(c: Component, g: Graphics, x: Int, y: Int) {
|
||||
if (c is JMenuItem) {
|
||||
if (!c.model.isEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user