public final class NodeFinder extends Object
Constructor and Description |
---|
NodeFinder(ASTNode root,
int start,
int length)
Instantiate a new node finder using the given root node, the given start and the given length.
|
Modifier and Type | Method and Description |
---|---|
ASTNode |
getCoveredNode()
Returns the covered node.
|
ASTNode |
getCoveringNode()
Returns the covering node.
|
static ASTNode |
perform(ASTNode root,
int start,
int length)
Maps a selection to a given ASTNode, where the selection is defined using a start and a length.
|
static ASTNode |
perform(ASTNode root,
int start,
int length,
ITypeRoot source)
Maps a selection to a given ASTNode, where the selection is given by a start and a length.
|
static ASTNode |
perform(ASTNode root,
ISourceRange range)
Maps a selection to a given ASTNode, where the selection is defined using a source range.
|
public NodeFinder(ASTNode root, int start, int length)
root
- the given root nodestart
- the given startlength
- the given lengthpublic static ASTNode perform(ASTNode root, int start, int length)
start
and length
start
and length
is returned.start
.null
is returned.root
- the root node from which the search startsstart
- the given startlength
- the given lengthpublic static ASTNode perform(ASTNode root, ISourceRange range)
perform(root, range.getOffset(), range.getLength())
.perform(ASTNode, int, int)
public static ASTNode perform(ASTNode root, int start, int length, ITypeRoot source) throws JavaModelException
start
and
length
where either start
and length
exactly
matches the node or where the text covered before and after the node only consists
of white spaces or comments.start
and length
is returned.start
.null
is returned.root
- the root node from which the search startsstart
- the given startlength
- the given lengthsource
- the source of the compilation unitJavaModelException
- if an error occurs in the Java modelpublic ASTNode getCoveredNode()
public ASTNode getCoveringNode()
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.