PsiDeclarationStatement declaration = (PsiDeclarationStatement)myElementFactory.createStatementFromText(text, null);
declaration = (PsiDeclarationStatement)myStyleManager.reformat(declaration);
final PsiTypeElement typeElement = myElementFactory.createTypeElement(data.type);
((PsiVariable)declaration.getDeclaredElements()[0]).getTypeElement().replace(typeElement);
declaration = (PsiDeclarationStatement)body.add(declaration);
<BUG>PsiExpression initializer = ((PsiVariable)declaration.getDeclaredElements()[0]).getInitializer();
TextRange range = initializer.getTextRange();</BUG>
BlockSupport blockSupport = myProject.getComponent(BlockSupport.class);
blockSupport.reparseRange(body.getContainingFile(), range.getStartOffset(), range.getEndOffset(), "...");
}

PsiDeclarationStatement declaration = (PsiDeclarationStatement)myElementFactory.createStatementFromText(text, null);
declaration = (PsiDeclarationStatement)myStyleManager.reformat(declaration);
final PsiTypeElement typeElement = myElementFactory.createTypeElement(data.type);
((PsiVariable)declaration.getDeclaredElements()[0]).getTypeElement().replace(typeElement);
declaration = (PsiDeclarationStatement)body.add(declaration);
PsiExpression initializer = ((PsiVariable)declaration.getDeclaredElements()[0]).getInitializer();
LOG.assertTrue(initializer != null);
TextRange range = initializer.getTextRange();
BlockSupport blockSupport = myProject.getComponent(BlockSupport.class);
blockSupport.reparseRange(body.getContainingFile(), range.getStartOffset(), range.getEndOffset(), "...");
