Bug 14371 - TextMergeViewer.sameDoc() is broken
Summary: TextMergeViewer.sameDoc() is broken
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 12467
  Show dependency tree
 
Reported: 2002-04-22 18:31 EDT by Jeff Brown CLA
Modified: 2002-05-15 05:48 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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