Alternative Editors ala HTML Preview
In the Demetra Beta the HTML editor gets a tabgroup on the bottom where you can switch between the HTML editor and a Preview view. Way cool.
Is this mechanism available to plugin developers? And can it be applied to any kind of file?
What I would like to do is attach a custom editor to a HTML or XML file and present an alternative editor for it.
S.
Please sign in to leave a comment.
You have to register a component which implements FileEditorProvider. In the accept() method you can decide if your editor is suitable for the given file, and in createEditor() you have to return your custom editor.
Hello Stefan,
SA> In the Demetra Beta the HTML editor gets a tabgroup on the bottom
SA> where you can switch between the HTML editor and a Preview view. Way
SA> cool.
SA>
SA> Is this mechanism available to plugin developers? And can it be
SA> applied to any kind of file?
SA>
SA> What I would like to do is attach a custom editor to a HTML or XML
SA> file and present an alternative editor for it.
It's a very old feature in fact. If there are multiple com.intellij.openapi.fileEditor.FileEditorProvider
components that return true from the accept() method for a VirtualFile, the
editors returned from createEditor() are placed in tabs.
--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"
Then you create new Editor, you will define policy for it.
You can replace standard editor or show your editor together.
See FileEditorProvider and FileEditor interfaces. Images plugin source have it as sample.
Excellent :)
Thanks to both!
S.