void (final int selectedIndex) { for (EditorTextField textField : myOldClassParameterNameFields.values()) { textField.setEnabled(true); } final Object variable = myVariables[selectedIndex]; if (variable instanceof PsiField field) { final PsiClass hisClass = field.getContainingClass(); final Set<PsiMember> members = myThisClassesMap.get(hisClass); if (members != null && members.size() == 1 && members.contains(field)) { //Just the field is referenced myOldClassParameterNameFields.get(hisClass).setEnabled(false); } } }