mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
drop error on kotlin functions as data providers
Java chooses the most specific method for SAM. But kotlin prefers its own functions. Fixes IJPL-156284 Stash: apply and pop buttons are always disabled GitOrigin-RevId: ac2a0471a8fcd668f57db63550a80d0a476e29ca
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6f1d4a96a4
commit
fb0d89a8ef
@@ -1,6 +1,7 @@
|
||||
// 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.actionSystem
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -89,6 +90,7 @@ interface DataSink {
|
||||
fun uiDataSnapshot(provider: DataProvider)
|
||||
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(DataSink.javaClass)
|
||||
|
||||
@ApiStatus.Obsolete
|
||||
@JvmStatic
|
||||
@@ -114,6 +116,10 @@ interface DataSink {
|
||||
if (provider is DataProvider) {
|
||||
sink.uiDataSnapshot(provider)
|
||||
}
|
||||
if (provider is Function1<*, *>) {
|
||||
LOG.error("Kotlin functions are not supported, use " +
|
||||
"DataProvider/EdtDataProvider/DataSnapshotProvider explicitly")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.intellij.platform.navbar.frontend.compatibility
|
||||
import com.intellij.ide.CopyPasteDelegator
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.DataKey
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.DataSnapshot
|
||||
import com.intellij.openapi.actionSystem.EdtDataRule
|
||||
@@ -22,10 +23,10 @@ internal class NavBarEdtDataRule : EdtDataRule {
|
||||
sink[PlatformDataKeys.COPY_PROVIDER] = delegator.copyProvider
|
||||
sink[PlatformDataKeys.PASTE_PROVIDER] = delegator.pasteProvider
|
||||
|
||||
DataSink.uiDataSnapshot(sink) { dataId: String ->
|
||||
DataSink.uiDataSnapshot(sink, DataProvider { dataId ->
|
||||
extensionData(dataId) { innerDataId ->
|
||||
snapshot[DataKey.create(innerDataId)]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.openapi.fileEditor.ex
|
||||
|
||||
import com.intellij.ide.impl.DataValidators
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.actionSystem.DataSnapshot
|
||||
import com.intellij.openapi.actionSystem.EdtDataRule
|
||||
@@ -216,9 +217,9 @@ abstract class FileEditorManagerEx : FileEditorManager() {
|
||||
val project = snapshot[PlatformDataKeys.PROJECT] ?: return
|
||||
val caret = snapshot[PlatformDataKeys.CARET] ?: return
|
||||
getInstanceEx(project).dataProviders.forEach { provider ->
|
||||
DataSink.uiDataSnapshot(sink) { dataId: String ->
|
||||
DataSink.uiDataSnapshot(sink, DataProvider { dataId ->
|
||||
provider.getData(dataId, caret.editor, caret)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.openapi.vcs.changes.savedPatches
|
||||
|
||||
import com.intellij.ide.util.treeView.TreeState
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.DataProvider
|
||||
import com.intellij.openapi.actionSystem.DataSink
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.ClearableLazyValue
|
||||
@@ -66,9 +67,9 @@ class SavedPatchesTree(project: Project,
|
||||
if (visibleProvidersList.isNotEmpty()) {
|
||||
val selectedObjects = selectedPatchObjects()
|
||||
visibleProvidersList.forEach { provider ->
|
||||
DataSink.uiDataSnapshot(sink) { dataId: String ->
|
||||
DataSink.uiDataSnapshot(sink, DataProvider { dataId ->
|
||||
provider.getData(dataId, selectedObjects)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user