void () { if (myPanel == null || !myPanel.isShowing()) { return; } final Project project = myPanel.getProject(); IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(() -> { Window wnd = SwingUtilities.windowForComponent(myPanel); if (wnd == null) return; Component focus = null; if (!wnd.isActive()) { IdeFrame frame = ComponentUtil.getParentOfType((Class<? extends IdeFrame>)IdeFrame.class, (Component)myPanel); if (frame != null) { focus = IdeFocusManager.getInstance(project).getLastFocusedFor((Window)frame); } } else { final Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); if (window instanceof Dialog dialog) { if (dialog.isModal() && !SwingUtilities.isDescendingFrom(myPanel, dialog)) { return; } } } if (focus != null && focus.isShowing()) { if (!myPanel.isFocused() && !myPanel.isNodePopupActive()) { requestModelUpdate(DataManager.getInstance().getDataContext(focus), null, false); } } else if (wnd.isActive()) { if (myPanel.allowNavItemsFocus() && (myPanel.isFocused() || myPanel.isNodePopupActive())) { return; } requestModelUpdate(null, myPanel.getContextObject(), false); } }); }