user2035039
user2035039

Reputation: 971

How to mark Eclipse editor as dirty while not ignoring other changes made in the editor

I added an OutlinePage to my Eclipse TextEditor and when changes are made in this Outline, the TextEditor has to be marked as dirty. The proposed way to do this is to use

firePropertyChange(IEditorPart.PROP_DIRTY)

However, I have to manage the dirty flag by myself as well and return it in

isDirty()

But that means, that the dirty flag is not automatically set if the TextEditor's content is changed. I thought about adding an IPartProperyChangeListener and changing the flag by myself. Is that the best way to to that?

Upvotes: 0

Views: 1038

Answers (1)

greg-449
greg-449

Reputation: 111142

An alternative is to use ISaveablesSource which allows your editor to have multiple Saveable objects. Each Saveable has a separate dirty flag.

If you are using a text editor based on AbstractTextEditor or one of its subclasses then the editor already implements ISaveablesSource and provides a Saveable for the main editor, so you would just add a Saveable for your outline data.

Upvotes: 1

Related Questions