diff-preview: move escape handler setup to file editor constructor
[idea/community.git] / platform / diff-impl / src / com / intellij / diff / editor / DiffRequestProcessorEditor.kt
index 449f54a46a5598a6f2835f1c06a6970fb351da6d..6bd9c1bd78f0eb181c967f4cb43e16f68242a27b 100644 (file)
@@ -6,6 +6,7 @@ import com.intellij.diff.util.DiffUserDataKeysEx
 import com.intellij.diff.util.DiffUtil
 import com.intellij.diff.util.FileEditorBase
 import com.intellij.openapi.Disposable
 import com.intellij.diff.util.DiffUtil
 import com.intellij.diff.util.FileEditorBase
 import com.intellij.openapi.Disposable
+import com.intellij.openapi.actionSystem.CommonShortcuts
 import com.intellij.openapi.diagnostic.logger
 import com.intellij.openapi.diff.DiffBundle
 import com.intellij.openapi.fileEditor.FileEditor
 import com.intellij.openapi.diagnostic.logger
 import com.intellij.openapi.diff.DiffBundle
 import com.intellij.openapi.fileEditor.FileEditor
@@ -46,6 +47,8 @@ open class DiffRequestProcessorEditor(
 
     processor.component.registerKeyboardAction({ Disposer.dispose(this) },
                                                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), WHEN_IN_FOCUSED_WINDOW)
 
     processor.component.registerKeyboardAction({ Disposer.dispose(this) },
                                                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), WHEN_IN_FOCUSED_WINDOW)
+
+    file.getUserData(DiffVirtualFile.ESCAPE_HANDLER)?.registerCustomShortcutSet(CommonShortcuts.ESCAPE, component, this)
   }
 
   override fun getComponent(): JComponent = panel
   }
 
   override fun getComponent(): JComponent = panel