Read-only section in editor

Some of our source files are generated (by custom templates using Objecteering).
The build regularly breaks after newly generated sources are commited, beause some developer edited protected sections of those source files and these changes are lost.

Is it possible to write a plugin that creates read-only sections in the editor to prevent developers making any changes there (at least from within Idea)?

(I am afraid not, because the code generated by Idea's own GUI-Designer, also creates such sections, but those aren't shown as read-only either.)

0
5 comments
Avatar
Permanently deleted user

Stephen Friedrich wrote:

Is it possible to write a plugin that creates read-only sections in the editor to prevent developers making any changes there (at least from within Idea)?


See com.intellij.openapi.editor.Document#createGuardedBlock & friends

Sascha

1

Thank Sascha. I searched for "section" and "protected" to and fro, but did not think of either "block" nor "guarded" ;)

0

Hello, this question was asked more then 10 years ago and I am just wondering is there a way in InteliJ to create guarded blocks of code in a single file?

0

Thanks for the answer. But my goal is a user of IntelliJ, I would like to protect some pieces of the code, not sure how to do that.

0

Please sign in to leave a comment.