chore: [NO BACKPORT] Fix deprecations

This commit is contained in:
FalsePattern 2024-11-07 16:29:32 +01:00
parent f704b6c936
commit 28527cddb4
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
7 changed files with 17 additions and 17 deletions

View file

@ -29,6 +29,7 @@ import com.intellij.openapi.options.SimpleConfigurable
import com.intellij.util.xmlb.XmlSerializerUtil import com.intellij.util.xmlb.XmlSerializerUtil
import com.intellij.xdebugger.settings.DebuggerSettingsCategory import com.intellij.xdebugger.settings.DebuggerSettingsCategory
import com.intellij.xdebugger.settings.XDebuggerSettings import com.intellij.xdebugger.settings.XDebuggerSettings
import java.util.function.Supplier
class ZigDebuggerSettings: XDebuggerSettings<ZigDebuggerSettings>("Zig") { class ZigDebuggerSettings: XDebuggerSettings<ZigDebuggerSettings>("Zig") {
var debuggerKind = DebuggerKind.default var debuggerKind = DebuggerKind.default
@ -58,9 +59,10 @@ class ZigDebuggerSettings: XDebuggerSettings<ZigDebuggerSettings>("Zig") {
GENERAL_SETTINGS_ID, GENERAL_SETTINGS_ID,
ZigDebugBundle.message("settings.debugger.title"), ZigDebugBundle.message("settings.debugger.title"),
ZigDebuggerGeneralSettingsConfigurableUi::class.java, ZigDebuggerGeneralSettingsConfigurableUi::class.java,
) { Supplier {
instance instance
} }
)
} }
companion object { companion object {

View file

@ -46,13 +46,11 @@ import kotlin.io.path.pathString
class ZLSSettingsPanel(private val project: Project?) : Disposable { class ZLSSettingsPanel(private val project: Project?) : Disposable {
private val zlsPath = textFieldWithBrowseButton( private val zlsPath = textFieldWithBrowseButton(
project, project,
ZLSBundle.message("settings.zls-path.browse.title"), FileChooserDescriptorFactory.createSingleFileDescriptor().withTitle(ZLSBundle.message("settings.zls-path.browse.title")),
FileChooserDescriptorFactory.createSingleFileDescriptor(),
).also { Disposer.register(this, it) } ).also { Disposer.register(this, it) }
private val zlsConfigPath = textFieldWithBrowseButton( private val zlsConfigPath = textFieldWithBrowseButton(
project, project,
ZLSBundle.message("settings.zls-config-path.browse.title"), FileChooserDescriptorFactory.createSingleFileDescriptor().withTitle(ZLSBundle.message("settings.zls-config-path.browse.title"))
FileChooserDescriptorFactory.createSingleFileDescriptor()
).also { Disposer.register(this, it) } ).also { Disposer.register(this, it) }
private val buildOnSave = JBCheckBox().apply { toolTipText = ZLSBundle.message("settings.build-on-save.tooltip") } private val buildOnSave = JBCheckBox().apply { toolTipText = ZLSBundle.message("settings.build-on-save.tooltip") }

View file

@ -67,7 +67,7 @@ class ZigModuleBuilder: ModuleBuilder() {
internal val peer = ZigProjectGeneratorPeer(true) internal val peer = ZigProjectGeneratorPeer(true)
override fun getComponent(): JComponent { override fun getComponent(): JComponent {
return peer.component.withBorder() return peer.myComponent.withBorder()
} }
override fun disposeUIResources() { override fun disposeUIResources() {

View file

@ -50,7 +50,7 @@ class ZigNewProjectWizard: LanguageGeneratorNewProjectWizard {
override fun setupUI(builder: Panel): Unit = with(builder) { override fun setupUI(builder: Panel): Unit = with(builder) {
row { row {
cell(peer.component).align(AlignX.FILL) cell(peer.myComponent).align(AlignX.FILL)
} }
} }

View file

@ -24,6 +24,7 @@ package com.falsepattern.zigbrains.project.newproject
import com.intellij.ide.util.projectWizard.SettingsStep import com.intellij.ide.util.projectWizard.SettingsStep
import com.intellij.openapi.Disposable import com.intellij.openapi.Disposable
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.ui.ValidationInfo import com.intellij.openapi.ui.ValidationInfo
import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.Disposer
import com.intellij.platform.ProjectGeneratorPeer import com.intellij.platform.ProjectGeneratorPeer
@ -32,12 +33,13 @@ import javax.swing.JComponent
class ZigProjectGeneratorPeer(var handleGit: Boolean): ProjectGeneratorPeer<ZigProjectConfigurationData>, Disposable { class ZigProjectGeneratorPeer(var handleGit: Boolean): ProjectGeneratorPeer<ZigProjectConfigurationData>, Disposable {
private val newProjectPanel: ZigNewProjectPanel = ZigNewProjectPanel(handleGit).also { Disposer.register(this, it) } private val newProjectPanel: ZigNewProjectPanel = ZigNewProjectPanel(handleGit).also { Disposer.register(this, it) }
private val myComponent: JComponent by lazy { val myComponent: JComponent by lazy {
panel { panel {
newProjectPanel.attach(this) newProjectPanel.attach(this)
} }
} }
override fun getComponent(): JComponent {
override fun getComponent(myLocationField: TextFieldWithBrowseButton, checkValid: Runnable): JComponent {
return myComponent return myComponent
} }

View file

@ -59,8 +59,7 @@ class ZigProjectSettingsPanel(private val project: Project?) : Disposable {
private val direnv = JBCheckBox(ZigBrainsBundle.message("settings.project.label.direnv")) private val direnv = JBCheckBox(ZigBrainsBundle.message("settings.project.label.direnv"))
private val pathToToolchain = textFieldWithBrowseButton( private val pathToToolchain = textFieldWithBrowseButton(
project, project,
ZigBrainsBundle.message("dialog.title.zig-toolchain"), FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(ZigBrainsBundle.message("dialog.title.zig-toolchain"))
FileChooserDescriptorFactory.createSingleFolderDescriptor()
).also { ).also {
it.textField.document.addDocumentListener(object : DocumentAdapter() { it.textField.document.addDocumentListener(object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) { override fun textChanged(e: DocumentEvent) {
@ -82,8 +81,7 @@ class ZigProjectSettingsPanel(private val project: Project?) : Disposable {
} }
private val pathToStd = textFieldWithBrowseButton( private val pathToStd = textFieldWithBrowseButton(
project, project,
ZigBrainsBundle.message("dialog.title.zig-std"), FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(ZigBrainsBundle.message("dialog.title.zig-std"))
FileChooserDescriptorFactory.createSingleFolderDescriptor()
).also { Disposer.register(this, it) } ).also { Disposer.register(this, it) }
private var debounce: Job? = null private var debounce: Job? = null

View file

@ -32,7 +32,7 @@ import com.intellij.util.SuspendingLazy
import com.intellij.util.application import com.intellij.util.application
import kotlinx.coroutines.* import kotlinx.coroutines.*
inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = TaskCancellation::cancellable, noinline action: suspend CoroutineScope.() -> T): T { inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = {TaskCancellation.cancellable()}, noinline action: suspend CoroutineScope.() -> T): T {
return if (application.isDispatchThread) { return if (application.isDispatchThread) {
runWithModalProgressBlocking(taskOwnerFactory(), titleFactory(), cancellationFactory(), action) runWithModalProgressBlocking(taskOwnerFactory(), titleFactory(), cancellationFactory(), action)
} else { } else {
@ -40,7 +40,7 @@ inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleF
} }
} }
inline fun <T> SuspendingLazy<T>.getOrAwaitModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = TaskCancellation::cancellable): T { inline fun <T> SuspendingLazy<T>.getOrAwaitModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = {TaskCancellation.cancellable()}): T {
if (isInitialized()) { if (isInitialized()) {
return getInitialized() return getInitialized()
} else { } else {