public static PsiStatement addBefore(PsiStatement anchor, PsiStatement... newStatements) {
    if (newStatements.length == 0) throw new IllegalArgumentException();
    if (anchor instanceof PsiBlockStatement) {
      PsiCodeBlock codeBlock = ((PsiBlockStatement)anchor).getCodeBlock();
      PsiJavaToken brace = codeBlock.getLBrace();
      if (brace != null) {
        PsiElement result = brace;
        for (PsiStatement statement : newStatements) {
          result = codeBlock.addAfter(statement, result);
        }
        return (PsiStatement)result;
      }
    }
    PsiStatement oldStatement = anchor;
    PsiElement parent = oldStatement.getParent();
    while (parent instanceof PsiLabeledStatement) {
      oldStatement = (PsiStatement)parent;
      parent = oldStatement.getParent();
    }
    if (newStatements.length == 1 && oldStatement instanceof PsiEmptyStatement) {
      return (PsiStatement)oldStatement.replace(newStatements[0]);
    }
    if (!(parent instanceof PsiCodeBlock)) {
      oldStatement = expandSingleStatementToBlockStatement(oldStatement);
      parent = oldStatement.getParent();
    }
    PsiElement result = null;
    for (PsiStatement statement : newStatements) {
      result = parent.addBefore(statement, oldStatement);
    }
    return (PsiStatement)result;
  }
public static PsiStatement addBefore(PsiStatement anchor, PsiStatement... newStatements)