Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.jdt.internal.core.search.matching;
 
 import  org.eclipse.core.runtime.CoreException;
 
 public class LocalVariableLocator extends VariableLocator {
 
 	super(pattern);
 }
 public int match(LocalDeclaration nodeMatchingNodeSet nodeSet) {
 	int referencesLevel = ;
 		// must be a write only access with an initializer
 		if (this.. && !this.. && node.initialization != null)
 			if (matchesName(this..node.name))
 				referencesLevel = this.. ?  : ;
 
 	int declarationsLevel = ;
 		if (matchesName(this..node.name))
 			if (node.declarationSourceStart == getLocalVariable().)
 				declarationsLevel = this.. ?  : ;
 
 	return nodeSet.addMatch(nodereferencesLevel >= declarationsLevel ? referencesLevel : declarationsLevel); // use the stronger match
 }
 }
 protected void matchReportReference(ASTNode referenceIJavaElement elementBinding elementBindingint accuracyMatchLocator locatorthrows CoreException {
 	int offset = -1;
 	int length = -1;
 	if (reference instanceof SingleNameReference) {
 		offset = reference.sourceStart;
 		length = reference.sourceEnd-offset+1;
 	} else if (reference instanceof QualifiedNameReference) {
 		QualifiedNameReference qNameRef = (QualifiedNameReferencereference;
 		long sourcePosition = qNameRef.sourcePositions[0];
 		offset = (int) (sourcePosition >>> 32);
 		length = ((intsourcePosition) - offset +1;
 	} else if (reference instanceof LocalDeclaration) {
 		LocalVariable localVariable = getLocalVariable();
 		offset = localVariable.nameStart;
 		length = localVariable.nameEnd-offset+1;
 		element = localVariable;
 		this. = locator.newDeclarationMatch(elementnullaccuracyoffsetlength);
 		locator.report(this.);
 		return;
 	}
 	if (offset >= 0) {
 		this. = locator.newLocalVariableReferenceMatch(elementaccuracyoffsetlengthreference);
 		locator.report(this.);
 	}
 }
 protected int matchContainer() {
 	return ;
 }
 protected int matchLocalVariable(LocalVariableBinding variableboolean matchName) {
 	if (variable == nullreturn ;
 
 	if (matchName && !matchesName(this..variable.readableName())) return ;
 
 	return variable.declaration.declarationSourceStart == getLocalVariable().
 }
 protected int referenceType() {
 }
 public int resolveLevel(ASTNode possiblelMatchingNode) {
 	if (this.. || this.. != 0)
 		if (possiblelMatchingNode instanceof NameReference)
 			return resolveLevel((NameReferencepossiblelMatchingNode);
 	if (possiblelMatchingNode instanceof LocalDeclaration)
 		return matchLocalVariable(((LocalDeclarationpossiblelMatchingNode).true);
 	return ;
 }
 public int resolveLevel(Binding binding) {
 	if (binding == nullreturn ;
 	if (!(binding instanceof LocalVariableBinding)) return ;
 
 	return matchLocalVariable((LocalVariableBindingbindingtrue);
 }
 protected int resolveLevel(NameReference nameRef) {
 	return resolveLevel(nameRef.binding);
New to GrepCode? Check out our FAQ X