Is there something like ReadonlyModificationHandler for read-only Document?

The modification of a guarded block in the document is customizable via ReadonlyFragmentModificationHandler. Is there something similar for a readonly Document (Document.setReadonly(true))?
The application simply throws a com.intellij.openapi.editor.ReadOnlyModificationException in the backend when a readonly document is being edited. Is there a way to intercept this exception and display a proper error message for certain types of documents?

1 comment
Comment actions Permalink

Yes. If you need it to show read-only Editor, you can use EditorFactory.createViewer() instead of EditorFactory.createEditor().


Please sign in to leave a comment.