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

Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-2 / +18 lines)
Lines 613-618 Link Here
613
	return createTypeHandle(typeName.substring(0, lastDollar));
613
	return createTypeHandle(typeName.substring(0, lastDollar));
614
}
614
}
615
/**
615
/**
616
 * Creates an IImportDeclaration from the given import statement
617
 */
618
protected IJavaElement createPackageDeclarationHandle(CompilationUnitDeclaration unit) {
619
	if (unit.isPackageInfo()) {
620
		char[] packName = CharOperation.concatWith(unit.currentPackage.getImportName(), '.');
621
		Openable openable = this.currentPossibleMatch.openable;
622
		if (openable instanceof CompilationUnit) {
623
			return ((CompilationUnit) openable).getPackageDeclaration(new String(packName));
624
		}
625
//		if (openable != null) {
626
//			return openable.getParent();
627
//		}
628
	}
629
	return createTypeHandle(new String(unit.getMainTypeName()));
630
}
631
/**
616
 * Creates an IType from the given simple top level type name. 
632
 * Creates an IType from the given simple top level type name. 
617
 */
633
 */
618
protected IType createTypeHandle(String simpleTypeName) {
634
protected IType createTypeHandle(String simpleTypeName) {
Lines 1969-1975 Link Here
1969
				for (int i = 0, l = nodes.length; i < l; i++)
1985
				for (int i = 0, l = nodes.length; i < l; i++)
1970
					nodeSet.matchingNodes.removeKey(nodes[i]);
1986
					nodeSet.matchingNodes.removeKey(nodes[i]);
1971
			} else {
1987
			} else {
1972
				IJavaElement element = createTypeHandle(new String(unit.getMainTypeName()));
1988
				IJavaElement element = createPackageDeclarationHandle(unit);
1973
				for (int i = 0, l = nodes.length; i < l; i++) {
1989
				for (int i = 0, l = nodes.length; i < l; i++) {
1974
					ASTNode node = nodes[i];
1990
					ASTNode node = nodes[i];
1975
					Integer level = (Integer) nodeSet.matchingNodes.removeKey(node);
1991
					Integer level = (Integer) nodeSet.matchingNodes.removeKey(node);
Lines 1983-1989 Link Here
1983
	if (matchedUnitContainer) {
1999
	if (matchedUnitContainer) {
1984
		ImportReference pkg = unit.currentPackage;
2000
		ImportReference pkg = unit.currentPackage;
1985
		if (pkg != null && pkg.annotations != null) {
2001
		if (pkg != null && pkg.annotations != null) {
1986
			IJavaElement element = createTypeHandle(new String(unit.getMainTypeName()));
2002
			IJavaElement element = createPackageDeclarationHandle(unit);
1987
			if (element != null) {
2003
			if (element != null) {
1988
				reportMatching(pkg.annotations, element, null, nodeSet, true, encloses(element));
2004
				reportMatching(pkg.annotations, element, null, nodeSet, true, encloses(element));
1989
			}
2005
			}
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java (-1 / +1 lines)
Lines 418-424 Link Here
418
		return;
418
		return;
419
	}
419
	}
420
	if (refBinding.isLocalType()) {
420
	if (refBinding.isLocalType()) {
421
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84049
421
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=82673
422
		LocalTypeBinding local = (LocalTypeBinding) refBinding;
422
		LocalTypeBinding local = (LocalTypeBinding) refBinding;
423
		IJavaElement focus = ((InternalSearchPattern)pattern).focus;
423
		IJavaElement focus = ((InternalSearchPattern)pattern).focus;
424
		if (focus != null && local.enclosingMethod != null && focus.getParent().getElementType() == IJavaElement.METHOD) {
424
		if (focus != null && local.enclosingMethod != null && focus.getParent().getElementType() == IJavaElement.METHOD) {

Return to bug 99903