void (boolean someElementSelected) { for (AnAction action : myExtraActions) { if (action instanceof ElementActionButton elementActionButton) { elementActionButton.setEnabled(someElementSelected); } } }