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?

0
Avatar
Permanently deleted user

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

0

请先登录再写评论。