Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-11-14 22:18:53 +0000
committerThomas Wolf2016-11-20 10:32:24 +0000
commit0f9a531c250a732c923e9a28c5a2a09f3bdbfa40 (patch)
tree3130f26fcc89462a08b60f56d7b7f6413b719789
parent47213bad0d4e033734e797d090386d574300a3ac (diff)
downloadegit-0f9a531c250a732c923e9a28c5a2a09f3bdbfa40.tar.gz
egit-0f9a531c250a732c923e9a28c5a2a09f3bdbfa40.tar.xz
egit-0f9a531c250a732c923e9a28c5a2a09f3bdbfa40.zip
Don't steal the focus in the find widget of the history view
The find toolbar widget of the history view does some ugly focus juggling. Make sure to do this only initially, or when the widget is explicitly shown by the user triggering the findToolbarAction, but not when the control is re-created in response to other events, such as switching between history pages. This focus back-and-forth is a hack, but unfortunately it's the only way I have found to fix the wrong background of the whole toolbar when showing the find widget makes the toolbar move from right of the tabs to below the tabs. Bug: 507484 Change-Id: I96c2cadeb988612371dceeddc2f8967cc9566e1a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
index bea3ac89f6..cc414a4754 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
@@ -879,6 +879,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
private ICommitsProvider provider;
+ private boolean wasVisible = false;
+
private final CommitGraphTable graph;
private final IAction openCloseToggle;
@@ -988,6 +990,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
// It will be disposed by the IToolBarManager
toolbar = null;
openCloseToggle.setChecked(false);
+ wasVisible = false;
}
@Override
@@ -1007,11 +1010,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
openCloseToggle.setChecked(true);
// If the toolbar was moved below the tabs, we now have
// the wrong background. It disappears when one clicks
- // elsewhere. Looks like an inactive selection... Let's
- // fix that: parent is the ToolBar, grand-parent is a
- // Composite with the freak background.
- // toolbar.getParent().getParent().setBackground(null);
- // Doesn't help?! Let's try changing the focus:
+ // elsewhere. Looks like an inactive selection... No
+ // way found to fix this but this ugly focus juggling:
graph.getControl().setFocus();
toolbar.setFocus();
} else if (!visible && !graph.getControl().isDisposed()) {
@@ -1035,6 +1035,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
toolbar.addListener(SWT.FocusOut, mouseListener);
toolbar.addListener(SWT.MouseDown, mouseListener);
toolbar.addListener(SWT.MouseUp, mouseListener);
+ toolbar.addListener(SWT.Modify,
+ (e) -> lastText = toolbar.getText());
toolbar.addStatusListener(statusListener);
toolbar.addSelectionListener(selectionListener);
boolean hasInput = provider != null;
@@ -1050,6 +1052,10 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
}
lastSearchContext = null;
lastObjectId = null;
+ if (wasVisible) {
+ return toolbar;
+ }
+ wasVisible = true;
// This fixes the wrong background when Eclipse starts up with the
// search bar visible.
toolbar.getDisplay().asyncExec(new Runnable() {

Back to the top