com.intellij.openapi.fileEditor
Interface FileEditorProvider


public interface FileEditorProvider


Method Summary
 boolean accept(Project project, VirtualFile file)
           
 FileEditor createEditor(Project project, VirtualFile file)
          Creates editor for the specified file.
 void disposeEditor(FileEditor editor)
          Disposes the specified editor.
 java.lang.String getEditorTypeId()
           
 FileEditorPolicy getPolicy()
           
 FileEditorState readState(org.jdom.Element sourceElement, Project project, VirtualFile file)
          Deserializes state from the specified sourceElemet
 void writeState(FileEditorState state, Project project, org.jdom.Element targetElement)
          Serializes state into the specified targetElement
 

Method Detail

accept

boolean accept(Project project,
               VirtualFile file)
Parameters:
file - file to be tested for acceptance. This parameter is never null.
Returns:
whether the provider can create valid editor for the specified file or not

createEditor

FileEditor createEditor(Project project,
                        VirtualFile file)
Creates editor for the specified file. This method is called only if the provider has accepted this file (i.e. method accept(Project, VirtualFile) returned true). The provider should return only valid editor.

Returns:
created editor for specified file. This method should never return null.

disposeEditor

void disposeEditor(FileEditor editor)
Disposes the specified editor. It is guaranteed that this method is invoked only for editors created with this provider.

Parameters:
editor - editor to be disposed. This parameter is always not null.

readState

FileEditorState readState(org.jdom.Element sourceElement,
                          Project project,
                          VirtualFile file)
Deserializes state from the specified sourceElemet


writeState

void writeState(FileEditorState state,
                Project project,
                org.jdom.Element targetElement)
Serializes state into the specified targetElement


getEditorTypeId

java.lang.String getEditorTypeId()
Returns:
id of type of the editors that are created with this FileEditorProvider. Each FileEditorProvider should have unique non null id. The id is used for saving/loading of EditorStates.

getPolicy

FileEditorPolicy getPolicy()
Returns:
policy that specifies how show editor created via this provider be opened
See Also:
FileEditorPolicy.NONE, FileEditorPolicy.HIDE_DEFAULT_EDITOR, FileEditorPolicy.PLACE_BEFORE_DEFAULT_EDITOR