Programmatically make use of eclipse's merge and diff viewers

898 views Asked by At

When a text conflict occurs in Bazaar (and many other dvcs) a .BASE, .THIS and .OTHER file is produced. Its then up to the user to make use of an 3 way merge tool to merge the conflict and then mark it as resolved.

I would like to get hold of all the registered merge viewers in eclipse and give the user an option to merge the conflict with any one of these. (with the TextMergeViewer being an default option). I suspect that I would need to some how programmatically provide the 3 files to these mergeviewers and maybe write some custom code to wrap the BASE, THIS and OTHER files to tell the merge viewer where the differences are. (interpret the "herringbone" markers like <<<<<<<. etc)

1

There are 1 answers

1
VonC On BEST ANSWER

Not exactly an answer, but at least some starting points:

You could try looking into the code of the current Compare Viewer using the Plug-in Spy (directly available with eclipse3.5)

alt text
(source: eclipse.org)

(ALT+SHIFT+F1)

Most of the eclipse sources are also available here.
The org.eclipse.compare.CompareUI is a start, for example.

Once you have a basic understanding of how the Compare mechanism works as a plugin, you can write an fragment (also illustrated here) to extend the current compare plugin.