Merge branch 'master' of git@git.labs.intellij.net:idea/community
[idea/community.git] / platform / platform-impl / src / com / intellij / ui / popup / AbstractPopup.java
index f98e932bd2835bf06203dd7449f80d78fc89cde4..f478155c40caae6027e6c5df6728dddfb0edcfe9 100644 (file)
@@ -144,6 +144,7 @@ public class AbstractPopup implements JBPopup {
 
   private JTextField mySpeedSearchPatternField;
   private boolean myNativePopup;
+  private boolean myMayBeParent;
 
 
   AbstractPopup() {
@@ -181,7 +182,8 @@ public class AbstractPopup implements JBPopup {
                      final boolean headerAlwaysFocusable,
                      @NotNull List<Pair<ActionListener, KeyStroke>> keyboardActions,
                      Component settingsButtons,
-                     @Nullable final Processor<JBPopup> pinCallback) {
+                     @Nullable final Processor<JBPopup> pinCallback,
+                     boolean mayBeParent) {
 
     if (requestFocus && !focusable) {
       assert false : "Incorrect argument combination: requestFocus=" + requestFocus + " focusable=" + focusable;
@@ -192,6 +194,7 @@ public class AbstractPopup implements JBPopup {
     myPopupBorder = PopupBorder.Factory.create(true);
     myShadowed = !movable  && !resizable && Registry.is("ide.popup.dropShadow");
     myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner());
+    myMayBeParent = mayBeParent;
 
     myContent.add(component, BorderLayout.CENTER);
     if (adText != null) {
@@ -692,6 +695,12 @@ public class AbstractPopup implements JBPopup {
       ((JWindow)myWindow).getRootPane().putClientProperty(KEY, this);
     }
 
+    if (myWindow != null) {
+      if (!myMayBeParent) {
+        WindowManager.getInstance().doNotSuggestAsParent(myWindow);  
+      }
+    }
+
     SwingUtilities.invokeLater(new Runnable() {
       public void run() {
         if (isDisposed()) return;