IDEA-66794 Help Topics window opens behind main IDEA frame with certain conditions (cherry picked from commit 9bad095)

This commit is contained in:
Vassiliy Kudryashov
2012-03-26 12:36:02 +04:00
parent d3e15d4230
commit 3064d7633b
@@ -15,7 +15,10 @@
*/
package com.intellij.help.impl;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.impl.IdeFocusManagerHeadless;
import com.intellij.ui.AppUIUtil;
import com.intellij.util.Alarm;
import org.jetbrains.annotations.NotNull;
import javax.help.*;
@@ -207,6 +210,9 @@ class IdeaHelpBroker extends DefaultHelpBroker implements KeyListener{
//myFrame.setLocationRelativeTo(null);
myFrame.setVisible(visible);
myFrame.setState(JFrame.NORMAL);
IdeFocusManager focusManager = IdeFocusManager.findInstance();
JComponent target = focusManager.getFocusTargetFor(myFrame.getRootPane());
focusManager.requestFocus(target != null ? target : myFrame, true);
}
}
@@ -671,8 +677,9 @@ class IdeaHelpBroker extends DefaultHelpBroker implements KeyListener{
if(myDialog.isShowing()){
myDialog.hide();
}
if(myOwnerWindow!=null)
if (myOwnerWindow != null) {
myOwnerWindow.removeWindowListener(dl);
}
myOwnerWindow=null;
modalDeactivated=true;
}
@@ -694,22 +701,24 @@ class IdeaHelpBroker extends DefaultHelpBroker implements KeyListener{
}
}
} else{
if(myFrame==null){
myFrame=new JFrame(helpTitle);
if (myFrame == null) {
myFrame = new JFrame(helpTitle);
resize = true;
AppUIUtil.updateFrameIcon(myFrame);
WindowListener l=new WindowAdapter(){
public void windowClosing(WindowEvent e){
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
myFrame.setVisible(false);
}
public void windowClosed(WindowEvent e){
public void windowClosed(WindowEvent e) {
myFrame.setVisible(false);
}
};
myFrame.addWindowListener(l);
} else
}
else {
pos = myFrame.getLocation();
}
if(myDialog!=null){
pos=myDialog.getLocation();
size=myDialog.getSize();