void (ActionEvent e) { int selIndexBefore = getSelectedIndex(); myDefaultAction.actionPerformed(e); int selIndexCurrent = getSelectedIndex(); if (selIndexBefore != selIndexCurrent) { return; } if (myFocusNext && selIndexCurrent == 0) { return; } KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container container = kfm.getCurrentFocusCycleRoot(); FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); if (policy == null) { policy = kfm.getDefaultFocusTraversalPolicy(); } Component next = myFocusNext ? policy.getComponentAfter(container, PaletteItemsComponent.this) : policy.getComponentBefore(container, PaletteItemsComponent.this); if (next instanceof PaletteGroupComponent) { clearSelection(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(next, true)); ((PaletteGroupComponent)next).scrollRectToVisible(next.getBounds()); } }