void (boolean success) { if (success && (myPanel != null && myPanel.getInitPlace() != InitPlace.SAME_METHOD) || myOperation.getInplaceInitPlace() != InitPlace.SAME_METHOD) { WriteAction.run(() -> { final PyAssignmentStatement initializer = PsiTreeUtil.getParentOfType(myTarget, PyAssignmentStatement.class); assert initializer != null; final Function<String, PyStatement> callback = __ -> initializer; final PyClass pyClass = PyUtil.getContainingClassOrSelf(initializer); InitPlace initPlace = myPanel != null ? myPanel.getInitPlace() : myOperation.getInplaceInitPlace(); if (initPlace == InitPlace.CONSTRUCTOR) { AddFieldQuickFix.addFieldToInit(myProject, pyClass, "", callback); } else if (initPlace == InitPlace.SET_UP) { addFieldToSetUp(pyClass, callback); } if (myOperation.getOccurrences().size() > 0) { initializer.delete(); } else { final PyExpression copy = PyElementGenerator.getInstance(myProject).createExpressionFromText(LanguageLevel.forElement(myTarget), myTarget.getText()); initializer.replace(copy); } initializer.delete(); }); } }