Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Typical editors go through an open-modify-save-close lifecycle. When the editor is opened, the init(IEditorSite, IEditorInput) method is called to set the editor’s initial content. When the user modifies the editor’s content, the editor must notify others that its content is now “dirty” by using the firePropertyChange(int) method. When a user saves the editor’s content, the firePropertyChange(int) method must be used again to notify registered listeners that the editor’s content is no longer dirty. Eclipse automatically registers listeners to perform various tasks based on the value returned by the isDirty() method, such as updating the editor’s title, adding or removing an asterisk preceding the title, and enabling the Save menu. Finally, when the editor is closed, the editor’s content is saved if the isDirty() method returns true.
You need to ensure that the editor knows whether its content has been modified by the user since the last save operation. To do this, introduce this new field to track whether the current page has been modified relative to the other pages: