private static PsiElement generateTryCatch(PsiElement element, PsiClassType[] exceptions) {
    if (exceptions.length == 0) return element;
    GrTryCatchStatement tryCatch =
      (GrTryCatchStatement)GroovyPsiElementFactory.getInstance(element.getProject()).createStatementFromText("try{} catch (Exception e){}");
    final GrStatement statement = PsiTreeUtil.getParentOfType(element, GrStatement.class);
    assert statement != null;
    final GrOpenBlock block = tryCatch.getTryBlock();
    assert block != null;
    block.addStatementBefore(statement, null);
    tryCatch = (GrTryCatchStatement)statement.replace(tryCatch);
    tryCatch.getCatchClauses()[0].delete();
    fixCatchBlock(tryCatch, exceptions);
    return tryCatch;
  }
private static PsiElement generateTryCatch(PsiElement element, PsiClassType[] exceptions)