cleanup bootstrap: obsolete API

GitOrigin-RevId: f02c228279b9a94a314e6b6052be7763e015ea25
This commit is contained in:
Roman Shevchenko
2025-11-10 23:07:25 +00:00
committed by intellij-monorepo-bot
parent 101421c4d8
commit f4cadab06c
4 changed files with 15 additions and 18 deletions
@@ -1,6 +1,4 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplaceGetOrSet")
package com.intellij.idea
import com.intellij.accessibility.enableScreenReaderSupportIfNeeded
@@ -30,7 +28,6 @@ import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.IntellijInternalApi
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.util.registry.RegistryManager
import com.intellij.openapi.util.registry.migrateRegistryToAdvSettings
@@ -44,6 +41,7 @@ import com.intellij.platform.ide.diagnostic.startUpPerformanceReporter.FUSProjec
import com.intellij.ui.mac.touchbar.TouchbarSupport
import com.intellij.ui.updateAppWindowIcon
import com.intellij.util.io.URLUtil.SCHEME_SEPARATOR
import com.intellij.util.system.OS
import kotlinx.coroutines.*
import org.jetbrains.annotations.ApiStatus
import java.nio.file.Path
@@ -290,13 +288,12 @@ private fun postOpenUiTasks(scope: CoroutineScope) {
updateAppWindowIcon(JOptionPane.getRootFrame())
}
if (SystemInfoRt.isMac) {
@Suppress("GrazieInspection")
if (OS.CURRENT == OS.macOS) {
scope.launch(CoroutineName("mac touchbar on app init")) {
TouchbarSupport.onApplicationLoaded()
}
}
else if (SystemInfoRt.isUnix && SystemInfo.isJetBrainsJvm) {
else if (OS.CURRENT != OS.Windows && SystemInfo.isJetBrainsJvm) {
scope.launch(CoroutineName("input method disabling on Linux")) {
disableInputMethodsIfPossible()
}
@@ -352,7 +349,7 @@ private fun linksToActions(errors: MutableList<HtmlChunk>): Collection<AnAction>
while (!errors.isEmpty()) {
val builder = StringBuilder()
errors.get(errors.lastIndex).appendTo(builder)
errors[errors.lastIndex].appendTo(builder)
val error = builder.toString()
if (error.startsWith(link)) {
@@ -40,7 +40,6 @@ import com.intellij.openapi.extensions.impl.ExtensionsAreaImpl
import com.intellij.openapi.extensions.useOrLogError
import com.intellij.openapi.keymap.KeymapManager
import com.intellij.openapi.updateSettings.impl.UpdateSettings
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.openapi.util.SystemPropertyBean
import com.intellij.openapi.util.io.OSAgnosticPathUtil
import com.intellij.platform.diagnostic.telemetry.TelemetryManager
@@ -54,6 +53,7 @@ import com.intellij.ui.ExperimentalUI
import com.intellij.util.PlatformUtils
import com.intellij.util.io.URLUtil
import com.intellij.util.io.createDirectories
import com.intellij.util.system.OS
import com.jetbrains.JBR
import kotlinx.coroutines.*
import org.jetbrains.annotations.ApiStatus.Internal
@@ -315,7 +315,7 @@ private suspend fun preloadNonHeadlessServices(app: ApplicationImpl, initLafJob:
}
// https://youtrack.jetbrains.com/issue/IDEA-341318
if (SystemInfoRt.isLinux && System.getProperty("idea.linux.scale.workaround", "false").toBoolean()) {
if (OS.CURRENT == OS.Linux && System.getProperty("idea.linux.scale.workaround", "false").toBoolean()) {
// ActionManager can use UISettings (KeymapManager doesn't use it but just to be sure)
initLafJob.join()
}
@@ -16,7 +16,6 @@ import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.ui.popup.util.PopupUtil
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.ui.awt.RelativePoint
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.panels.VerticalLayout
@@ -24,6 +23,7 @@ import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.popup.list.SelectablePanel
import com.intellij.util.SystemProperties
import com.intellij.util.system.OS
import com.intellij.util.text.DateTimeFormatManager
import com.intellij.util.ui.*
import com.sun.jna.platform.win32.Advapi32Util
@@ -224,7 +224,7 @@ internal fun getLanguageAndRegionDialogIfNeeded(): (suspend () -> Boolean)? {
val locale = Locale.getDefault()
val matchingLocale = languageMapping.keys.find { language -> languageMapping[language]?.any { locale.toLanguageTag().contains(it) } == true } ?: Locale.ENGLISH
var matchingRegion = Region.NOT_SET
if (SystemInfoRt.isWindows) {
if (OS.CURRENT == OS.Windows) {
try {
val region = Advapi32Util.registryGetStringValue(WinReg.HKEY_CURRENT_USER, "Control Panel\\International\\Geo", "Name")
matchingRegion = regionMapping.keys.find { region == regionMapping[it] } ?: Region.NOT_SET
@@ -233,7 +233,7 @@ internal fun getLanguageAndRegionDialogIfNeeded(): (suspend () -> Boolean)? {
logger<LanguageAndRegionDialog>().warn("Unable to resolve region from registry", e)
}
}
else if (SystemInfoRt.isMac) {
else if (OS.CURRENT == OS.macOS) {
matchingRegion = regionMapping.keys.find { locale.country == regionMapping[it] }
?: getLocaleFromGeneralPrefMacOs(SystemProperties.getUserHome())
?: getLocaleFromGeneralPrefMacOs("")
@@ -271,4 +271,4 @@ private fun getLocaleFromGeneralPrefMacOs(rootPath: String): Region? {
logger<LanguageAndRegionDialog>().warn("Unable to resolve region from $fullPath", e)
return null
}
}
}
@@ -16,7 +16,6 @@ import com.intellij.openapi.application.ex.ApplicationInfoEx
import com.intellij.openapi.application.impl.AWTExceptionHandler
import com.intellij.openapi.application.setUserInteractiveQosForEdt
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.openapi.wm.WeakFocusStackManager
import com.intellij.platform.diagnostic.telemetry.impl.span
import com.intellij.ui.AppUIUtil
@@ -25,6 +24,7 @@ import com.intellij.ui.icons.CoreIconManager
import com.intellij.ui.isWindowIconAlreadyExternallySet
import com.intellij.ui.scale.JBUIScale
import com.intellij.ui.updateAppWindowIcon
import com.intellij.util.system.OS
import com.intellij.util.ui.RawSwingDispatcher
import com.intellij.util.ui.StartupUiUtil
import com.intellij.util.ui.accessibility.ScreenReader
@@ -90,7 +90,7 @@ private suspend fun initLafAndScale(isHeadless: Boolean, preloadFontJob: Job?) {
}
// we don't need Idea LaF to show splash, but we do need some base LaF to compute system font data (see below for what)
if (SystemInfoRt.isLinux) {
if (OS.CURRENT == OS.Linux) {
preloadFontJob?.join()
}
}
@@ -104,7 +104,7 @@ private suspend fun initLafAndScale(isHeadless: Boolean, preloadFontJob: Job?) {
// to compute the system scale factor on non-macOS (JRE HiDPI is not enabled), we need to know system font data,
// and to compute system font data, we need to know `Label.font` UI default (that's why we compute base LaF first)
if (!isHeadless && !SystemInfoRt.isMac) {
if (!isHeadless && OS.CURRENT != OS.macOS) {
JBUIScale.preload {
runActivity("base LaF defaults getting") { baseLaF.defaults }
}
@@ -115,7 +115,7 @@ internal fun scheduleInitAwtToolkit(scope: CoroutineScope, lockSystemDirsJob: Jo
val task = scope.launch {
// this should happen before UI initialization - if we're not going to show the UI (in case another IDE instance is already running),
// we shouldn't initialize AWT toolkit to avoid unnecessary focus stealing and space switching on macOS.
if (SystemInfoRt.isMac) {
if (OS.CURRENT == OS.macOS) {
lockSystemDirsJob.join()
}
@@ -197,7 +197,7 @@ private suspend fun replaceIdeEventQueue(isHeadless: Boolean) {
private fun blockATKWrapper() {
// the registry must not be used here, because this method is called before application loading
@Suppress("SpellCheckingInspection")
if (!SystemInfoRt.isLinux || !System.getProperty("linux.jdk.accessibility.atkwrapper.block", "true").toBoolean()) {
if (OS.CURRENT != OS.Linux || !System.getProperty("linux.jdk.accessibility.atkwrapper.block", "true").toBoolean()) {
return
}