close breakpoint balloon on editor scroll
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 26 Jun 2015 10:55:18 +0000 (13:55 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 26 Jun 2015 10:57:00 +0000 (13:57 +0300)
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java

index 35b98b6fc5cb1e65a31168fe1e9be3b994743a91..2e49099c9b1b3143dfb54c469fbfa74462b6a732 100644 (file)
 package com.intellij.xdebugger.impl.ui;
 
 import com.intellij.codeInsight.hint.HintUtil;
+import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorGutter;
 import com.intellij.openapi.editor.LogicalPosition;
 import com.intellij.openapi.editor.colors.EditorColorsScheme;
 import com.intellij.openapi.editor.colors.EditorColorsUtil;
+import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
 import com.intellij.openapi.keymap.KeymapUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.popup.*;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.DimensionService;
-import com.intellij.openapi.util.Getter;
-import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.ui.AppUIUtil;
@@ -55,9 +55,7 @@ import org.jetbrains.concurrency.Promise;
 
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
+import java.awt.event.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 public class DebuggerUIUtil {
@@ -266,6 +264,20 @@ public class DebuggerUIUtil {
       }
     });
 
+    final ComponentAdapter moveListener = new ComponentAdapter() {
+      @Override
+      public void componentMoved(ComponentEvent e) {
+        balloon.hide();
+      }
+    };
+    component.addComponentListener(moveListener);
+    Disposer.register(balloon, new Disposable() {
+      @Override
+      public void dispose() {
+        component.removeComponentListener(moveListener);
+      }
+    });
+
     if (whereToShow == null) {
       balloon.showInCenterOf(component);
     }