List of usage examples for org.eclipse.jdt.core.dom TryStatement getAST
public final AST getAST()
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(TryStatement node) { this.fBuffer.append("try ");//$NON-NLS-1$ if (node.getAST().apiLevel() >= JLS4) { if (!node.resources().isEmpty()) { this.fBuffer.append("(");//$NON-NLS-1$ for (Iterator<VariableDeclarationExpression> it = node.resources().iterator(); it.hasNext();) { VariableDeclarationExpression var = it.next(); var.accept(this); if (it.hasNext()) { this.fBuffer.append(",");//$NON-NLS-1$ }/* www . j a v a 2 s . c o m*/ } this.fBuffer.append(") ");//$NON-NLS-1$ } } node.getBody().accept(this); this.fBuffer.append(" ");//$NON-NLS-1$ for (Iterator<CatchClause> it = node.catchClauses().iterator(); it.hasNext();) { CatchClause cc = it.next(); cc.accept(this); } if (node.getFinally() != null) { this.fBuffer.append("finally ");//$NON-NLS-1$ node.getFinally().accept(this); } return false; }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(TryStatement node) { printIndent();//from ww w . ja va2 s . co m this.buffer.append("try ");//$NON-NLS-1$ if (node.getAST().apiLevel() >= JLS4) { List resources = node.resources(); if (!resources.isEmpty()) { this.buffer.append('('); for (Iterator it = resources.iterator(); it.hasNext();) { VariableDeclarationExpression variable = (VariableDeclarationExpression) it.next(); variable.accept(this); if (it.hasNext()) { this.buffer.append(';'); } } this.buffer.append(')'); } } node.getBody().accept(this); this.buffer.append(" ");//$NON-NLS-1$ for (Iterator it = node.catchClauses().iterator(); it.hasNext();) { CatchClause cc = (CatchClause) it.next(); cc.accept(this); } if (node.getFinally() != null) { this.buffer.append(" finally ");//$NON-NLS-1$ node.getFinally().accept(this); } return false; }