void (PaletteGroupHeader paletteGroup, int indexToSelect) { if (indexToSelect == -1) { //this is not 'our' CategoryButton so we'll assume it's the one below this category list indexToSelect = getModel().getSize() - 1; } else if (getModel().getSize() == 0) { indexToSelect = -1; } IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(this, true)); setSelectedIndex(indexToSelect); if (indexToSelect >= 0) { ensureIndexIsVisible(indexToSelect); } }