View | Details | Raw Unified | Return to bug 247618
Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-5 / +5 lines)
Lines 1420-1426 Link Here
1420
	if (enclosingBinding != null) {
1420
	if (enclosingBinding != null) {
1421
		enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
1421
		enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
1422
	}
1422
	}
1423
	FieldReferenceMatch match = new FieldReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
1423
	InternalFieldReferenceMatch match = new InternalFieldReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
1424
	match.localElement(localElement);
1424
	match.localElement(localElement);
1425
	return match;
1425
	return match;
1426
}
1426
}
Lines 1451-1457 Link Here
1451
	return new LocalVariableReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
1451
	return new LocalVariableReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
1452
}
1452
}
1453
1453
1454
public MethodReferenceMatch newMethodReferenceMatch(
1454
public InternalMethodReferenceMatch newMethodReferenceMatch(
1455
		IJavaElement enclosingElement,
1455
		IJavaElement enclosingElement,
1456
		Binding enclosingBinding,
1456
		Binding enclosingBinding,
1457
		int accuracy,
1457
		int accuracy,
Lines 1466-1475 Link Here
1466
	if (enclosingBinding != null)
1466
	if (enclosingBinding != null)
1467
		enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
1467
		enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
1468
	boolean isOverridden = (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0;
1468
	boolean isOverridden = (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0;
1469
	return new MethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, isOverridden, insideDocComment, participant, resource);
1469
	return new InternalMethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, isOverridden, insideDocComment, participant, resource);
1470
}
1470
}
1471
1471
1472
public PackageReferenceMatch newPackageReferenceMatch(
1472
public InternalPackageReferenceMatch newPackageReferenceMatch(
1473
		IJavaElement enclosingElement,
1473
		IJavaElement enclosingElement,
1474
		int accuracy,
1474
		int accuracy,
1475
		int offset,
1475
		int offset,
Lines 1478-1484 Link Here
1478
	SearchParticipant participant = getParticipant();
1478
	SearchParticipant participant = getParticipant();
1479
	IResource resource = this.currentPossibleMatch.resource;
1479
	IResource resource = this.currentPossibleMatch.resource;
1480
	boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0;
1480
	boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0;
1481
	return new PackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource);
1481
	return new InternalPackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource);
1482
}
1482
}
1483
1483
1484
public SearchMatch newTypeParameterReferenceMatch(
1484
public SearchMatch newTypeParameterReferenceMatch(
(-)search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java (-2 / +1 lines)
Lines 16-22 Link Here
16
import org.eclipse.jdt.core.IPackageFragment;
16
import org.eclipse.jdt.core.IPackageFragment;
17
import org.eclipse.jdt.core.IPackageFragmentRoot;
17
import org.eclipse.jdt.core.IPackageFragmentRoot;
18
import org.eclipse.jdt.core.JavaModelException;
18
import org.eclipse.jdt.core.JavaModelException;
19
import org.eclipse.jdt.core.search.PackageReferenceMatch;
20
import org.eclipse.jdt.core.search.SearchPattern;
19
import org.eclipse.jdt.core.search.SearchPattern;
21
import org.eclipse.jdt.core.compiler.CharOperation;
20
import org.eclipse.jdt.core.compiler.CharOperation;
22
import org.eclipse.jdt.internal.compiler.ast.*;
21
import org.eclipse.jdt.internal.compiler.ast.*;
Lines 263-269 Link Here
263
	if (last > positions.length) last = positions.length;
262
	if (last > positions.length) last = positions.length;
264
	int sourceStart = (int) (positions[0] >>> 32);
263
	int sourceStart = (int) (positions[0] >>> 32);
265
	int sourceEnd = ((int) positions[last - 1]);
264
	int sourceEnd = ((int) positions[last - 1]);
266
	PackageReferenceMatch packageReferenceMatch = locator.newPackageReferenceMatch(element, accuracy, sourceStart, sourceEnd-sourceStart+1, reference);
265
	InternalPackageReferenceMatch packageReferenceMatch = locator.newPackageReferenceMatch(element, accuracy, sourceStart, sourceEnd-sourceStart+1, reference);
267
	packageReferenceMatch.localElement(localElement);
266
	packageReferenceMatch.localElement(localElement);
268
	this.match = packageReferenceMatch;
267
	this.match = packageReferenceMatch;
269
	locator.report(this.match);
268
	locator.report(this.match);
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java (-1 / +1 lines)
Lines 333-339 Link Here
333
			reportDeclaration(methodBinding, locator, declPattern.knownMethods);
333
			reportDeclaration(methodBinding, locator, declPattern.knownMethods);
334
		}
334
		}
335
	} else {
335
	} else {
336
		MethodReferenceMatch methodReferenceMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, -1, -1, false /*not constructor*/, false/*not synthetic*/, reference);
336
		InternalMethodReferenceMatch methodReferenceMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, -1, -1, false /*not constructor*/, false/*not synthetic*/, reference);
337
		methodReferenceMatch.localElement(localElement);
337
		methodReferenceMatch.localElement(localElement);
338
		this.match = methodReferenceMatch;
338
		this.match = methodReferenceMatch;
339
		if (this.pattern.findReferences && reference instanceof MessageSend) {
339
		if (this.pattern.findReferences && reference instanceof MessageSend) {
(-)search/org/eclipse/jdt/internal/core/search/matching/InternalReferenceMatch.java (-48 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search.matching;
12
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.*;
15
import org.eclipse.jdt.core.search.*;
16
17
/**
18
 * An intermediate class to store data in the search match and access them
19
 * in a private manner.
20
 *
21
 * @since 3.4
22
 */
23
public abstract class InternalReferenceMatch extends ReferenceMatch {
24
25
	IJavaElement localElement;
26
27
public InternalReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) {
28
	super(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource);
29
}
30
31
/**
32
 * Return the stored local element.
33
 *
34
 * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement()
35
 */
36
protected IJavaElement localElement() {
37
	return this.localElement;
38
}
39
40
/**
41
 * Store the local element in the match.
42
 *
43
 * @param element The local element to be stored
44
 */
45
public void localElement(IJavaElement element) {
46
	this.localElement = element;
47
}
48
}
(-)search/org/eclipse/jdt/core/search/TypeReferenceMatch.java (-7 / +15 lines)
Lines 12-18 Link Here
12
12
13
import org.eclipse.core.resources.IResource;
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.*;
14
import org.eclipse.jdt.core.*;
15
import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch;
16
15
17
/**
16
/**
18
 * A Java search match that represents a type reference.
17
 * A Java search match that represents a type reference.
Lines 23-30 Link Here
23
 *
22
 *
24
 * @since 3.0
23
 * @since 3.0
25
 */
24
 */
26
public class TypeReferenceMatch extends InternalReferenceMatch {
25
public class TypeReferenceMatch extends ReferenceMatch {
27
26
27
	private IJavaElement localElement;
28
	private IJavaElement[] otherElements;
28
	private IJavaElement[] otherElements;
29
29
30
/**
30
/**
Lines 77-98 Link Here
77
 * @since 3.2
77
 * @since 3.2
78
 */
78
 */
79
public final IJavaElement[] getOtherElements() {
79
public final IJavaElement[] getOtherElements() {
80
	IJavaElement localElement = localElement();
80
	if (this.localElement == null || this.localElement.getElementType() != IJavaElement.ANNOTATION) {
81
	if (localElement == null || localElement.getElementType() != IJavaElement.ANNOTATION) {
82
		return this.otherElements;
81
		return this.otherElements;
83
	}
82
	}
84
	return null;
83
	return null;
85
}
84
}
86
85
87
/**
86
/**
87
 * Return the stored local element.
88
 *
89
 * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement()
90
 */
91
protected IJavaElement localElement() {
92
	return this.localElement;
93
}
94
95
/**
88
 * Sets the local element of this search match.
96
 * Sets the local element of this search match.
89
 *
97
 *
90
 * @param localElement A more specific local element that corresponds to the match,
98
 * @param element A more specific local element that corresponds to the match,
91
 * 	or <code>null</code> if none
99
 * 	or <code>null</code> if none
92
 * @since 3.2
100
 * @since 3.2
93
 */
101
 */
94
public final void setLocalElement(IJavaElement localElement) {
102
public final void setLocalElement(IJavaElement element) {
95
	localElement(localElement);
103
	this.localElement = element;
96
}
104
}
97
105
98
/**
106
/**
(-)search/org/eclipse/jdt/core/search/FieldReferenceMatch.java (-2 / +1 lines)
Lines 12-18 Link Here
12
12
13
import org.eclipse.core.resources.IResource;
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.IJavaElement;
14
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch;
16
15
17
/**
16
/**
18
 * A Java search match that represents a field reference.
17
 * A Java search match that represents a field reference.
Lines 23-29 Link Here
23
 *
22
 *
24
 * @since 3.0
23
 * @since 3.0
25
 */
24
 */
26
public class FieldReferenceMatch extends InternalReferenceMatch {
25
public class FieldReferenceMatch extends ReferenceMatch {
27
26
28
private boolean isReadAccess;
27
private boolean isReadAccess;
29
private boolean isWriteAccess;
28
private boolean isWriteAccess;
(-)search/org/eclipse/jdt/core/search/MethodReferenceMatch.java (-2 / +1 lines)
Lines 12-18 Link Here
12
12
13
import org.eclipse.core.resources.IResource;
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.IJavaElement;
14
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch;
16
15
17
/**
16
/**
18
 * A Java search match that represents a method reference.
17
 * A Java search match that represents a method reference.
Lines 23-29 Link Here
23
 *
22
 *
24
 * @since 3.0
23
 * @since 3.0
25
 */
24
 */
26
public class MethodReferenceMatch extends InternalReferenceMatch {
25
public class MethodReferenceMatch extends ReferenceMatch {
27
	private boolean constructor;
26
	private boolean constructor;
28
	private boolean synthetic;
27
	private boolean synthetic;
29
	private boolean superInvocation;
28
	private boolean superInvocation;
(-)search/org/eclipse/jdt/core/search/PackageReferenceMatch.java (-2 / +1 lines)
Lines 12-18 Link Here
12
12
13
import org.eclipse.core.resources.IResource;
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.IJavaElement;
14
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch;
16
15
17
/**
16
/**
18
 * A Java search match that represents a package reference.
17
 * A Java search match that represents a package reference.
Lines 23-29 Link Here
23
 *
22
 *
24
 * @since 3.0
23
 * @since 3.0
25
 */
24
 */
26
public class PackageReferenceMatch extends InternalReferenceMatch {
25
public class PackageReferenceMatch extends ReferenceMatch {
27
26
28
/**
27
/**
29
 * Creates a new package reference match.
28
 * Creates a new package reference match.
(-)search/org/eclipse/jdt/internal/core/search/matching/InternalMethodReferenceMatch.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search.matching;
12
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.*;
15
import org.eclipse.jdt.core.search.*;
16
17
/**
18
 * A field reference match that stores the local element
19
 */
20
public class InternalMethodReferenceMatch extends MethodReferenceMatch {
21
22
	IJavaElement localElement;
23
24
public InternalMethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean constructor, boolean synthetic, boolean superInvocation, boolean insideDocComment, SearchParticipant participant, IResource resource) {
25
	super(enclosingElement, accuracy, offset, length, constructor, synthetic, superInvocation, insideDocComment, participant, resource);
26
}
27
28
/**
29
 * Return the stored local element.
30
 *
31
 * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement()
32
 */
33
protected IJavaElement localElement() {
34
	return this.localElement;
35
}
36
37
/**
38
 * Store the local element in the match.
39
 *
40
 * @param element The local element to be stored
41
 */
42
public void localElement(IJavaElement element) {
43
	this.localElement = element;
44
}
45
}
(-)search/org/eclipse/jdt/internal/core/search/matching/InternalFieldReferenceMatch.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search.matching;
12
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.*;
15
import org.eclipse.jdt.core.search.*;
16
17
/**
18
 * A method reference match that stores the local element
19
 */
20
public class InternalFieldReferenceMatch extends FieldReferenceMatch {
21
22
	IJavaElement localElement;
23
24
public InternalFieldReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean isReadAccess, boolean isWriteAccess, boolean insideDocComment, SearchParticipant participant, IResource resource) {
25
	super(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
26
}
27
28
/**
29
 * Return the stored local element.
30
 *
31
 * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement()
32
 */
33
protected IJavaElement localElement() {
34
	return this.localElement;
35
}
36
37
/**
38
 * Store the local element in the match.
39
 *
40
 * @param element The local element to be stored
41
 */
42
public void localElement(IJavaElement element) {
43
	this.localElement = element;
44
}
45
}
(-)search/org/eclipse/jdt/internal/core/search/matching/InternalPackageReferenceMatch.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.search.matching;
12
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.jdt.core.*;
15
import org.eclipse.jdt.core.search.*;
16
17
/**
18
 * A package reference match that stores the local element
19
 */
20
public class InternalPackageReferenceMatch extends PackageReferenceMatch {
21
22
	IJavaElement localElement;
23
24
public InternalPackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) {
25
	super(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource);
26
}
27
28
/**
29
 * Return the stored local element.
30
 *
31
 * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement()
32
 */
33
protected IJavaElement localElement() {
34
	return this.localElement;
35
}
36
37
/**
38
 * Store the local element in the match.
39
 *
40
 * @param element The local element to be stored
41
 */
42
public void localElement(IJavaElement element) {
43
	this.localElement = element;
44
}
45
}

Return to bug 247618