public IBinding[] getDeclarationsAfter(int offset, int flags) { try { org.eclipse.che.ide.ext.java.jdt.core.dom.NodeFinder finder = new org.eclipse.che.ide.ext.java.jdt.core.dom.NodeFinder(fRoot, offset, 0); ASTNode node = finder.getCoveringNode(); if (node == null) { return null; } ASTNode declaration = findParentStatement(node); while (declaration instanceof Statement && declaration.getNodeType() != ASTNode.BLOCK) { declaration = declaration.getParent(); } if (declaration instanceof Block) { DefaultBindingRequestor requestor = new DefaultBindingRequestor(); DeclarationsAfterVisitor visitor = new DeclarationsAfterVisitor(node.getStartPosition(), flags, requestor); declaration.accept(visitor); List<IBinding> result = requestor.getResult(); return result.toArray(new IBinding[result.size()]); } return NO_BINDING; } finally { clearLists(); } }
private void visitBackwards(List<? extends ASTNode> list) { if (fBreak) return; for (int i = list.size() - 1; i >= 0; i--) { ASTNode curr = list.get(i); if (curr.getStartPosition() < fPosition) { curr.accept(this); } } }
private boolean addLocalDeclarations(ASTNode node, int flags, IBindingRequestor requestor) { return addLocalDeclarations(node, node.getStartPosition(), flags, requestor); }
private boolean isInside(ASTNode node) { int start = node.getStartPosition(); int end = start + node.getLength(); return start <= fPosition && fPosition < end; }