Bug 112222 - [WorkbenchParts] ISaveablePart2's DEFAULT constant is respected only if a single part is being closed
Summary: [WorkbenchParts] ISaveablePart2's DEFAULT constant is respected only if a sin...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-11 10:56 EDT by Dusko CLA
Modified: 2006-05-19 13:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dusko CLA 2005-10-11 10:56:01 EDT
The constant is returned from the ISaveablePart2's promptToSaveOnClose() 
method to indicate to Eclipse that the default prompting mechanism should be 
used for that part.

However, that is respected only if there is a single part involved in the 
close operation. If there are multiple parts involved and any one of them 
returns DEFAULT, it is not respected. That basically renders the DEFAULT value 
not usable since it has different behavior depending on the number of parts 
being closed and the individual parts have no feedback on how they will be 
treated when they return this value.
Comment 1 Paul Webster CLA 2005-11-18 14:14:21 EST
I think this has to do with the timing of the DEFAULT return value ... after
we've deleted it from the list of dirty parts.

It can be re-ordered.

PW
Comment 2 Paul Webster CLA 2005-11-23 08:43:45 EST
Released a fix into HEAD >20051123

Now, on multiple close any ISaveablePart2 that returns DEFAULT should be allowed to drop through and participate with the other ISaveableParts.

PW
Comment 3 Paul Webster CLA 2005-12-13 11:00:16 EST
on Solaris-Motif I20051213-0010

PW
Comment 4 Nick Edgar CLA 2005-12-19 16:13:49 EST
Paul, does this also double-check the isDirty() flag?
Comment 5 Nick Edgar CLA 2005-12-19 16:14:23 EST
More context for the previous question: see the "saving ISaveablePart2's" thread in the eclipse.platform newsgroup.
Comment 6 Paul Webster CLA 2005-12-20 07:32:21 EST
So we double-check the flags for ISaveablePart2 ... if you have p1 and p2, p1 is checked, is dirty, and gets saved (and in the operation saves p2), p2 is check and is not dirty and is skipped.

But for the ISaveableParts it just a list that's first passed to a dialog for user selection, then passed to a save-loop.

I could put another isDirty() check in at either of those ISaveablePart steps.

PW
Comment 7 Nick Edgar CLA 2005-12-20 09:31:33 EST
I think adding that check would make sense for the case where multiple parts share the same model, which is pretty common.
Comment 8 Paul Webster CLA 2005-12-20 12:05:52 EST
Added some extra checks:

1. if an ISaveablePart2 takes action, filter the dirty list so it only contains dirty parts

2. when saving the dirty list, check isDirty() one last time before calling doSave().

Released into HEAD >20051220

PW
Comment 9 Nick Edgar CLA 2006-01-11 12:56:16 EST
Can this be closed?
Comment 10 Dusko CLA 2006-01-11 13:22:41 EST
If it works :)
I haven't adopted 3.2M4 yet so I cannot test it just yet but I am sure that you guys have tested it properly and the proposed solution sounded just fine to me.
Comment 11 Paul Webster CLA 2006-01-13 06:58:08 EST
it looks good

PW
Comment 12 Paul Webster CLA 2006-05-19 13:04:50 EDT
verified in RC5
PW