diff-preview: move escape handler setup to file editor constructor
[idea/community.git] / platform / diff-impl / src / com / intellij / diff / editor / DiffVirtualFile.kt
1 // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
2 package com.intellij.diff.editor
3
4 import com.intellij.diff.impl.DiffRequestProcessor
5 import com.intellij.openapi.actionSystem.AnAction
6 import com.intellij.openapi.project.Project
7 import com.intellij.openapi.util.Key
8 import com.intellij.openapi.vfs.VirtualFileWithoutContent
9 import com.intellij.testFramework.LightVirtualFile
10
11 abstract class DiffVirtualFile(name: String) :
12   LightVirtualFile(name, DiffFileType.INSTANCE, ""), DiffContentVirtualFile, VirtualFileWithoutContent {
13
14   abstract fun createProcessor(project: Project): DiffRequestProcessor
15
16   override fun isWritable(): Boolean = false
17
18   override fun toString(): String = "${javaClass.name}@${Integer.toHexString(hashCode())}"
19
20   companion object {
21     @JvmField
22     val ESCAPE_HANDLER = Key<AnAction?>("ESCAPE_HANDLER")
23   }
24 }