Community
Participate
Working Groups
While reading bug 53657 ... I found it weird that isDirty e.g. is not propaged if you use addPage(IFormPage). Only by looking at the implementation and finding out that it uses MPE#addPage(Control) internally, then reading the MPE doc to isDirty: /** * The <code>MultiPageEditorPart</code> implementation of this <code>IEditorPart</code> * method returns whether the contents of any of this multi-page editor's * nested editors have changed since the last save. Pages created with <code>addPage(Control)</code> * are ignored. one comes up with this conclusion. The doc of all addPage methods should be improved to clearly state whether a listener is attached or not.
In a typical implementation (e.g. all of the PDE editors), source page(s) host the entire file, while form pages show various aspects of the reconciler model. Threfore, pages themselves are not dirty - the model itself is dirty. For source pages, there is 1->1 mapping between reconciling model and the page, which is not the case for form pages. If you check PDEFormEditor class, you will notice that it also checks inputContextManager, which hosts one reconciling model for each source page. So if you make a change in one of the form pages that will make one of the models dirty, the editor will be dirty.
The more I think of it, the more I am convinced that 'isDirty' on FormEditor should be overriden to also check IFormPage.isDirty.
Fixed by overriding isDirty() and checking all the pages that implement IFormPage, delegating to super if none are dirty.