List of usage examples for org.eclipse.jdt.core.dom AST JLS10
int JLS10
To view the source code for org.eclipse.jdt.core.dom AST JLS10.
Click Source Link
From source file:org.springframework.ide.vscode.boot.java.handlers.BootJavaReferencesHandler.java
License:Open Source License
private List<? extends Location> provideReferences(TextDocument document, int offset) throws Exception { ASTParser parser = ASTParser.newParser(AST.JLS10); Map<String, String> options = JavaCore.getOptions(); JavaCore.setComplianceOptions(JavaCore.VERSION_10, options); parser.setCompilerOptions(options);// w w w . j a v a2 s . co m parser.setKind(ASTParser.K_COMPILATION_UNIT); parser.setStatementsRecovery(true); parser.setBindingsRecovery(true); parser.setResolveBindings(true); String[] classpathEntries = getClasspathEntries(document); String[] sourceEntries = new String[] {}; parser.setEnvironment(classpathEntries, sourceEntries, null, true); String docURI = document.getUri(); String unitName = docURI.substring(docURI.lastIndexOf("/")); parser.setUnitName(unitName); parser.setSource(document.get(0, document.getLength()).toCharArray()); CompilationUnit cu = (CompilationUnit) parser.createAST(null); ASTNode node = NodeFinder.perform(cu, offset, 0); if (node != null) { return provideReferencesForAnnotation(node, offset, document); } return null; }