void (final FocusEvent e) { if (myPanel.allowNavItemsFocus()) { // If focus comes from anything in the nav bar panel, ignore the event if (UIUtil.isAncestor(myPanel, e.getOppositeComponent())) { return; } } if (e.getOppositeComponent() == null && shouldFocusEditor) { shouldFocusEditor = false; ToolWindowManager.getInstance(myPanel.getProject()).activateEditorComponent(); return; } myPanel.updateItems(); final List<NavBarItem> items = myPanel.getItems(); if (!myPanel.isInFloatingMode() && !items.isEmpty()) { myPanel.setContextComponent(items.get(items.size() - 1)); } else { myPanel.setContextComponent(null); } }