intercepting file open operation


is it possible to intercept file open operation and perform custom action instead of calling default editor?

context: I'm trying to build custom editor for certain flavor of .json files using MPS plugin with custom persistence. Models are persisted to 'module.json' files and I want MPS plugin to be invoked for editing them. Looks like currently there's no way to do it other than intercepting file opening.

another issue is once files are changed via MPS plugin, IDEA doesn't see file changes, e.g. they're not marked as changed in VCS, so I'll probably need to tell IDEA about it. Any clues how to do it?

see also:


1 comment
Comment actions Permalink

If You want to replace default editor, You can implement com.intellij.openapi.fileEditor.FileEditorProvider interface and override com.intellij.openapi.fileEditor.FileEditorProvider#getPolicy as follows:

    @NotNull     @Override     public FileEditorPolicy getPolicy() {         return FileEditorPolicy.HIDE_DEFAULT_EDITOR;     }


Please sign in to leave a comment.