Bug 14371

Summary: TextMergeViewer.sameDoc() is broken
Product: [Eclipse Project] Platform Reporter: Jeff Brown <jeff_brown>
Component: CompareAssignee: Andre Weinand <andre_weinand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: James_Moody, Kevin_McGuire
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 12467    

Description Jeff Brown CLA 2002-04-22 18:31:27 EDT
Context:
  - create a TextMergeViewer instance
  - set the input using an ICompareInput
  - make the left and/or right leg dirty
  - set the input using an IStreamContentAccessor as input for 
    the left and/or right leg of a new instance of ICompareInput

The expected behaviour is that the viewer will prompt the user
to save changes or to discard them.  This behaviour is controlled
by the sameDoc() method of TextMergeViewer which determines if the
IDocument instances associated with the left, right, and ancestor
legs are the same for both the old input and the new input.

This method uses getDocument() for each leg, which in the case of
an IStreamContentAccessor input, asks the DocumentManager for a
cached working copy.  For the old input, this is fine since the
DocumentManager still contains the old working copy.  For the new
input, however, this usually returns 'null' because no copy has
yet been cached.

So in this case sameDoc() will always return 'true' for each leg!
Hence the user will never be prompted to save changes and sometimes
they will be lost.

This is a serious issue for VCM because many of its components are
built around IStreamContentAccessors and exhibit the problem.
Comment 1 Andre Weinand CLA 2002-05-15 05:48:38 EDT
fixed in > 20020514