Bug 125386 - [PropertiesView] Properties view should delegate Save back to source part
Summary: [PropertiesView] Properties view should delegate Save back to source part
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2006-01-26 15:55 EST by Nick Edgar CLA
Modified: 2016-06-09 15:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2006-01-26 15:55:11 EST
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.
Comment 1 Nick Edgar CLA 2006-01-26 16:05:14 EST
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).
Comment 2 Nick Edgar CLA 2006-01-26 16:06:15 EST
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.
Comment 3 Douglas Pollock CLA 2006-01-27 09:17:15 EST
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

Comment 4 Nick Edgar CLA 2006-01-31 11:06:42 EST
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.

Comment 5 Nick Edgar CLA 2006-02-09 22:21:49 EST
Closing as fixed.
Comment 6 Nick Edgar CLA 2006-02-13 16:55:24 EST
Verified in I20060213-1200 using Saveable Mock View from tests as source view.
Comment 7 Nick Edgar CLA 2006-02-13 17:09:45 EST
Also added a test for this: PropertySheetAuto.testSaveableRetargeting()