Search code examples
eclipse-plugineclipse-rcptext-editorundo

Set document back to clean after an "Undo" operation in an Eclipse TextEditor


I am building a custom text editor in Eclipse, and I've noticed a behaviour that I expected to be handled natively by the JFace TextEditor.

After modifying a document, this document is set to dirty. After going back to the initial state with the "Undo" feature, I expected that the dirty state would be reset so that the user knows he does not have to save it. It is not the case: the document is still marked as dirty.

I've searched in the JFace source code and did not find a way of knowing that the document is on the same state that the last time it has been saved.

Do you have any idea where I can search further? Thanks.


Solution

  • I was using a FileDocumentProvider that did not handle the dirty state as I expected. I switched to a TextFileDocumentProvider that seems to do the job.

    Question closed