Clean up "Compare With" actions
Replace the old-style <objectContribution> to org.eclipse.ui.popupMenus
by command/handler combos. Remove the defaultHandlers for those
commands, and the now unused legacy actions. Re-order the commands as
they were.
Prevent the "Compare With" menu from appearing in the context menus of
the left or right ruler in editors: apply the same work-around as for
the "Team" menu, i.e., suppress the menu for #OverviewRulerContext and
for #AbstractTextEditorRulerContext.
There should be no functional or visual change except that the commands
are hidden completely when not enabled (as opposed to being visible but
disabled).
The four commands had to be handled in one change to preserve the order
in which they appear in the sub-menu. Doing this one by one would lead
to intermediary states where the order was different.
* CompareIndexWithHead: activate the handler on a single selection for
which hasStagedChanges() is true. Hide it when not enabled. Make the
ResourceStatePropertyTester also work for items that adapt
only to IPath but not to IResource, like StagingEntry, otherwise
the new <handler> definition would not be active for those, which
would have broken the comparison on a staged file (double click) in
the staging view. Remove the now unused CompareIndexWithHeadAction,
and the alwaysCheckEnabled() work-around.
* CompareWithPrevious: activate handler only if the selection indeed
has tracked resources. Formerly, the command was enabled for
untracked resources, but then presented a dialog that it couldn't
find any previous version. Add a new property "hasTrackedResources"
to the ResourceStatePropertyTester.
* CompareWithIndex: de-activate the handler if there are only ignored
resources in the selection. The command works in that case, too, but
simply presented an empty comparison in that case, which is a bit
pointless.
Prevent NPE in CompareTreeView if the comparison is empty.
* CompareWithHead: disable if there are no non-ignored resources in
the selection.
Bug: 495064
Change-Id: Ia9fd7768f417f2d2ac08fd271a04da9da15cc7c7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>