Mapping left/right to old/new in Compare API two-way diffs [message #324173] |
Fri, 18 January 2008 05:54 |
Eclipse User |
|
|
|
Hi,
While implementing some custom diff and merge viewers, I noticed various
quirks of the Compare API:
- In Eclipse's compare viewers "new" is usually on the left side (e.g.
when using "Compare - With Each Other" from the "History" view. This is
somehow against intuition (at least for left-to-right locales). OK.
- When using "Compare - With Each Other" from a navigator, whatever
element that happens to be the first one in the selection is regarded as
the "new" element, independent of the file date, CVS revision etc. I
guess this behaviour occurs because it's impossible to extract an
unambiguous timestamp from all kinds of compare input, so that's OK, too.
- However, org.eclipse.compare.structuremergeviewer.Differencer
generates an addition for left == null, right != null. I found some code
in compare viewer classes (CompareConfiguration,
DiffTreeViewer.DiffViewerLabelProvider etc.) that seems to swap left and
right for the purpose of display. However, this is quite confusing when
accessing or generating DiffNodes in your own code.
Niklas
|
|
|
Powered by
FUDForum. Page generated in 0.03596 seconds