void (ActionEvent e) { Object selected = list.getSelectedValue(); ProjectGroup group = null; if (selected instanceof ProjectGroupActionGroup) { group = ((ProjectGroupActionGroup)selected).getGroup(); } if (group != null) { if (!group.isExpanded()) { group.setExpanded(true); int index = list.getSelectedIndex(); list.setSelectedIndex(group.getProjects().isEmpty() ? index : index + 1); } } else { FlatWelcomeFrame frame = ComponentUtil.getParentOfType((Class<? extends FlatWelcomeFrame>)FlatWelcomeFrame.class, list); if (frame != null) { FocusTraversalPolicy policy = frame.getFocusTraversalPolicy(); if (policy != null) { Component next = policy.getComponentAfter(frame, list); if (next != null) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(next, true)); } } } } }