List of usage examples for org.eclipse.jdt.core.dom TypeLiteral getLength
public final int getLength()
From source file:org.wloka.reflectify.tests.assist.ClassAccessTest.java
License:Open Source License
/** * @return selection (offset,length) of first simple type node within statement given by <code>statementIndex</code> *///from www . ja va 2 s . c om private int[] getTypeLiteralSelection(int statementIndex, IMethod target) { MethodDeclaration targetNode = compileTargetMethod(target); Statement stmt = (Statement) targetNode.getBody().statements().get(statementIndex); final int[] selection = new int[2]; stmt.accept(new ASTVisitor() { @Override public boolean visit(TypeLiteral node) { if (selection[1] == 0) { selection[0] = node.getStartPosition(); selection[1] = node.getLength(); } return false; } }); return selection; }