void (@NotNull Project project, @NotNull PsiElement classIdentifier, @NotNull ModPsiUpdater updater) { final PsiClass aClass = (PsiClass)classIdentifier.getParent(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); final PsiMethod constructor = factory.createConstructor(); final PsiModifierList modifierList = constructor.getModifierList(); if (aClass == null) { return; } if (aClass.hasModifierProperty(PsiModifier.PRIVATE)) { modifierList.setModifierProperty(PsiModifier.PUBLIC, false); modifierList.setModifierProperty(PsiModifier.PRIVATE, true); } else if (aClass.hasModifierProperty(PsiModifier.PROTECTED)) { modifierList.setModifierProperty(PsiModifier.PUBLIC, false); modifierList.setModifierProperty(PsiModifier.PROTECTED, true); } else if (aClass.hasModifierProperty(PsiModifier.ABSTRACT)) { modifierList.setModifierProperty(PsiModifier.PUBLIC, false); modifierList.setModifierProperty(PsiModifier.PROTECTED, true); } else if (!aClass.hasModifierProperty(PsiModifier.PUBLIC)) { modifierList.setModifierProperty(PsiModifier.PUBLIC, false); } aClass.add(constructor); final CodeStyleManager styleManager = CodeStyleManager.getInstance(project); styleManager.reformat(constructor); }