FileEditor questions
Hi,
I want to create a plugin which should offer the ability to edit certain
xml files using an own FileEditor (like source editor or GUI builder
editor). But how to assoziate the file extension with my editor class,
so a double-click at the xml-file in the project will open my editor?
I've taken a look at ImageEditor from Alexey Efimov, but was not able to
open an editor by double-clicking images :(
Thanks in advance.
--
Cheers,
Tom
Please sign in to leave a comment.
It must open... Hmm... That version of IDEA you test?
So, common logic is:
1. You implement FileEditorProvider
2. Check by IDEA request, can you edit file or not.
3. If your FileEditorProvider catch file for editing, then you may control
how it will be edited. As main editor, and disable other editors and as
additional editor - the editor will have tabs on botton.
Thanks!
Build 1178.
I've created 3 implementations of
com.intellij.openapi.components.ApplicationComponent,
com.intellij.openapi.fileEditor.FileEditorProvider and
com.intellij.openapi.fileEditor.FileEditor. The content of the
META-INF/plugin.xml looks like:
FormBuilder FormBuilder Plugin 0.0.1 Thomas Singer de.regnis.formbuilder.FormBuilderApplicationComponent ]]>
But how do I tell IDEA the name of my FileEditorProvider?
Tom
Hello!
You must do implement both ApplicationComponent and FileEditorProvider for
your editor:
This all that you need to create your ouw editor :)
Thanks!
Thomas Singer (MoTJ) wrote:
The trick is that the ApplicationComponent also has to implement the
FileEditorProvider, like this:
public class ExampleFileEditorProvider implements ApplicationComponent, FileEditorProvider { }
Then IDEA will find it by itself.
Sascha
>
I check it just now, it work on double click and open images :)
Sorry, this does not work - neither with my plugin nor with imageEditor.
When I double click a file (which is shown as ) I get an "Register
New Extension" dialog, but there is no imageEditor available...
Maybe somebody from IntelliJ can comment on this issue?
Tom
Well, not here :( What icons your graphics have in IDEA's Project view?
Tom
Does it mean, IDEA calls accept(Project, VirtualFile) for all plugin's
Application-/ProjectComponents which implement FileEditorProvider and
takes the first one which returns true?
Tom
Thomas Singer (MoTJ) wrote:
I'm pretty sure this is the way it works. However, for unknown file types you'll
always get IDEA's file-type selection box first. As far as I know there's currently
no way for an EditorProvider to register new file types, so this has to be done
manually once.
Sascha
Tom,
I have registered Custom type for binary... So, if you look for '?' as icon,
then you need register custom type.
Ah, OK, now it is working. I expected, that when IDEA shows the Register
New Extension dialog without any hint of the imageEditor, that IDEA did
not recognized that there is a custom file editor behind.
Any related RFE to vote for?
Tom
Any words of API of "FileTypeManager" was in NNTP, but Open API still not
allow do this from plugin.
Greetings!
I make it as workaround in PLUS. Take a look at PLUS 0.1.2 API.
Thanks!
See subject.
Tom
Hi,
IDEA handles document saving internally. Also you may look at com.intellij.openapi.fileEditor.FileDocumentManager may be it helps.
TIA,
Dmitry
Could you please be a little bit more precise about the details? In what
relation FileEditor and Document stay? Could you please provide a simple
example, e.g. by using a JTextArea for editing text files? Thanks in
advance.
Tom
Hi,
Probaly like this:
By FileDocumentManager.getDocument(VirtualFile file) you'll get Document for your file. And after this you can do everithing you want with it.
Hope it helps.
TIA,
Dmitry
Where can I get this Image Editor code?