void (PsiSwitchBlock block) { CommentTracker ct = new CommentTracker(); PsiSwitchStatement switchStatement = new SwitchStatementGenerator(block).generate(ct); if (switchStatement == null) return; PsiElement newStatement = block.replace(switchStatement); ct.insertCommentsBefore(newStatement); }