use of org.eclipse.jdt.core.dom.NodeFinder in project processing by processing.
the class ASTUtils method getASTNodeAt.
public static ASTNode getASTNodeAt(ASTNode root, int startJavaOffset, int stopJavaOffset) {
Messages.log("* getASTNodeAt");
int length = stopJavaOffset - startJavaOffset;
NodeFinder f = new NodeFinder(root, startJavaOffset, length);
ASTNode node = f.getCoveredNode();
if (node == null) {
node = f.getCoveringNode();
}
if (node == null) {
Messages.log("no node found");
} else {
Messages.log("found " + node.getClass().getSimpleName());
}
return node;
}
use of org.eclipse.jdt.core.dom.NodeFinder in project che by eclipse.
the class CompilationUnitRange method getNode.
//rootNode must be the ast root for fCompilationUnit
public ASTNode getNode(CompilationUnit rootNode) {
NodeFinder finder = new NodeFinder(rootNode, fSourceRange.getOffset(), fSourceRange.getLength());
ASTNode result = finder.getCoveringNode();
if (result != null)
return result;
return finder.getCoveredNode();
}
use of org.eclipse.jdt.core.dom.NodeFinder in project che by eclipse.
the class ASTNodeSearchUtil method findNode.
private static ASTNode findNode(ISourceRange range, CompilationUnit cuNode) {
NodeFinder nodeFinder = new NodeFinder(cuNode, range.getOffset(), range.getLength());
ASTNode coveredNode = nodeFinder.getCoveredNode();
if (coveredNode != null)
return coveredNode;
else
return nodeFinder.getCoveringNode();
}
use of org.eclipse.jdt.core.dom.NodeFinder in project AutoRefactor by JnRouvignac.
the class CommentsRefactoring method getNextNode.
private ASTNode getNextNode(Comment node) {
final int nodeEndPosition = node.getStartPosition() + node.getLength();
final ASTNode coveringNode = getCoveringNode(node);
final int parentNodeEndPosition = coveringNode.getStartPosition() + coveringNode.getLength();
final NodeFinder finder = new NodeFinder(coveringNode, nodeEndPosition, parentNodeEndPosition - nodeEndPosition);
if (node instanceof Javadoc) {
return finder.getCoveringNode();
}
return finder.getCoveredNode();
}
Aggregations