Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1747)

Unified Diff: editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java

Issue 236633003: Issue 2031. Close omnibox's popup when Editor lost focus. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java
diff --git a/editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java b/editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java
index d39decac673716f1648d4876b7defe275e04468e..673f2e513287291b4e9ed84eda0f017d4b5bdf09 100644
--- a/editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java
+++ b/editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java
@@ -29,6 +29,8 @@ import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -424,6 +426,20 @@ public class OmniBoxControlContribution {
handleFocusLost();
}
});
+
+ // close popup when Editor lost focus
+ textControl.getShell().addShellListener(new ShellAdapter() {
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ Shell activeShell = Display.getCurrent().getActiveShell();
+ if (activeShell == null) {
+ if (popup != null) {
+ popup.close();
+ popup = null;
+ }
+ }
+ }
+ });
}
private void openPopup() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698