List of usage examples for org.eclipse.jdt.core.dom TryStatement getStartPosition
public final int getStartPosition()
From source file:br.uff.ic.gems.resources.ast.Visitor.java
@Override public boolean visit(TryStatement node) { int beginLine = cu.getLineNumber(node.getStartPosition()); int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength()); int beginColumn = cu.getColumnNumber(node.getStartPosition()); int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength()); Block body = node.getBody();//from w w w . jav a 2 s . c om if (body != null) { int beginLineBody = cu.getLineNumber(body.getStartPosition()); int endLineBody = cu.getLineNumber(body.getStartPosition() + body.getLength()); int beginColumnBody = cu.getColumnNumber(body.getStartPosition()); int endColumnBody = cu.getColumnNumber(body.getStartPosition() + body.getLength()); languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn, beginLineBody, endLineBody, beginColumnBody, endColumnBody, null)); } else { languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn)); } return true; }
From source file:sharpen.core.CSharpBuilder.java
License:Open Source License
public boolean visit(TryStatement node) { CSTryStatement stmt = new CSTryStatement(node.getStartPosition()); visitBlock(stmt.body(), node.getBody()); for (Object o : node.catchClauses()) { CatchClause clause = (CatchClause) o; if (!_configuration .isIgnoredExceptionType(qualifiedName(clause.getException().getType().resolveBinding()))) { stmt.addCatchClause(mapCatchClause(clause)); }/*from w w w . j av a2 s . c om*/ } if (null != node.getFinally()) { CSBlock finallyBlock = new CSBlock(); visitBlock(finallyBlock, node.getFinally()); stmt.finallyBlock(finallyBlock); } if (null != stmt.finallyBlock() || !stmt.catchClauses().isEmpty()) { addStatement(stmt); } else { _currentBlock.addAll(stmt.body()); } return false; }