void (PsiElement place) { while (place != null && place != myBlock) { if (place instanceof PsiBlockStatement) { PsiIfStatement parentIf = tryCast(place.getParent(), PsiIfStatement.class); if (parentIf != null && parentIf.getElseBranch() == place) { PsiIfStatement childIf = tryCast(ControlFlowUtils.stripBraces((PsiStatement)place), PsiIfStatement.class); if (childIf != null) { place = place.replace(childIf); } } } place = place.getParent(); } }