Refactor the action handling in the git history view
commite2b8f79c298982e582fe9ebc07ceaaeb11aa2cab
authorThomas Wolf <thomas.wolf@paranor.ch>
Thu, 6 Oct 2016 21:49:53 +0000 (6 23:49 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 12 Oct 2016 22:43:40 +0000 (13 00:43 +0200)
tree771498aafe9482c2e2b1d25dd847c9b801019767
parent478dd60305f4b235d40de2e81d49f05ad710978a
Refactor the action handling in the git history view

Commit bc712de04 broke the handling of global actions. The git history
view has three viewers, each with their own actions (and context menus).
Each called updateActionBars() to register and unregister global
actions when it got or lost the focus. This interfered badly with the
new dynamic search toolbar item because updateActionBars() also updates
the toolbar and re-creates that dynamic item every time. However, the
change made in bc712de04 was not correct; global action registrations
were no longer propagated to the RetargetActions.

Introduce a new class ActionUtils for the creation and registration of
global actions provided by widgets. Register and unregister actions via
the global IHandlerService. This gets rid of duplicated code in the
three viewer classes, updates only the global action handlers but not
the toolbar, and also enables the accelerators for these commands in
the CommitEditorPage and StashEditorPage.

Finally use getPath() instead of getNewPath() in the copy implementation
in CommitFileDiffViewer so that it also works for deleted files.

Bug: 503198
Change-Id: I0ee88c4f03f5fbcab86099cc498c68a2b077b1fa
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java [new file with mode: 0644]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitGraphTable.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java