List of usage examples for org.eclipse.jdt.core.dom VariableDeclarationExpression accept
public final void accept(ASTVisitor visitor)
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$ }//from w w w .java 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:egovframework.mgt.fit.library.parser.visitor.LocalVariableParsingVisitor.java
License:Apache License
/** * ?? ?? ?.//from ww w . j a v a 2 s .c o m * @return */ @Override public boolean visit(VariableDeclarationExpression node) { if (node instanceof VariableDeclarationExpression) { for (Object obj : node.fragments()) { if (obj instanceof VariableDeclaration) { VariableDeclaration vd = (VariableDeclaration) obj; Variable lv = new Variable(); lv.setModifier(node.getModifiers()); lv.setType(project.resolveClass(ParsingHelper.getFullNameWithSimpleName( node.getType().toString(), javaClass.getPackage(), javaClass.getImports()))); lv.setName(vd.getName().getFullyQualifiedName()); lv.setValue(StringHelper.safeToString(vd.getInitializer())); node.accept(new AnnotationParsingVisitor(lv, ASTNode.VARIABLE_DECLARATION_EXPRESSION)); lv.setNode(vd); method.addLocalVariable(lv); } } } return super.visit(node); }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(TryStatement node) { printIndent();/* w ww.j a va2 s . c om*/ 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; }