18.5.8 Diff presentation
A DiffPresentation expects a collection with two pieces of text from the display:
block, and it displays the difference between these with a dedicated user interface widget.
A simple use case can be encountered when browsing a collection of Duplication entities computed by SmallDude (see Chapter 7). Duplication offers information about referenceText
and about duplicateText
. Thus, we can pass this information to the DiffPresentation and we get back a user interface as in the below example:
| browser |
browser := GLMTabulator new.
browser title: 'Duplication Browser'.
browser row: #duplications; row: #diff span: 2.
browser showOn: #duplications; using: [browser list].
browser showOn: #diff; from: #duplications; using: [
browser diff display: [:dup |
Array with: dup referenceText with: dup duplicateText ]].
browser openOn: MooseModel root allModels anyOne allDuplications.
The DiffPresentation does not populate any port.