summaryrefslogtreecommitdiff
path: root/plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt')
-rw-r--r--plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt b/plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt
new file mode 100644
index 000000000000..a304a606bcf8
--- /dev/null
+++ b/plugins/kotlin/frontend-independent/src/org/jetbrains/kotlin/idea/util/editorUtils.kt
@@ -0,0 +1,13 @@
+// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.kotlin.idea.util
+
+import com.intellij.ide.DataManager
+import com.intellij.openapi.actionSystem.IdeActions
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.editor.actionSystem.EditorActionManager
+
+fun Editor.executeEnterHandler() {
+ EditorActionManager.getInstance()
+ .getActionHandler(IdeActions.ACTION_EDITOR_ENTER)
+ .execute(/* editor = */ this, /* contextCaret = */ null, /* dataContext = */ DataManager.getInstance().getDataContext(component))
+}