PsiStatement (@NotNull Project project, @NotNull PsiElementFactory factory) { PsiBlockStatement block = (PsiBlockStatement)factory.createStatementFromText("{}", myStatement); block.getCodeBlock().add(myStatement); block = (PsiBlockStatement)myStatement.replace(block); return block.getCodeBlock().getStatements()[0]; }