PsiField (final String[] names, final PsiType defaultType) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(myProject); final PsiField field = WriteAction.compute(() -> { PsiField field1 = elementFactory.createField(chooseName(names, getParentClass().getLanguage()), defaultType); PsiUtil.setModifierProperty(field1, PsiModifier.FINAL, myIntroduceFieldPanel.isDeclareFinal()); PsiUtil.setModifierProperty(field1, PsiModifier.STATIC, myStatic); final String visibility = myIntroduceFieldPanel.getFieldVisibility(); if (visibility != null) { PsiUtil.setModifierProperty(field1, visibility, true); } field1 = (PsiField)getParentClass().add(field1); if (myExprText != null) { updateInitializer(elementFactory, field1); } updateVariable(field1); return field1; }); PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myEditor.getDocument()); return field; }