Fix focus restoration in CommitEditor pages
commitfdf10f1325b4133eba2f31a3e073cee517097611
authorThomas Wolf <thomas.wolf@paranor.ch>
Tue, 20 Dec 2016 11:55:36 +0000 (20 12:55 +0100)
committerThomas Wolf <thomas.wolf@paranor.ch>
Wed, 21 Dec 2016 12:05:11 +0000 (21 13:05 +0100)
tree6ea661e9ee339e5ccd7ab94a7a62c28ff0ef01e1
parentb4ab8390f1675d377f245880b86311e242c3f870
Fix focus restoration in CommitEditor pages

FormPage by default re-sets the focus to the first child of the
managed form. In the CommitEditorPage, this is not convenient;
it'll always set focus on the author indication. Add focus tracking
to identify the control currently having the focus so that it can
be re-focused when the page becomes active again after a page
change or editor de-activation.

Because of the vagaries of focus handling in MultiPageEditorParts,
this turned out to be more convoluted than expected. Depending on
how the focus gets set (through the page or through the editor),
focus is either set via the page's SWT control directly, or
through an IFormPart registered in the ManagedForm. So provide
both mechanisms.

Bug: 509486
Change-Id: I678bdfde9105d04669a42ad81502eb1064c470bc
Also-by: Markus Keller <markus_keller@ch.ibm.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Markus Keller <markus_keller@ch.ibm.com>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/FocusManagerFormPart.java [new file with mode: 0644]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/FocusTracker.java [new file with mode: 0644]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/HeaderText.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/StashEditorPage.java