EncapsulateFieldsContainer (@NotNull PsiClass aClass, @NotNull Set preselectedFields, @NotNull EncapsulateFieldHelper helper) { PsiClass myClass = aClass; EncapsulateFieldHelper myHelper = helper; PsiField[] myFields = helper.getApplicableFields(myClass); Map<PsiField, Icon> myIconFields = new HashMap<>(); for (PsiField field : myFields) { myIconFields.put(field, field.getIcon(Iconable.ICON_FLAG_VISIBILITY)); } String[] myFieldNames = new String[myFields.length]; boolean[] myCheckedMarks = new boolean[myFields.length]; boolean[] myFinalMarks = new boolean[myFields.length]; String[] myGetterNames = new String[myFields.length]; String[] mySetterNames = new String[myFields.length]; PsiMethod[] myGetterPrototypes = new PsiMethod[myFields.length]; PsiMethod[] mySetterPrototypes = new PsiMethod[myFields.length]; for (int idx = 0; idx < myFields.length; idx++) { PsiField field = myFields[idx]; myCheckedMarks[idx] = preselectedFields.contains(field); myFinalMarks[idx] = field.hasModifierProperty(PsiModifier.FINAL); myFieldNames[idx] = PsiFormatUtil.formatVariable(field, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.TYPE_AFTER, PsiSubstitutor.EMPTY ); myGetterNames[idx] = myHelper.suggestGetterName(field); mySetterNames[idx] = myHelper.suggestSetterName(field); myGetterPrototypes[idx] = myHelper.generateMethodPrototype(field, myGetterNames[idx], true); mySetterPrototypes[idx] = myHelper.generateMethodPrototype(field, mySetterNames[idx], false); } HashMap<Integer, RowIcon> myGetterPrototypesIcons = new HashMap<>(); HashMap<Integer, RowIcon> mySetterPrototypesIcons = new HashMap<>(); for (int i = 0; i < myGetterPrototypes.length; i++) { PsiMethod prototype = myGetterPrototypes[i]; myGetterPrototypesIcons.put(i, getIcon(prototype, myClass)); } for (int i = 0; i < mySetterPrototypes.length; i++) { PsiMethod prototype = mySetterPrototypes[i]; mySetterPrototypesIcons.put(i, getIcon(prototype, myClass)); } return new EncapsulateFieldsContainer(myHelper, myClass, myFields, myIconFields, myCheckedMarks, myFinalMarks, myFieldNames, myGetterNames, myGetterPrototypes, myGetterPrototypesIcons, mySetterNames, mySetterPrototypes, mySetterPrototypesIcons); }