[jdk] Add a checkbox in the settings to disable JDK updates

#IDEA-330415 Fixed

GitOrigin-RevId: f669e4e59832816fe5fb7d9107ca24dd03ed60b0
This commit is contained in:
Louis Vignier
2024-04-24 18:47:38 +02:00
committed by intellij-monorepo-bot
parent 4a3dcd0b5e
commit a33d7253a0
6 changed files with 48 additions and 1 deletions

View File

@@ -528,6 +528,7 @@
serviceImplementation="com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl"
overrides="true"/>
<updateSettingsUIProvider implementation="com.intellij.openapi.projectRoots.impl.JdkUpdaterConfigurable"/>
<postStartupActivity implementation="com.intellij.openapi.projectRoots.impl.ExistingJdkConfigurationActivity"/>
<postStartupActivity implementation="com.intellij.openapi.projectRoots.impl.SdkmanrcWatcher"/>
<registryKey key="jdk.configure.existing" defaultValue="false" description="Attempt to add an existing SDK to the SDK table."/>

View File

@@ -0,0 +1,22 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.projectRoots.impl
import com.intellij.java.JavaBundle
import com.intellij.openapi.updateSettings.impl.UpdateSettingsUIProvider
import com.intellij.openapi.util.registry.Registry
import com.intellij.ui.dsl.builder.BottomGap
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.bindSelected
class JdkUpdaterConfigurable: UpdateSettingsUIProvider {
override fun init(panel: Panel) {
panel.apply {
row {
checkBox(JavaBundle.message("checkbox.check.for.jdk.updates"))
.bindSelected({ Registry.`is`("jdk.updater") }, { Registry.get("jdk.updater").setValue(it) })
}
.bottomGap(BottomGap.MEDIUM)
}
}
}

View File

@@ -1932,4 +1932,5 @@ intention.name.delete.method=Delete method ''{0}()''
intention.name.delete.method.title=Delete Method ''{0}()''
intention.name.delete.method.with.callees=... along with other private methods used only there
intention.name.delete.method.only=... and nothing else
intention.family.name.delete.private.method=Delete private method
intention.family.name.delete.private.method=Delete private method
checkbox.check.for.jdk.updates=Check for JDK updates

View File

@@ -136,6 +136,10 @@ class UpdateSettingsConfigurable @JvmOverloads constructor (private val checkNow
var wasEnabled = settings.isCheckNeeded || settings.isPluginsCheckNeeded
UpdateSettingsUIProvider.EP_NAME.forEachExtensionSafe {
it.init(this)
}
onApply {
val isEnabled = settings.isCheckNeeded || settings.isPluginsCheckNeeded
if (isEnabled != wasEnabled) {

View File

@@ -0,0 +1,18 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.updateSettings.impl
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.ui.dsl.builder.Panel
import org.jetbrains.annotations.ApiStatus
/**
* This EP makes it possible for plugins to add any UI to Settings | Appearance & Behavior | System Settings | Updates.
*/
interface UpdateSettingsUIProvider {
companion object {
@ApiStatus.Internal
val EP_NAME = ExtensionPointName<UpdateSettingsUIProvider>("com.intellij.updateSettingsUIProvider")
}
fun init(panel: Panel)
}

View File

@@ -395,6 +395,7 @@
<extensionPoint name="streamProviderFactory" interface="com.intellij.configurationStore.StreamProviderFactory" area="IDEA_PROJECT" dynamic="true"/>
<extensionPoint name="updateSettingsProvider" interface="com.intellij.openapi.updateSettings.impl.UpdateSettingsProvider" dynamic="true"/>
<extensionPoint name="updateSettingsUIProvider" interface="com.intellij.openapi.updateSettings.impl.UpdateSettingsUIProvider" dynamic="true"/>
<extensionPoint name="externalComponentSource" interface="com.intellij.ide.externalComponents.ExternalComponentSource" dynamic="true"/>
<extensionPoint name="webHelpProvider" interface="com.intellij.openapi.help.WebHelpProvider" dynamic="true"/>