How to preserve the state of a VirtualFile that does not physically exists in the FileSystem

I’m working on a JetBrains plugin where I open a custom editor tab that renders a web page using JCEF. This is done by attaching a VirtualFile to the editor, which then loads the JCEF browser component inside the editor tab. When the editor is moved (for example, to another split or to a different tab group), I need to transfer the state from old editor to the new one. An editor state is preserved in IntelliJ only if either of the following conditions are met (Please see: intellij-community/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.kt at 6e43b3144cc2a4b244c0bfcc5e7bdfa3c9a131e2 · JetBrains/intellij-community · GitHub):

  1. The VirtualFile used to render the WebView is an instance of the OptionallyIncluded interface, or

  2. The VirtualFile physically exists in the file system.

The problem I am facing is that, IntelliJ marked OptionallyIncluded interface as internal. So, I cannot use that. And since I am loading a JCEF component inside the editor by attaching it to a VirtualFile, it does not physically exists in the FileSystem.

Is there any work around for this?

Is it related to this topic? What task are you trying to solve?

Yes it is. After debugging the IntelliJ IDE, I found that the above stated issue was the root cause. Therefore, I would like to know if there is a way to preserve the state of a JCEF component that is rendered inside a VirtualFile since it does not physically exists in the file system.