View | Details | Raw Unified | Return to bug 53024 | Differences between
and this patch

Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/ASTNode.java (-3 / +4 lines)
Lines 2473-2481 Link Here
2473
			throw new IllegalArgumentException();
2473
			throw new IllegalArgumentException();
2474
		}
2474
		}
2475
		// begin with the generic pre-visit
2475
		// begin with the generic pre-visit
2476
		visitor.preVisit(this);
2476
		if (visitor.preVisit2(this)) {
2477
		// dynamic dispatch to internal method for type-specific visit/endVisit
2477
			// dynamic dispatch to internal method for type-specific visit/endVisit
2478
		accept0(visitor);
2478
			accept0(visitor);
2479
		}
2479
		// end with the generic post-visit
2480
		// end with the generic post-visit
2480
		visitor.postVisit(this);
2481
		visitor.postVisit(this);
2481
	}
2482
	}
(-)dom/org/eclipse/jdt/core/dom/ASTVisitor.java (-1 / +21 lines)
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 143-154 Link Here
143
	 * </p>
143
	 * </p>
144
	 *
144
	 *
145
	 * @param node the node to visit
145
	 * @param node the node to visit
146
	 *
147
	 * @see #preVisit2(ASTNode)
146
	 */
148
	 */
147
	public void preVisit(ASTNode node) {
149
	public void preVisit(ASTNode node) {
148
		// default implementation: do nothing
150
		// default implementation: do nothing
149
	}
151
	}
150
152
151
	/**
153
	/**
154
	 * Visits the given AST node prior to the type-specific visit. (before <code>visit</code>).
155
	 * <p>
156
	 * The default implementation calls {@link #preVisit(ASTNode)} and then
157
	 * returns true. Subclasses may reimplement.
158
	 * </p>
159
	 *
160
	 * @param node the node to visit
161
	 * @return <code>true</code> if <code>visit(node)</code> should be called,
162
	 * and <code>false</code> if the children of this node should be skipped
163
	 * @see #preVisit(ASTNode)
164
	 * @since 3.5
165
	 */
166
	public boolean preVisit2(ASTNode node) {
167
		preVisit(node);
168
		return true;
169
	}
170
171
	/**
152
	 * Visits the given AST node following the type-specific visit
172
	 * Visits the given AST node following the type-specific visit
153
	 * (after <code>endVisit</code>).
173
	 * (after <code>endVisit</code>).
154
	 * <p>
174
	 * <p>
(-)core extension/org/eclipse/jdt/internal/corext/dom/NodeFinder.java (-3 / +4 lines)
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) {

Return to bug 53024