List of usage examples for org.eclipse.jdt.internal.compiler.ast MethodDeclaration compilationResult
@Override
public CompilationResult compilationResult()
From source file:com.google.gwt.dev.jdt.FindJsniRefVisitor.java
License:Apache License
private String getJSNICode(MethodDeclaration methodDeclaration) { char[] source = methodDeclaration.compilationResult().getCompilationUnit().getContents(); String jsniCode = String.valueOf(source, methodDeclaration.bodyStart, methodDeclaration.bodyEnd - methodDeclaration.bodyStart + 1); int startPos = jsniCode.indexOf(JsniCollector.JSNI_BLOCK_START); int endPos = jsniCode.lastIndexOf(JsniCollector.JSNI_BLOCK_END); if (startPos < 0 || endPos < 0) { return null; // ignore the error }// ww w .ja v a 2 s . c o m // move up to open brace startPos += JsniCollector.JSNI_BLOCK_START.length() - 1; // move past close brace endPos += 1; jsniCode = jsniCode.substring(startPos, endPos); return jsniCode; }