mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-142012 Evaluate Code Fragment - mouse click on autocomplete puts it behind the dialog
This commit is contained in:
@@ -527,20 +527,6 @@ public class IdeFrameImpl extends JFrame implements IdeFrameEx, DataProvider {
|
||||
return b;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Component findNearestModalComponent(@NotNull Component c) {
|
||||
Component eachParent = c;
|
||||
while (eachParent != null) {
|
||||
if (eachParent instanceof IdeFrame) return eachParent;
|
||||
if (eachParent instanceof JDialog) {
|
||||
if (((JDialog)eachParent).isModal()) return eachParent;
|
||||
}
|
||||
eachParent = eachParent.getParent();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public final BalloonLayout getBalloonLayout() {
|
||||
return myBalloonLayout;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.*;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.openapi.wm.impl.IdeFrameImpl;
|
||||
import com.intellij.openapi.wm.impl.IdeGlassPaneImpl;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
@@ -782,7 +781,7 @@ public class AbstractPopup implements JBPopup {
|
||||
myMouseOutCanceller.myEverEntered = targetBounds.equals(original);
|
||||
}
|
||||
|
||||
myOwner = IdeFrameImpl.findNearestModalComponent(owner);
|
||||
myOwner = getFrameOrDialog(owner); // use correct popup owner for non-modal dialogs too
|
||||
if (myOwner == null) {
|
||||
myOwner = owner;
|
||||
}
|
||||
@@ -1862,4 +1861,22 @@ public class AbstractPopup implements JBPopup {
|
||||
private boolean isBusy() {
|
||||
return myResizeListener != null && myResizeListener.isBusy() || myMoveListener != null && myMoveListener.isBusy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first frame (or dialog) ancestor of the component.
|
||||
* Note that this method returns the component itself if it is a frame (or dialog).
|
||||
*
|
||||
* @param component the component used to find corresponding frame (or dialog)
|
||||
* @return the first frame (or dialog) ancestor of the component; or {@code null}
|
||||
* if the component is not a frame (or dialog) and is not contained inside a frame (or dialog)
|
||||
*
|
||||
* @see UIUtil#getWindow
|
||||
*/
|
||||
private static Component getFrameOrDialog(Component component) {
|
||||
while (component != null) {
|
||||
if (component instanceof Frame || component instanceof Dialog) return component;
|
||||
component = component.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user