IDEA-278414 A tool in View Mode Window is instantly getting closed

GitOrigin-RevId: dab7589ea5bd812d4f4dc6a1db2090f339582bed
This commit is contained in:
Vassiliy.Kudryashov
2021-11-29 18:28:59 +00:00
committed by intellij-monorepo-bot
parent 8e72fb8593
commit 5b0200db5c
2 changed files with 2 additions and 2 deletions
@@ -113,7 +113,7 @@ open class FrameWrapper @JvmOverloads constructor(project: Project?,
val focusListener = object : WindowAdapter() {
override fun windowOpened(e: WindowEvent) {
val focusManager = IdeFocusManager.getInstance(project)
val toFocus = preferredFocusedComponent ?: focusManager.getFocusTargetFor(component!!)
val toFocus = focusManager.getLastFocusedFor(e.window) ?: preferredFocusedComponent ?: focusManager.getFocusTargetFor(component!!)
if (toFocus != null) {
focusManager.requestFocus(toFocus, true)
}
@@ -2289,7 +2289,7 @@ enum class ToolWindowProperty {
private fun isInActiveToolWindow(component: Any?, activeToolWindow: ToolWindowImpl): Boolean {
var source = if (component is JComponent) component else null
val activeToolWindowComponent = activeToolWindow.getComponentIfInitialized()
val activeToolWindowComponent = activeToolWindow.decoratorComponent
if (activeToolWindowComponent != null) {
while (source != null && source !== activeToolWindowComponent) {
source = ComponentUtil.getClientProperty(source, ToolWindowManagerImpl.PARENT_COMPONENT) ?: source.parent as? JComponent