void (@NotNull JCheckBox checkBox, @NotNull JComponent textField, @Nullable ActionEvent e) { textField.setEnabled(checkBox.isSelected()); if (e != null && e.getSource() instanceof JCheckBox && ((JCheckBox)e.getSource()).isSelected()) { final Object source = e.getSource(); if (source == checkBox && checkBox.isSelected()) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(textField, true)); } } }