Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 20369 Details for
Bug 82208
[search] BasicSearchEngine#searchAllTypeNames doc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to implement this functionality
v00.txt (text/plain), 36.07 KB, created by
Frederic Fusier
on 2005-04-26 11:48:30 EDT
(
hide
)
Description:
Patch to implement this functionality
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2005-04-26 11:48:30 EDT
Size:
36.07 KB
patch
obsolete
>Index: search/org/eclipse/jdt/core/search/SearchEngine.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java,v >retrieving revision 1.124 >diff -u -r1.124 SearchEngine.java >--- search/org/eclipse/jdt/core/search/SearchEngine.java 19 Mar 2005 09:23:12 -0000 1.124 >+++ search/org/eclipse/jdt/core/search/SearchEngine.java 26 Apr 2005 15:28:33 -0000 >@@ -19,12 +19,12 @@ > import org.eclipse.jdt.internal.core.search.matching.*; > > /** >- * A <code>SearchEngine</code> searches for Java elements following a search pattern. >+ * A {@link SearchEngine} searches for Java elements following a search pattern. > * The search can be limited to a search scope. > * <p> > * Various search patterns can be created using the factory methods >- * <code>createSearchPattern(String, int, int, boolean)</code>, <code>createSearchPattern(IJavaElement, int)</code>, >- * <code>createOrSearchPattern(ISearchPattern, ISearchPattern)</code>. >+ * {@link SearchPattern#createPattern(String, int, int, int)}, {@link SearchPattern#createPattern(IJavaElement, int)}, >+ * {@link SearchPattern#createOrPattern(SearchPattern, SearchPattern)}. > * </p> > * <p>For example, one can search for references to a method in the hierarchy of a type, > * or one can search for the declarations of types starting with "Abstract" in a project. >@@ -324,26 +324,26 @@ > * @param stringPattern the given pattern > * @param searchFor determines the nature of the searched elements > * <ul> >- * <li><code>IJavaSearchConstants.CLASS</code>: only look for classes</li> >- * <li><code>IJavaSearchConstants.INTERFACE</code>: only look for interfaces</li> >- * <li><code>IJavaSearchConstants.TYPE</code>: look for both classes and interfaces</li> >- * <li><code>IJavaSearchConstants.FIELD</code>: look for fields</li> >- * <li><code>IJavaSearchConstants.METHOD</code>: look for methods</li> >- * <li><code>IJavaSearchConstants.CONSTRUCTOR</code>: look for constructors</li> >- * <li><code>IJavaSearchConstants.PACKAGE</code>: look for packages</li> >+ * <li>{@link IJavaSearchConstants#CLASS}: only look for classes</li> >+ * <li>{@link IJavaSearchConstants#INTERFACE}: only look for interfaces</li> >+ * <li>{@link IJavaSearchConstants#TYPE}: look for both classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#FIELD}: look for fields</li> >+ * <li>{@link IJavaSearchConstants#METHOD}: look for methods</li> >+ * <li>{@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors</li> >+ * <li>{@link IJavaSearchConstants#PACKAGE}: look for packages</li> > * </ul> > * @param limitTo determines the nature of the expected matches > * <ul> >- * <li><code>IJavaSearchConstants.DECLARATIONS</code>: will search declarations matching with the corresponding >+ * <li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching with the corresponding > * element. In case the element is a method, declarations of matching methods in subtypes will also > * be found, allowing to find declarations of abstract methods, etc.</li> > * >- * <li><code>IJavaSearchConstants.REFERENCES</code>: will search references to the given element.</li> >+ * <li>{@link IJavaSearchConstants#REFERENCES}: will search references to the given element.</li> > * >- * <li><code>IJavaSearchConstants.ALL_OCCURRENCES</code>: will search for either declarations or references as specified >+ * <li>{@link IJavaSearchConstants#ALL_OCCURRENCES}: will search for either declarations or references as specified > * above.</li> > * >- * <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: for interface, will find all types which implements a given interface.</li> >+ * <li>{@link IJavaSearchConstants#IMPLEMENTORS}: for interface, will find all types which implements a given interface.</li> > * </ul> > * > * @param isCaseSensitive indicates whether the search is case sensitive or not. >@@ -365,16 +365,16 @@ > * @param element the Java element the search pattern is based on > * @param limitTo determines the nature of the expected matches > * <ul> >- * <li><code>IJavaSearchConstants.DECLARATIONS</code>: will search declarations matching with the corresponding >+ * <li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching with the corresponding > * element. In case the element is a method, declarations of matching methods in subtypes will also > * be found, allowing to find declarations of abstract methods, etc.</li> > * >- * <li><code>IJavaSearchConstants.REFERENCES</code>: will search references to the given element.</li> >+ * <li>{@link IJavaSearchConstants#REFERENCES}: will search references to the given element.</li> > * >- * <li><code>IJavaSearchConstants.ALL_OCCURRENCES</code>: will search for either declarations or references as specified >+ * <li>{@link IJavaSearchConstants#ALL_OCCURRENCES}: will search for either declarations or references as specified > * above.</li> > * >- * <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: for interface, will find all types which implements a given interface.</li> >+ * <li>{@link IJavaSearchConstants#IMPLEMENTORS}: for interface, will find all types which implements a given interface.</li> > * </ul> > * @return a search pattern for a Java element or <code>null</code> if the given element is ill-formed > * @deprecated Use {@link SearchPattern#createPattern(IJavaElement, int)} instead. >@@ -413,16 +413,16 @@ > * @param workspace the workspace > * @param patternString the pattern to be searched for > * @param searchFor a hint what kind of Java element the string pattern represents. >- * Look into <code>IJavaSearchConstants</code> for valid values >+ * Look into {@link IJavaSearchConstants} for valid values > * @param limitTo one of the following values: > * <ul> >- * <li><code>IJavaSearchConstants.DECLARATIONS</code>: search >+ * <li>{@link IJavaSearchConstants#DECLARATIONS}: search > * for declarations only </li> >- * <li><code>IJavaSearchConstants.REFERENCES</code>: search >+ * <li>{@link IJavaSearchConstants#REFERENCES}: search > * for all references </li> >- * <li><code>IJavaSearchConstants.ALL_OCCURENCES</code>: search >+ * <li>{@link IJavaSearchConstants#ALL_OCCURRENCES}: search > * for both declarations and all references </li> >- * <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: search for >+ * <li>{@link IJavaSearchConstants#IMPLEMENTORS}: search for > * all implementors of an interface; the value is only valid if > * the Java element represents an interface</li> > * </ul> >@@ -459,13 +459,13 @@ > * @param element the Java element to be searched for > * @param limitTo one of the following values: > * <ul> >- * <li><code>IJavaSearchConstants.DECLARATIONS</code>: search >+ * <li>{@link IJavaSearchConstants#DECLARATIONS}: search > * for declarations only </li> >- * <li><code>IJavaSearchConstants.REFERENCES</code>: search >+ * <li>{@link IJavaSearchConstants#REFERENCES}: search > * for all references </li> >- * <li><code>IJavaSearchConstants.ALL_OCCURENCES</code>: search >+ * <li>{@link IJavaSearchConstants#ALL_OCCURRENCES}: search > * for both declarations and all references </li> >- * <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: search for >+ * <li>{@link IJavaSearchConstants#IMPLEMENTORS}: search for > * all implementors of an interface; the value is only valid if > * the Java element represents an interface</li> > * </ul> >@@ -544,29 +544,33 @@ > * for this type, or a wild-carded string for this type. > * @param matchRule one of > * <ul> >- * <li><code>SearchPattern.R_EXACT_MATCH</code> if the package name and type name are the full names >+ * <li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names > * of the searched types.</li> >- * <li><code>SearchPattern.R_PREFIX_MATCH</code> if the package name and type name are prefixes of the names >+ * <li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names > * of the searched types.</li> >- * <li><code>SearchPattern.R_PATTERN_MATCH</code> if the package name and type name contain wild-cards.</li> >- * </ul> >- * combined with <code>SearchPattern.R_CASE_SENSITIVE</code>, >- * e.g. <code>R_EXACT_MATCH | R_CASE_SENSITIVE</code> if an exact and case sensitive match is requested, >- * or <code>R_PREFIX_MATCH</code> if a prefix non case sensitive match is requested. >- * @param searchFor one of >- * <ul> >- * <li><code>IJavaSearchConstants.CLASS</code> if searching for classes only</li> >- * <li><code>IJavaSearchConstants.INTERFACE</code> if searching for interfaces only</li> >- * <li><code>IJavaSearchConstants.TYPE</code> if searching for both classes and interfaces</li> >+ * <li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li> > * </ul> >+ * combined with {@link SearchPattern#R_CASE_SENSITIVE}, >+ * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, >+ * or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested. >+ * @param searchFor determines the nature of the searched elements >+ * <ul> >+ * <li>{@link IJavaSearchConstants#CLASS}: only look for classes</li> >+ * <li>{@link IJavaSearchConstants#INTERFACE}: only look for interfaces</li> >+ * <li>{@link IJavaSearchConstants#ENUM}: only look for enumeration</li> >+ * <li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)</li> >+ * </ul> > * @param scope the scope to search in > * @param nameRequestor the requestor that collects the results of the search > * @param waitingPolicy one of > * <ul> >- * <li><code>IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH</code> if the search should start immediately</li> >- * <li><code>IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH</code> if the search should be cancelled if the >+ * <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li> >+ * <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the > * underlying indexer has not finished indexing the workspace</li> >- * <li><code>IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH</code> if the search should wait for the >+ * <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the > * underlying indexer to finish indexing the workspace</li> > * </ul> > * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress >@@ -601,10 +605,10 @@ > * @param nameRequestor the requestor that collects the results of the search > * @param waitingPolicy one of > * <ul> >- * <li><code>IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH</code> if the search should start immediately</li> >- * <li><code>IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH</code> if the search should be cancelled if the >+ * <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li> >+ * <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the > * underlying indexer has not finished indexing the workspace</li> >- * <li><code>IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH</code> if the search should wait for the >+ * <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the > * underlying indexer to finish indexing the workspace</li> > * </ul> > * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress >@@ -647,29 +651,29 @@ > * for this type, or a wild-carded string for this type. > * @param matchRule one of > * <ul> >- * <li><code>SearchPattern.R_EXACT_MATCH</code> if the package name and type name are the full names >+ * <li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names > * of the searched types.</li> >- * <li><code>SearchPattern.R_PREFIX_MATCH</code> if the package name and type name are prefixes of the names >+ * <li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names > * of the searched types.</li> >- * <li><code>SearchPattern.R_PATTERN_MATCH</code> if the package name and type name contain wild-cards.</li> >+ * <li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li> > * </ul> >- * combined with <code>SearchPattern.R_CASE_SENSITIVE</code>, >- * e.g. <code>R_EXACT_MATCH | R_CASE_SENSITIVE</code> if an exact and case sensitive match is requested, >- * or <code>R_PREFIX_MATCH</code> if a prefix non case sensitive match is requested. >+ * combined with {@link SearchPattern#R_CASE_SENSITIVE}, >+ * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, >+ * or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested. > * @param searchFor one of > * <ul> >- * <li><code>IJavaSearchConstants.CLASS</code> if searching for classes only</li> >- * <li><code>IJavaSearchConstants.INTERFACE</code> if searching for interfaces only</li> >- * <li><code>IJavaSearchConstants.TYPE</code> if searching for both classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#CLASS} if searching for classes only</li> >+ * <li>{@link IJavaSearchConstants#INTERFACE} if searching for interfaces only</li> >+ * <li>{@link IJavaSearchConstants#TYPE} if searching for both classes and interfaces</li> > * </ul> > * @param scope the scope to search in > * @param nameRequestor the requestor that collects the results of the search > * @param waitingPolicy one of > * <ul> >- * <li><code>IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH</code> if the search should start immediately</li> >- * <li><code>IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH</code> if the search should be cancelled if the >+ * <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li> >+ * <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the > * underlying indexer has not finished indexing the workspace</li> >- * <li><code>IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH</code> if the search should wait for the >+ * <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the > * underlying indexer to finish indexing the workspace</li> > * </ul> > * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress >@@ -707,27 +711,27 @@ > * for this type, or a wild-carded string for this type. > * @param matchMode one of > * <ul> >- * <li><code>IJavaSearchConstants.EXACT_MATCH</code> if the package name and type name are the full names >+ * <li>{@link IJavaSearchConstants#EXACT_MATCH} if the package name and type name are the full names > * of the searched types.</li> >- * <li><code>IJavaSearchConstants.PREFIX_MATCH</code> if the package name and type name are prefixes of the names >+ * <li>{@link IJavaSearchConstants#PREFIX_MATCH} if the package name and type name are prefixes of the names > * of the searched types.</li> >- * <li><code>IJavaSearchConstants.PATTERN_MATCH</code> if the package name and type name contain wild-cards.</li> >+ * <li>{@link IJavaSearchConstants#PATTERN_MATCH} if the package name and type name contain wild-cards.</li> > * </ul> > * @param isCaseSensitive whether the search should be case sensitive > * @param searchFor one of > * <ul> >- * <li><code>IJavaSearchConstants.CLASS</code> if searching for classes only</li> >- * <li><code>IJavaSearchConstants.INTERFACE</code> if searching for interfaces only</li> >- * <li><code>IJavaSearchConstants.TYPE</code> if searching for both classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#CLASS} if searching for classes only</li> >+ * <li>{@link IJavaSearchConstants#INTERFACE} if searching for interfaces only</li> >+ * <li>{@link IJavaSearchConstants#TYPE} if searching for both classes and interfaces</li> > * </ul> > * @param scope the scope to search in > * @param nameRequestor the requestor that collects the results of the search > * @param waitingPolicy one of > * <ul> >- * <li><code>IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH</code> if the search should start immediately</li> >- * <li><code>IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH</code> if the search should be cancelled if the >+ * <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li> >+ * <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the > * underlying indexer has not finished indexing the workspace</li> >- * <li><code>IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH</code> if the search should wait for the >+ * <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the > * underlying indexer to finish indexing the workspace</li> > * </ul> > * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress >Index: search/org/eclipse/jdt/core/search/SearchPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java,v >retrieving revision 1.40 >diff -u -r1.40 SearchPattern.java >--- search/org/eclipse/jdt/core/search/SearchPattern.java 11 Apr 2005 07:21:19 -0000 1.40 >+++ search/org/eclipse/jdt/core/search/SearchPattern.java 26 Apr 2005 15:28:35 -0000 >@@ -339,7 +339,7 @@ > * <li><Exception>Sample(Exception)</li> > * </ul> > * Type arguments have the same pattern that for type patterns >- * @see #createTypePattern(String,int,int) >+ * @see #createTypePattern(String,int,int,char) > */ > private static SearchPattern createMethodOrConstructorPattern(String patternString, int limitTo, int matchRule, boolean isConstructor) { > >@@ -767,7 +767,11 @@ > * <ul> > * <li>{@link IJavaSearchConstants#CLASS}: only look for classes</li> > * <li>{@link IJavaSearchConstants#INTERFACE}: only look for interfaces</li> >- * <li>{@link IJavaSearchConstants#TYPE}: look for both classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#ENUM}: only look for enumeration</li> >+ * <li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)</li> > * <li>{@link IJavaSearchConstants#FIELD}: look for fields</li> > * <li>{@link IJavaSearchConstants#METHOD}: look for methods</li> > * <li>{@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors</li> >@@ -808,8 +812,20 @@ > limitTo &= ~(IJavaSearchConstants.IGNORE_DECLARING_TYPE+IJavaSearchConstants.IGNORE_RETURN_TYPE); > > switch (searchFor) { >+ case IJavaSearchConstants.CLASS: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_SUFFIX); >+ case IJavaSearchConstants.CLASS_AND_INTERFACE: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_AND_INTERFACE_SUFFIX); >+ case IJavaSearchConstants.CLASS_AND_ENUM: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.CLASS_AND_ENUM_SUFFIX); >+ case IJavaSearchConstants.INTERFACE: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.INTERFACE_SUFFIX); >+ case IJavaSearchConstants.ENUM: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.ENUM_SUFFIX); >+ case IJavaSearchConstants.ANNOTATION_TYPE: >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.ANNOTATION_TYPE_SUFFIX); > case IJavaSearchConstants.TYPE: >- return createTypePattern(stringPattern, limitTo, matchRule); >+ return createTypePattern(stringPattern, limitTo, matchRule, IIndexConstants.TYPE_SUFFIX); > case IJavaSearchConstants.METHOD: > return createMethodOrConstructorPattern(stringPattern, limitTo, matchRule, false/*not a constructor*/); > case IJavaSearchConstants.CONSTRUCTOR: >@@ -1274,7 +1290,7 @@ > * - '*' is not valid inside type arguments definition <> > * - '?' is treated as a wildcard when it is inside <> (ie. it must be put on first position of the type argument) > */ >- private static SearchPattern createTypePattern(String patternString, int limitTo, int matchRule) { >+ private static SearchPattern createTypePattern(String patternString, int limitTo, int matchRule, char indexSuffix) { > > Scanner scanner = new Scanner(false /*comment*/, true /*whitespace*/, false /*nls*/, ClassFileConstants.JDK1_3/*sourceLevel*/, null /*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); > scanner.setSource(patternString.toCharArray()); >@@ -1356,14 +1372,14 @@ > } > switch (limitTo) { > case IJavaSearchConstants.DECLARATIONS : // cannot search for explicit member types >- return new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, IIndexConstants.TYPE_SUFFIX, matchRule); >+ return new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, indexSuffix, matchRule); > case IJavaSearchConstants.REFERENCES : > return new TypeReferencePattern(qualificationChars, typeChars, typeSignature, matchRule); > case IJavaSearchConstants.IMPLEMENTORS : > return new SuperTypeReferencePattern(qualificationChars, typeChars, true, matchRule); > case IJavaSearchConstants.ALL_OCCURRENCES : > return new OrPattern( >- new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, IIndexConstants.TYPE_SUFFIX, matchRule),// cannot search for explicit member types >+ new QualifiedTypeDeclarationPattern(qualificationChars, typeChars, indexSuffix, matchRule),// cannot search for explicit member types > new TypeReferencePattern(qualificationChars, typeChars, matchRule)); > } > return null; >Index: search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java,v >retrieving revision 1.9 >diff -u -r1.9 BasicSearchEngine.java >--- search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 18 Apr 2005 19:21:35 -0000 1.9 >+++ search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 26 Apr 2005 15:28:36 -0000 >@@ -343,6 +343,12 @@ > case IIndexConstants.CLASS_SUFFIX : > if (typeKind != IGenericType.CLASS_DECL) return false; > break; >+ case IIndexConstants.CLASS_AND_INTERFACE_SUFFIX: >+ if (typeKind != IGenericType.CLASS_DECL && typeKind != IGenericType.INTERFACE_DECL) return false; >+ break; >+ case IIndexConstants.CLASS_AND_ENUM_SUFFIX: >+ if (typeKind != IGenericType.CLASS_DECL && typeKind != IGenericType.ENUM_DECL) return false; >+ break; > case IIndexConstants.INTERFACE_SUFFIX : > if (typeKind != IGenericType.INTERFACE_DECL) return false; > break; >@@ -415,12 +421,16 @@ > * combined with <code>SearchPattern.R_CASE_SENSITIVE</code>, > * e.g. <code>R_EXACT_MATCH | R_CASE_SENSITIVE</code> if an exact and case sensitive match is requested, > * or <code>R_PREFIX_MATCH</code> if a prefix non case sensitive match is requested. >- * @param searchFor one of >- * <ul> >- * <li><code>IJavaSearchConstants.CLASS</code> if searching for classes only</li> >- * <li><code>IJavaSearchConstants.INTERFACE</code> if searching for interfaces only</li> >- * <li><code>IJavaSearchConstants.TYPE</code> if searching for both classes and interfaces</li> >- * </ul> >+ * @param searchFor determines the nature of the searched elements >+ * <ul> >+ * <li>{@link IJavaSearchConstants#CLASS}: only look for classes</li> >+ * <li>{@link IJavaSearchConstants#INTERFACE}: only look for interfaces</li> >+ * <li>{@link IJavaSearchConstants#ENUM}: only look for enumeration</li> >+ * <li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li> >+ * <li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li> >+ * <li>{@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)</li> >+ * </ul> > * @param scope the scope to search in > * @param nameRequestor the requestor that collects the results of the search > * @param waitingPolicy one of >@@ -456,6 +466,12 @@ > case IJavaSearchConstants.CLASS : > typeSuffix = IIndexConstants.CLASS_SUFFIX; > break; >+ case IJavaSearchConstants.CLASS_AND_INTERFACE : >+ typeSuffix = IIndexConstants.CLASS_AND_INTERFACE_SUFFIX; >+ break; >+ case IJavaSearchConstants.CLASS_AND_ENUM : >+ typeSuffix = IIndexConstants.CLASS_AND_ENUM_SUFFIX; >+ break; > case IJavaSearchConstants.INTERFACE : > typeSuffix = IIndexConstants.INTERFACE_SUFFIX; > break; >@@ -678,6 +694,12 @@ > case IJavaSearchConstants.CLASS : > typeSuffix = IIndexConstants.CLASS_SUFFIX; > break; >+ case IJavaSearchConstants.CLASS_AND_INTERFACE : >+ typeSuffix = IIndexConstants.CLASS_AND_INTERFACE_SUFFIX; >+ break; >+ case IJavaSearchConstants.CLASS_AND_ENUM : >+ typeSuffix = IIndexConstants.CLASS_AND_ENUM_SUFFIX; >+ break; > case IJavaSearchConstants.INTERFACE : > typeSuffix = IIndexConstants.INTERFACE_SUFFIX; > break; >Index: search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java,v >retrieving revision 1.28 >diff -u -r1.28 IIndexConstants.java >--- search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java 23 Feb 2005 02:47:29 -0000 1.28 >+++ search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java 26 Apr 2005 15:28:36 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.core.search.indexing; > >+import org.eclipse.jdt.core.search.IJavaSearchConstants; >+ > public interface IIndexConstants { > > /* index encoding */ >@@ -31,6 +33,8 @@ > char ENUM_SUFFIX = 'E'; > char ANNOTATION_TYPE_SUFFIX = 'A'; > char TYPE_SUFFIX = 0; >+ char CLASS_AND_ENUM_SUFFIX = IJavaSearchConstants.CLASS_AND_ENUM; >+ char CLASS_AND_INTERFACE_SUFFIX = IJavaSearchConstants.CLASS_AND_INTERFACE; > char SEPARATOR= '/'; > > char[] ONE_STAR = new char[] {'*'}; >Index: search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java,v >retrieving revision 1.19 >diff -u -r1.19 ClassFileMatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 11 Apr 2005 09:58:00 -0000 1.19 >+++ search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 26 Apr 2005 15:28:37 -0000 >@@ -246,15 +246,20 @@ > if (!checkTypeName(pattern.simpleName, patternString, fullyQualifiedTypeName, pattern.isCaseSensitive())) return false; > } > >+ int kind = type.getKind(); > switch (pattern.typeSuffix) { > case CLASS_SUFFIX: >- return type.getKind() == IGenericType.CLASS_DECL; >+ return kind == IGenericType.CLASS_DECL; > case INTERFACE_SUFFIX: >- return type.getKind() == IGenericType.INTERFACE_DECL; >+ return kind == IGenericType.INTERFACE_DECL; > case ENUM_SUFFIX: >- return type.getKind() == IGenericType.ENUM_DECL; >+ return kind == IGenericType.ENUM_DECL; > case ANNOTATION_TYPE_SUFFIX: >- return type.getKind() == IGenericType.ANNOTATION_TYPE_DECL; >+ return kind == IGenericType.ANNOTATION_TYPE_DECL; >+ case CLASS_AND_INTERFACE_SUFFIX: >+ return kind == IGenericType.CLASS_DECL || kind == IGenericType.INTERFACE_DECL; >+ case CLASS_AND_ENUM_SUFFIX: >+ return kind == IGenericType.CLASS_DECL || kind == IGenericType.ENUM_DECL; > case TYPE_SUFFIX: // nothing > } > return true; >Index: search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java,v >retrieving revision 1.1 >diff -u -r1.1 MultiTypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 18 Mar 2005 22:10:59 -0000 1.1 >+++ search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 26 Apr 2005 15:28:37 -0000 >@@ -59,7 +59,7 @@ > } > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = false; // only used to report type declarations, not their positions >+ ((InternalSearchPattern)this).mustResolve = typeSuffix != TYPE_SUFFIX; // only used to report type declarations, not their positions > } > MultiTypeDeclarationPattern(int matchRule) { > super(TYPE_DECL_PATTERN, matchRule); >@@ -74,6 +74,8 @@ > QualifiedTypeDeclarationPattern pattern = (QualifiedTypeDeclarationPattern) decodedPattern; > switch(this.typeSuffix) { > case CLASS_SUFFIX : >+ case CLASS_AND_INTERFACE_SUFFIX: >+ case CLASS_AND_ENUM_SUFFIX: > case INTERFACE_SUFFIX : > case ENUM_SUFFIX : > case ANNOTATION_TYPE_SUFFIX : >@@ -143,6 +145,12 @@ > case CLASS_SUFFIX : > output.append("MultiClassDeclarationPattern: "); //$NON-NLS-1$ > break; >+ case CLASS_AND_INTERFACE_SUFFIX : >+ output.append("MultiClassAndInterfaceDeclarationPattern: "); //$NON-NLS-1$ >+ break; >+ case CLASS_AND_ENUM_SUFFIX : >+ output.append("MultiClassAndEnumDeclarationPattern: "); //$NON-NLS-1$ >+ break; > case INTERFACE_SUFFIX : > output.append("MultiInterfaceDeclarationPattern: "); //$NON-NLS-1$ > break; >Index: search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java,v >retrieving revision 1.26 >diff -u -r1.26 QualifiedTypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java 22 Apr 2005 21:02:14 -0000 1.26 >+++ search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java 26 Apr 2005 15:28:37 -0000 >@@ -26,7 +26,7 @@ > this.simpleName = isCaseSensitive() ? simpleName : CharOperation.toLowerCase(simpleName); > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = this.qualification != null; >+ ((InternalSearchPattern)this).mustResolve = this.qualification != null || typeSuffix != TYPE_SUFFIX; > } > QualifiedTypeDeclarationPattern(int matchRule) { > super(matchRule); >@@ -75,6 +75,8 @@ > QualifiedTypeDeclarationPattern pattern = (QualifiedTypeDeclarationPattern) decodedPattern; > switch(this.typeSuffix) { > case CLASS_SUFFIX : >+ case CLASS_AND_INTERFACE_SUFFIX : >+ case CLASS_AND_ENUM_SUFFIX : > case INTERFACE_SUFFIX : > case ENUM_SUFFIX : > case ANNOTATION_TYPE_SUFFIX : >@@ -88,6 +90,12 @@ > case CLASS_SUFFIX : > output.append("ClassDeclarationPattern: qualification<"); //$NON-NLS-1$ > break; >+ case CLASS_AND_INTERFACE_SUFFIX: >+ output.append("ClassAndInterfaceDeclarationPattern: qualification<"); //$NON-NLS-1$ >+ break; >+ case CLASS_AND_ENUM_SUFFIX : >+ output.append("ClassAndEnumDeclarationPattern: qualification<"); //$NON-NLS-1$ >+ break; > case INTERFACE_SUFFIX : > output.append("InterfaceDeclarationPattern: qualification<"); //$NON-NLS-1$ > break; >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java,v >retrieving revision 1.10 >diff -u -r1.10 TypeDeclarationLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java 23 Feb 2005 02:47:46 -0000 1.10 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java 26 Apr 2005 15:28:37 -0000 >@@ -52,10 +52,22 @@ > > switch (this.pattern.typeSuffix) { > case CLASS_SUFFIX: >- if (type.isInterface()) return IMPOSSIBLE_MATCH; >+ if (!type.isClass()) return IMPOSSIBLE_MATCH; >+ break; >+ case CLASS_AND_INTERFACE_SUFFIX: >+ if (!(type.isClass() || (type.isInterface() && !type.isAnnotationType()))) return IMPOSSIBLE_MATCH; >+ break; >+ case CLASS_AND_ENUM_SUFFIX: >+ if (!(type.isClass() || type.isEnum())) return IMPOSSIBLE_MATCH; > break; > case INTERFACE_SUFFIX: >- if (!type.isInterface()) return IMPOSSIBLE_MATCH; >+ if (!type.isInterface() || type.isAnnotationType()) return IMPOSSIBLE_MATCH; >+ break; >+ case ENUM_SUFFIX: >+ if (!type.isEnum()) return IMPOSSIBLE_MATCH; >+ break; >+ case ANNOTATION_TYPE_SUFFIX: >+ if (!type.isAnnotationType()) return IMPOSSIBLE_MATCH; > break; > case TYPE_SUFFIX : // nothing > } >Index: search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java,v >retrieving revision 1.49 >diff -u -r1.49 TypeDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 22 Apr 2005 21:02:14 -0000 1.49 >+++ search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 26 Apr 2005 15:28:38 -0000 >@@ -143,7 +143,7 @@ > this.simpleName = isCaseSensitive() ? simpleName : CharOperation.toLowerCase(simpleName); > this.typeSuffix = typeSuffix; > >- ((InternalSearchPattern)this).mustResolve = this.pkg != null && this.enclosingTypeNames != null; >+ ((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX; > } > TypeDeclarationPattern(int matchRule) { > super(TYPE_DECL_PATTERN, matchRule); >@@ -203,6 +203,8 @@ > TypeDeclarationPattern pattern = (TypeDeclarationPattern) decodedPattern; > switch(this.typeSuffix) { > case CLASS_SUFFIX : >+ case CLASS_AND_INTERFACE_SUFFIX : >+ case CLASS_AND_ENUM_SUFFIX : > case INTERFACE_SUFFIX : > case ENUM_SUFFIX : > case ANNOTATION_TYPE_SUFFIX : >@@ -251,6 +253,8 @@ > if (this.simpleName == null) { > switch(this.typeSuffix) { > case CLASS_SUFFIX : >+ case CLASS_AND_INTERFACE_SUFFIX : >+ case CLASS_AND_ENUM_SUFFIX : > case INTERFACE_SUFFIX : > case ENUM_SUFFIX : > case ANNOTATION_TYPE_SUFFIX : >@@ -276,6 +280,12 @@ > case CLASS_SUFFIX : > output.append("ClassDeclarationPattern: pkg<"); //$NON-NLS-1$ > break; >+ case CLASS_AND_INTERFACE_SUFFIX: >+ output.append("ClassAndInterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$ >+ break; >+ case CLASS_AND_ENUM_SUFFIX : >+ output.append("ClassAndEnumDeclarationPattern: pkg<"); //$NON-NLS-1$ >+ break; > case INTERFACE_SUFFIX : > output.append("InterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$ > break;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 82208
: 20369