Community
Participate
Working Groups
build I20060125 When the Properties view is active and is showing properties from a view that can save its changes (i.e. it implements ISaveablePart), the Save action does not work as expected. Instead of saving the source of the properties, it targets the active editor (which may be completely unrelated to the Properties view or its source part). In the worst case, this can lead to lost work due to unexpected overwriting of the editor's source file. This is a major usability issue in some Eclipse-based products.
Since the SaveAction looks for ISaveablePart using both direct instanceof checks on the active part, and getAdapter(ISaveablePart.class), I can address this problem by having the Properties view provide an ISaveablePart adapter that delegates back to the source part (actually, it can answer the source part directly). PageBookView.getAdapter already delegates to the active page, then to the platform adapter manager. It now also calls getViewAdapter in between, which can be overridden it subclasses. PropertySheet overrides getViewAdapter and calls getSaveablePart() for the ISaveablePart.class case, which returns the source part (getCurrentContributingPart()). For the default property sheet page, however, getCurrentContributingPart() returns null, so we need to handle this specially in PropertySheetPage. PropertySheetPage now remembers the source part, and has logic to clean this reference up when the source part is closed (previously it would continue showing properties from the closed part).
This bug is part of an effort to address broader save/close lifecycle concerns in 3.2. See bug 112225 comment 11 for an overview of the general problem.
I would recommend renaming IDocument to something else. The concept being represented has no direct connection to a document, and may not be textual at all. It might be better to use the word "Model" in some form or another. Perhaps one of the following: + IModel + ISavableModel + IModelWithHandlers + IEditorModel + IEditableModel
See bug 112225 comment 22. I've gone with ISaveableModel and ISaveableModelSource. Note that these APIs are not involved in the fix for this bug.
Closing as fixed.
Verified in I20060213-1200 using Saveable Mock View from tests as source view.
Also added a test for this: PropertySheetAuto.testSaveableRetargeting()