void (final PsiMethod constructor, final LwRootContainer rootContainer, final PsiMethod setupUIMethod) { final PsiCodeBlock psiCodeBlock = constructor.getBody(); if (psiCodeBlock == null) { return; } final PsiClass classToBind = constructor.getContainingClass(); final PsiStatement[] statements = psiCodeBlock.getStatements(); PsiElement anchor = psiCodeBlock.getRBrace(); Ref<Boolean> callsThisConstructor = new Ref<>(Boolean.FALSE); for(PsiStatement statement: statements) { if (containsMethodIdentifier(statement, setupUIMethod)) { return; } if (!ourSuperCallPattern.accepts(statement) && hasCustomComponentAffectingReferences(statement, classToBind, rootContainer, callsThisConstructor)) { anchor = statement; break; } } if (!callsThisConstructor.get().booleanValue()) { final PsiElementFactory factory = JavaPsiFacade.getInstance(constructor.getProject()).getElementFactory(); try { PsiStatement setupUIStatement = factory.createStatementFromText(AsmCodeGenerator.SETUP_METHOD_NAME + "();", constructor); psiCodeBlock.addBefore(setupUIStatement, anchor); } catch (IncorrectOperationException e) { LOG.error(e); } } }