String (CommentTracker ct, SwitchBranch branch) { if (myResultStatements.length == 1) { PsiStatement first = myResultStatements[0]; if (first instanceof PsiExpressionStatement || first instanceof PsiBlockStatement || first instanceof PsiThrowStatement) return ct.textWithComments(myResultStatements[0]) + "\n"; } StringBuilder sb = new StringBuilder("{"); for (int i = 0, length = myResultStatements.length; i < length; i++) { PsiStatement element = myResultStatements[i]; if (i == 0) { PsiElement current = element.getPrevSibling(); while (current instanceof PsiWhiteSpace || current instanceof PsiComment) { current = current.getPrevSibling(); } addWhiteSpaceAndComments(current, sb, ct); } sb.append(ct.text(element)); if (i + 1 < length) { addWhiteSpaceAndComments(element, sb, ct); } } addCommentsUntilNextLabel(ct, branch, sb); if (sb.charAt(sb.length() - 1) != '\n') { sb.append("\n"); } sb.append("}"); return sb.toString(); }