Create an Editor for a non physical file
I need to create an editor which has no underlying file (from the file system), but information coming from database.
Is it possible to define a VirtualFile and implement custom read/write (e.g. from/to database)?
Please sign in to leave a comment.
Hello Dan,
Yes, you can provide your own VirtualFileSystem and VirtualFile implementations
which are not backed by files on disk. As an example, you can look at VcsVirtualFileSystem
class in the OpenAPI sources.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hello Dmitry,
Thank you very much! Was exactly what I needed.
Dan
Hello Dmitry,
so far so good... i am able to open a custom virtual file in the editor, nevertheless only the highlighter is being triggered, the parser not...
What can I possible do wrong here?
Thanks,
Dan
Hey Dmitry,
I can't seem to locate the openapi sources for the life of me.
Would there be a link available? Sorry for the noob question.
Thanks,
Mark.
Hello Mark,
http://www.jetbrains.com/idea/plugins/plugin_developers.html
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks Dmitry,
Turns out that I had mixed up the idea-7.0.3-1.5jdk.zip with the idea-7.0.3-dev.zip.
I found the VcsFileSystem mentioned above I was just looking at the VcsVirtualFile though
and it insists on requiring a path. I don't have a path as the Virtual file does not correspond to
a file on disk? Can I provide null for this or do I need to provide it with some sort of temporary
file on disk ?
Thanks,
Mark.
Hello Mark,
You do not need a file on disk, but you do need some kind of a path (that
will be used, for example, for showing the tab title).
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"