Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 19-30
Link Here
|
19 |
import org.eclipse.jdt.core.compiler.ITerminalSymbols; |
19 |
import org.eclipse.jdt.core.compiler.ITerminalSymbols; |
20 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
20 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
21 |
import org.eclipse.jdt.core.dom.ASTNode; |
21 |
import org.eclipse.jdt.core.dom.ASTNode; |
|
|
22 |
import org.eclipse.jdt.core.dom.ASTVisitor; |
22 |
/** |
23 |
/** |
23 |
* For a give range finds the node covered and the node covering. |
24 |
* For a give range finds the node covered and the node covering. |
24 |
* |
25 |
* |
25 |
* @since 2.1 |
26 |
* @since 2.1 |
26 |
*/ |
27 |
*/ |
27 |
public class NodeFinder extends GenericVisitor { |
28 |
public class NodeFinder extends ASTVisitor { |
28 |
|
29 |
|
29 |
/** |
30 |
/** |
30 |
* A visitor that maps a selection to a given ASTNode. The result node is |
31 |
* A visitor that maps a selection to a given ASTNode. The result node is |
Lines 127-133
Link Here
|
127 |
fEnd= offset + length; |
128 |
fEnd= offset + length; |
128 |
} |
129 |
} |
129 |
|
130 |
|
130 |
protected boolean visitNode(ASTNode node) { |
131 |
public boolean preVisit2(ASTNode node) { |
131 |
int nodeStart= node.getStartPosition(); |
132 |
int nodeStart= node.getStartPosition(); |
132 |
int nodeEnd= nodeStart + node.getLength(); |
133 |
int nodeEnd= nodeStart + node.getLength(); |
133 |
if (nodeEnd < fStart || fEnd < nodeStart) { |
134 |
if (nodeEnd < fStart || fEnd < nodeStart) { |