[527567] Generalize the table and tree merge viewer framework

This is in preparation for the property merge viewer support.

Add context menu support to AbstractStructuredMergeViewer. Most of the
implementation is generic so that subclasses need only override
createAction(MergeMode, Diff).

Provide AbstractTableOrTreeItemWrapper.isExpandable() so that the
content provider doesn't need to be used to determine if a tree item has
a +/- icon or not.

Improve the implementation of AbstractTableOrTreeMergeViewer. Do a
better job painting the items correctly in handlePaintItemEvent (so
that the selection highlight box of a tree item doesn't look left
shifted as it does without these changes). Avoid ever painting focus
highlighting; it doesn't look nice in the table viewer, especially when
we paint out own diff boxes. Avoid using the expensive content provider
to determine the +/- icon. Avoid drawing the connecting line on top of
the hover information. Compute bounds in a way that works well for an
arbitrary number of columns with arbitrary missing or present icons and
text for each column.

ImproveTreeMergeViewer to provide createTreeViewer(Composite) so we can
control the style and even implementation of tree viewer's tree used by
a subclass.

Generalize MergeAction.getSelectedDifferences(IStructuredSelection) so
that a selection that is directly diffs will work correctly and use that
in PapyrusTreeContentMergeViewer.createMergeViewer(Composite,
MergeViewerSide), TableContentMergeViewer.createMergeViewer(Composite,
MergeViewerSide), and
TreeContentMergeViewer.createMergeViewer(Composite, MergeViewerSide)

Factor out AbstractTreeContentMergeViewer from TreeContentMergeViewer so
that we can reuse all this stuff in the Properties merge viewer.

The logic in
EMFCompareContentMergeViewer.commandStackChanged(EventObject) misses the
case that the transactional command stack wraps the command in a
compound command.

Bug: 527567
Change-Id: I08a41a47838aa30c6857142145489bb64c472652
Signed-off-by: Philip Langer <planger@eclipsesource.com>
9 files changed