Index: search/org/eclipse/jdt/core/search/FieldReferenceMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java,v retrieving revision 1.11 diff -u -r1.11 FieldReferenceMatch.java --- search/org/eclipse/jdt/core/search/FieldReferenceMatch.java 22 Apr 2004 15:23:49 -0000 1.11 +++ search/org/eclipse/jdt/core/search/FieldReferenceMatch.java 26 May 2004 18:43:37 -0000 @@ -24,7 +24,6 @@ */ public class FieldReferenceMatch extends SearchMatch { - private boolean insideDocComment; private boolean isReadAccess; private boolean isWriteAccess; @@ -32,12 +31,13 @@ * Creates a new field reference match. * * @param enclosingElement the inner-most enclosing member that references this field - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown * @param isReadAccess whether the match represents a read access * @param isWriteAccess whethre the match represents a write access - * @param insideDocComment whether the match is inside a doc comment + * @param insideDocComment true if this search match is inside a doc + * comment, and false otherwise * @param participant the search participant that created the match * @param resource the resource of the element */ @@ -45,16 +45,9 @@ super(enclosingElement, accuracy, offset, length, participant, resource); this.isReadAccess = isReadAccess; this.isWriteAccess = isWriteAccess; - this.insideDocComment = insideDocComment; + setInsideDocComment(insideDocComment); } - /** - * @see org.eclipse.jdt.core.search.SearchMatch#isInsideDocComment() - */ - public final boolean isInsideDocComment() { - return this.insideDocComment; - } - /** * Returns whether the field reference is a read access to the field. * Note that a field reference can be read and written at once in case of compound assignments (e.g. i += 0;) Index: search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java,v retrieving revision 1.8 diff -u -r1.8 LocalVariableReferenceMatch.java --- search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java 6 May 2004 13:37:11 -0000 1.8 +++ search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java 26 May 2004 18:43:37 -0000 @@ -24,7 +24,6 @@ */ public class LocalVariableReferenceMatch extends SearchMatch { - private boolean insideDocComment; private boolean isReadAccess; private boolean isWriteAccess; @@ -32,12 +31,13 @@ * Creates a new local variable reference match. * * @param enclosingElement the inner-most enclosing member that references this local variable - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown * @param isReadAccess whether the match represents a read access * @param isWriteAccess whethre the match represents a write access - * @param insideDocComment whether the match is inside a doc comment + * @param insideDocComment true if this search match is inside a doc + * comment, and false otherwise * @param participant the search participant that created the match * @param resource the resource of the element */ @@ -45,14 +45,7 @@ super(enclosingElement, accuracy, offset, length, participant, resource); this.isReadAccess = isReadAccess; this.isWriteAccess = isWriteAccess; - this.insideDocComment = insideDocComment; - } - - /** - * @see org.eclipse.jdt.core.search.SearchMatch#isInsideDocComment() - */ - public final boolean isInsideDocComment() { - return this.insideDocComment; + setInsideDocComment(insideDocComment); } /** Index: search/org/eclipse/jdt/core/search/MethodReferenceMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java,v retrieving revision 1.9 diff -u -r1.9 MethodReferenceMatch.java --- search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 22 Apr 2004 15:23:49 -0000 1.9 +++ search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 26 May 2004 18:43:37 -0000 @@ -24,29 +24,20 @@ */ public class MethodReferenceMatch extends SearchMatch { - private boolean insideDocComment; - /** * Creates a new method reference match. * * @param enclosingElement the inner-most enclosing member that references this method - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown - * @param insideDocComment whether the match is inside a doc comment + * @param insideDocComment true if this search match is inside a doc + * comment, and false otherwise * @param participant the search participant that created the match * @param resource the resource of the element */ public MethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) { super(enclosingElement, accuracy, offset, length, participant, resource); - this.insideDocComment = insideDocComment; + setInsideDocComment(insideDocComment); } - - /** - * @see org.eclipse.jdt.core.search.SearchMatch#isInsideDocComment() - */ - public final boolean isInsideDocComment() { - return this.insideDocComment; - } - } Index: search/org/eclipse/jdt/core/search/PackageReferenceMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java,v retrieving revision 1.7 diff -u -r1.7 PackageReferenceMatch.java --- search/org/eclipse/jdt/core/search/PackageReferenceMatch.java 22 Apr 2004 09:58:25 -0000 1.7 +++ search/org/eclipse/jdt/core/search/PackageReferenceMatch.java 26 May 2004 18:43:37 -0000 @@ -15,10 +15,10 @@ /** * A Java search match that represents a package reference. - * The element is the inner-most enclosing member that references this package. *

+ * The element is the inner-most enclosing member that references this package. + *

* This class is intended to be instantiated and subclassed by clients. *

- * * @since 3.0 */ @@ -28,14 +28,16 @@ * Creates a new package reference match. * * @param enclosingElement the inner-most enclosing member that references this package - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown + * @param insideDocComment true if this search match is inside a doc + * comment, and false otherwise * @param participant the search participant that created the match * @param resource the resource of the element */ - public PackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, SearchParticipant participant, IResource resource) { + public PackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) { super(enclosingElement, accuracy, offset, length, participant, resource); + setInsideDocComment(insideDocComment); } - } Index: search/org/eclipse/jdt/core/search/SearchMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java,v retrieving revision 1.15 diff -u -r1.15 SearchMatch.java --- search/org/eclipse/jdt/core/search/SearchMatch.java 12 May 2004 13:27:25 -0000 1.15 +++ search/org/eclipse/jdt/core/search/SearchMatch.java 26 May 2004 18:43:37 -0000 @@ -51,12 +51,17 @@ private SearchParticipant participant; private IResource resource; + private boolean insideDocComment = false; + /** * Creates a new search match. + *

+ * Note that isInsideDocComment() defaults to false. + *

* * @param element the element that encloses or corresponds to the match, * or null if none - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown * @param participant the search participant that created the match @@ -132,23 +137,41 @@ public final IResource getResource() { return this.resource; } - + /** * Returns whether this search match is inside a doc comment of a Java * source file. * - * @return true if this search match is inside a Java doc + * @return true if this search match is inside a doc * comment, and false otherwise */ - public boolean isInsideDocComment() { + public final boolean isInsideDocComment() { // default is outside a doc comment - return false; + return this.insideDocComment; + } + + /** + * Sets the accuracy of this match. + * + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} + */ + public final void setAccuracy (int accuracy) { + this.accuracy = accuracy; } /** + * Sets the element of this search match. + * + * @param element the element that encloses or corresponds to the match, + * or null if none + */ + public final void setElement (Object element) { + this.element = element; + } + /** * Sets the length of this search match. * - * @param length the length of this match, or -1 if unknown + * @param length the length of the match, or -1 if unknown */ public final void setLength(int length) { this.length = length; @@ -157,13 +180,42 @@ /** * Sets the offset of this search match. * - * @param offset the offset of this match, or -1 if unknown + * @param offset the offset the match starts at, or -1 if unknown */ public final void setOffset(int offset) { this.offset = offset; } - + + /** + * Sets the participant of this match. + * + * @param participant the search participant that created this match + */ + public final void setParticipant (SearchParticipant participant) { + this.participant = participant; + } + /** + * Sets the resource of this match. + * + * @param resource the resource of the match, or null if none + */ + public final void setResource (IResource resource) { + this.resource = resource; + } + + /** + * Sets whether this search match is inside a doc comment of a Java + * source file. + * + * @param insideDoc true if this search match is inside a doc + * comment, and false otherwise + */ + public final void setInsideDocComment (boolean insideDoc) { + this.insideDocComment = insideDoc; + } + + /* (non-javadoc) * @see java.lang.Object#toString() */ public String toString() { @@ -175,8 +227,10 @@ buffer.append(this.offset); buffer.append("\n length="); //$NON-NLS-1$ buffer.append(this.length); - buffer.append("\n element="); //$NON-NLS-1$ - buffer.append(((JavaElement)getElement()).toStringWithAncestors()); + if (this.element != null) { + buffer.append("\n element="); //$NON-NLS-1$ + buffer.append(((JavaElement)getElement()).toStringWithAncestors()); + } buffer.append("\n"); //$NON-NLS-1$ return buffer.toString(); } Index: search/org/eclipse/jdt/core/search/TypeReferenceMatch.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java,v retrieving revision 1.9 diff -u -r1.9 TypeReferenceMatch.java --- search/org/eclipse/jdt/core/search/TypeReferenceMatch.java 22 Apr 2004 15:23:49 -0000 1.9 +++ search/org/eclipse/jdt/core/search/TypeReferenceMatch.java 26 May 2004 18:43:37 -0000 @@ -24,28 +24,20 @@ */ public class TypeReferenceMatch extends SearchMatch { - private boolean insideDocComment; - /** * Creates a new type reference match. * * @param enclosingElement the inner-most enclosing member that references this type - * @param accuracy one of A_ACCURATE or A_INACCURATE + * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE} * @param offset the offset the match starts at, or -1 if unknown * @param length the length of the match, or -1 if unknown - * @param insideDocComment whether the match is inside a doc comment + * @param insideDocComment true if this search match is inside a doc + * comment, and false otherwise * @param participant the search participant that created the match * @param resource the resource of the element */ public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) { super(enclosingElement, accuracy, offset, length, participant, resource); - this.insideDocComment = insideDocComment; - } - - /** - * @see org.eclipse.jdt.core.search.SearchMatch#isInsideDocComment() - */ - public final boolean isInsideDocComment() { - return this.insideDocComment; + setInsideDocComment(insideDocComment); } } Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v retrieving revision 1.182 diff -u -r1.182 MatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 24 May 2004 16:34:25 -0000 1.182 +++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 26 May 2004 18:43:38 -0000 @@ -1053,7 +1053,8 @@ ASTNode reference) { SearchParticipant participant = getParticipant(); IResource resource = this.currentPossibleMatch.resource; - return new PackageReferenceMatch(enclosingElement, accuracy, offset, length, participant, resource); + boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0; + return new PackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource); } public SearchMatch newTypeReferenceMatch(