mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-10 12:34:06 +02:00
Use SimpleDataContext instead of the obsolete DataContextWrapper
This commit is contained in:
parent
7eda176162
commit
4ca187926c
src/main/java/com/maddyhome/idea/vim
@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks
|
||||
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx
|
||||
import com.intellij.openapi.command.CommandProcessor
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy
|
||||
@ -83,8 +84,7 @@ internal class IjActionExecutor : VimActionExecutor {
|
||||
* Data context that defines that some action was started from IdeaVim.
|
||||
* You can call use [runFromVimKey] key to define if intellij action was started from IdeaVim
|
||||
*/
|
||||
val dataContext = DataContextWrapper(context.ij)
|
||||
dataContext.putUserData(runFromVimKey, true)
|
||||
val dataContext = SimpleDataContext.getSimpleContext(runFromVimKey, true, context.ij)
|
||||
|
||||
val actionId = ActionManager.getInstance().getId(ijAction)
|
||||
val event = AnActionEvent(
|
||||
|
@ -9,20 +9,19 @@
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.UserDataHolder
|
||||
import com.intellij.openapi.actionSystem.DataKey
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
|
||||
internal open class IjEditorExecutionContext(override val context: DataContext) : ExecutionContext
|
||||
|
||||
// This key is stored in data context when the action is started from vim
|
||||
internal val runFromVimKey = Key.create<Boolean>("RunFromVim")
|
||||
internal val runFromVimKey = DataKey.create<Boolean>("RunFromVim")
|
||||
|
||||
/**
|
||||
* Check if the action with this data context was started from Vim
|
||||
*/
|
||||
internal val DataContext.actionStartedFromVim: Boolean
|
||||
get() = (this as? UserDataHolder)?.getUserData(runFromVimKey) ?: false
|
||||
get() = this.getData(runFromVimKey) == true
|
||||
|
||||
val DataContext.vim: ExecutionContext
|
||||
get() = IjEditorExecutionContext(this)
|
||||
|
Loading…
Reference in New Issue
Block a user