I created a language to define an easy ontolgy. From time to time, the status of the defined ontology should be written to a database. So I am confronted with a problem about renaming entities. If I rename an entity, It is hard to manage the renaming on database level, because I do not have Ids integrated in the files that define the ontology but only the names. I want to manage it by adding a history to the entities represented by PSIElements in form of a List<String> oldNames: Everytime setName() is called, the old name is stored. However, setName() is only called when I use the rename refactoring of IntelliJ. So what I want is to avoid that a user can just delete a entity in editor mode but only by the rename functionality of intelliJ by using CTRL-F6. Is it possible to make an PSIElement uneditable after recognized by the Lexer? Or at least to trigger a warning dialog if the user tries to manipulate a PSIElement the usual way?
Thanks in advance, Sebastian