Fix representation toggle commands in the repositories view
commit55e1dadd03534212e829c6bea6398b8224974784
authorThomas Wolf <thomas.wolf@paranor.ch>
Fri, 21 Apr 2017 09:25:36 +0000 (21 11:25 +0200)
committerThomas Wolf <thomas.wolf@paranor.ch>
Fri, 5 May 2017 09:53:26 +0000 (5 05:53 -0400)
tree4b36a777e5b263f09454e220feb3af229db35f41
parent43a007c85ddbfa88131533ea242490b00a659372
Fix representation toggle commands in the repositories view

Make the ToggleBranchCommit and the ToggleBranchHierarchy commands
work also when invoked (for instance via Quick Access) when the
currently active view is not the repositories view.

These two commands use default handlers; when invoked via Quick
Access for instance when the Outline view was the active view,
they would produce an ExecutionException since no active view
could be determined. The commands would thus execute halfway
through: they'd update the command's state, but then fail and
instead of refreshing the view would pop up an error dialog.

I see no reason to restrict those two commands to be available
only when the repositories view is the active view. So instead
of eliminating the default handler, change the implementation
such that the commands work in any case.

Bug: 495064
Change-Id: Ib6b0c9fd38940efd6a15c0a0fd20be2a247ee7ec
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AbstractToggleCommand.java [copied from org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/ToggleBranchHierarchyCommand.java with 52% similarity]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/ToggleBranchCommitCommand.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/ToggleBranchHierarchyCommand.java