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 SearchEngine
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.
*
* Various search patterns can be created using the factory methods
- * createSearchPattern(String, int, int, boolean)
, createSearchPattern(IJavaElement, int)
,
- * createOrSearchPattern(ISearchPattern, ISearchPattern)
.
+ * {@link SearchPattern#createPattern(String, int, int, int)}, {@link SearchPattern#createPattern(IJavaElement, int)},
+ * {@link SearchPattern#createOrPattern(SearchPattern, SearchPattern)}.
*
* 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
*
- * IJavaSearchConstants.CLASS
: only look for classes
- * IJavaSearchConstants.INTERFACE
: only look for interfaces
- * IJavaSearchConstants.TYPE
: look for both classes and interfaces
- * IJavaSearchConstants.FIELD
: look for fields
- * IJavaSearchConstants.METHOD
: look for methods
- * IJavaSearchConstants.CONSTRUCTOR
: look for constructors
- * IJavaSearchConstants.PACKAGE
: look for packages
+ * - {@link IJavaSearchConstants#CLASS}: only look for classes
+ * - {@link IJavaSearchConstants#INTERFACE}: only look for interfaces
+ * - {@link IJavaSearchConstants#TYPE}: look for both classes and interfaces
+ * - {@link IJavaSearchConstants#FIELD}: look for fields
+ * - {@link IJavaSearchConstants#METHOD}: look for methods
+ * - {@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors
+ * - {@link IJavaSearchConstants#PACKAGE}: look for packages
*
* @param limitTo determines the nature of the expected matches
*
- * IJavaSearchConstants.DECLARATIONS
: will search declarations matching with the corresponding
+ * - {@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.
*
- * IJavaSearchConstants.REFERENCES
: will search references to the given element.
+ * - {@link IJavaSearchConstants#REFERENCES}: will search references to the given element.
*
- * IJavaSearchConstants.ALL_OCCURRENCES
: will search for either declarations or references as specified
+ * - {@link IJavaSearchConstants#ALL_OCCURRENCES}: will search for either declarations or references as specified
* above.
*
- * IJavaSearchConstants.IMPLEMENTORS
: for interface, will find all types which implements a given interface.
+ * - {@link IJavaSearchConstants#IMPLEMENTORS}: for interface, will find all types which implements a given interface.
*
*
* @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
*
- * IJavaSearchConstants.DECLARATIONS
: will search declarations matching with the corresponding
+ * - {@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.
*
- * IJavaSearchConstants.REFERENCES
: will search references to the given element.
+ * - {@link IJavaSearchConstants#REFERENCES}: will search references to the given element.
*
- * IJavaSearchConstants.ALL_OCCURRENCES
: will search for either declarations or references as specified
+ * - {@link IJavaSearchConstants#ALL_OCCURRENCES}: will search for either declarations or references as specified
* above.
*
- * IJavaSearchConstants.IMPLEMENTORS
: for interface, will find all types which implements a given interface.
+ * - {@link IJavaSearchConstants#IMPLEMENTORS}: for interface, will find all types which implements a given interface.
*
* @return a search pattern for a Java element or null
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 IJavaSearchConstants
for valid values
+ * Look into {@link IJavaSearchConstants} for valid values
* @param limitTo one of the following values:
*
- * IJavaSearchConstants.DECLARATIONS
: search
+ * - {@link IJavaSearchConstants#DECLARATIONS}: search
* for declarations only
- * IJavaSearchConstants.REFERENCES
: search
+ * - {@link IJavaSearchConstants#REFERENCES}: search
* for all references
- * IJavaSearchConstants.ALL_OCCURENCES
: search
+ * - {@link IJavaSearchConstants#ALL_OCCURRENCES}: search
* for both declarations and all references
- * IJavaSearchConstants.IMPLEMENTORS
: search for
+ * - {@link IJavaSearchConstants#IMPLEMENTORS}: search for
* all implementors of an interface; the value is only valid if
* the Java element represents an interface
*
@@ -459,13 +459,13 @@
* @param element the Java element to be searched for
* @param limitTo one of the following values:
*
- * IJavaSearchConstants.DECLARATIONS
: search
+ * - {@link IJavaSearchConstants#DECLARATIONS}: search
* for declarations only
- * IJavaSearchConstants.REFERENCES
: search
+ * - {@link IJavaSearchConstants#REFERENCES}: search
* for all references
- * IJavaSearchConstants.ALL_OCCURENCES
: search
+ * - {@link IJavaSearchConstants#ALL_OCCURRENCES}: search
* for both declarations and all references
- * IJavaSearchConstants.IMPLEMENTORS
: search for
+ * - {@link IJavaSearchConstants#IMPLEMENTORS}: search for
* all implementors of an interface; the value is only valid if
* the Java element represents an interface
*
@@ -544,29 +544,33 @@
* for this type, or a wild-carded string for this type.
* @param matchRule one of
*
- * SearchPattern.R_EXACT_MATCH
if the package name and type name are the full names
+ * - {@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
* of the searched types.
- * SearchPattern.R_PREFIX_MATCH
if the package name and type name are prefixes of the names
+ * - {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
* of the searched types.
- * SearchPattern.R_PATTERN_MATCH
if the package name and type name contain wild-cards.
- *
- * combined with SearchPattern.R_CASE_SENSITIVE
,
- * e.g. R_EXACT_MATCH | R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
- * or R_PREFIX_MATCH
if a prefix non case sensitive match is requested.
- * @param searchFor one of
- *
- * IJavaSearchConstants.CLASS
if searching for classes only
- * IJavaSearchConstants.INTERFACE
if searching for interfaces only
- * IJavaSearchConstants.TYPE
if searching for both classes and interfaces
+ * - {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
*
+ * 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
+ *
+ * - {@link IJavaSearchConstants#CLASS}: only look for classes
+ * - {@link IJavaSearchConstants#INTERFACE}: only look for interfaces
+ * - {@link IJavaSearchConstants#ENUM}: only look for enumeration
+ * - {@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type
+ * - {@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations
+ * - {@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces
+ * - {@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)
+ *
* @param scope the scope to search in
* @param nameRequestor the requestor that collects the results of the search
* @param waitingPolicy one of
*
- * IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediately
- * IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
+ * - {@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately
+ * - {@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
* underlying indexer has not finished indexing the workspace
- * IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
+ * - {@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
* underlying indexer to finish indexing the workspace
*
* @param progressMonitor the progress monitor to report progress to, or null
if no progress
@@ -601,10 +605,10 @@
* @param nameRequestor the requestor that collects the results of the search
* @param waitingPolicy one of
*
- * IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediately
- * IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
+ * - {@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately
+ * - {@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
* underlying indexer has not finished indexing the workspace
- * IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
+ * - {@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
* underlying indexer to finish indexing the workspace
*
* @param progressMonitor the progress monitor to report progress to, or null
if no progress
@@ -647,29 +651,29 @@
* for this type, or a wild-carded string for this type.
* @param matchRule one of
*
- * SearchPattern.R_EXACT_MATCH
if the package name and type name are the full names
+ * - {@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
* of the searched types.
- * SearchPattern.R_PREFIX_MATCH
if the package name and type name are prefixes of the names
+ * - {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
* of the searched types.
- * SearchPattern.R_PATTERN_MATCH
if the package name and type name contain wild-cards.
+ * - {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
*
- * combined with SearchPattern.R_CASE_SENSITIVE
,
- * e.g. R_EXACT_MATCH | R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
- * or R_PREFIX_MATCH
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
*
- * IJavaSearchConstants.CLASS
if searching for classes only
- * IJavaSearchConstants.INTERFACE
if searching for interfaces only
- * IJavaSearchConstants.TYPE
if searching for both classes and interfaces
+ * - {@link IJavaSearchConstants#CLASS} if searching for classes only
+ * - {@link IJavaSearchConstants#INTERFACE} if searching for interfaces only
+ * - {@link IJavaSearchConstants#TYPE} if searching for both classes and interfaces
*
* @param scope the scope to search in
* @param nameRequestor the requestor that collects the results of the search
* @param waitingPolicy one of
*
- * IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediately
- * IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
+ * - {@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately
+ * - {@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
* underlying indexer has not finished indexing the workspace
- * IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
+ * - {@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
* underlying indexer to finish indexing the workspace
*
* @param progressMonitor the progress monitor to report progress to, or null
if no progress
@@ -707,27 +711,27 @@
* for this type, or a wild-carded string for this type.
* @param matchMode one of
*
- * IJavaSearchConstants.EXACT_MATCH
if the package name and type name are the full names
+ * - {@link IJavaSearchConstants#EXACT_MATCH} if the package name and type name are the full names
* of the searched types.
- * IJavaSearchConstants.PREFIX_MATCH
if the package name and type name are prefixes of the names
+ * - {@link IJavaSearchConstants#PREFIX_MATCH} if the package name and type name are prefixes of the names
* of the searched types.
- * IJavaSearchConstants.PATTERN_MATCH
if the package name and type name contain wild-cards.
+ * - {@link IJavaSearchConstants#PATTERN_MATCH} if the package name and type name contain wild-cards.
*
* @param isCaseSensitive whether the search should be case sensitive
* @param searchFor one of
*
- * IJavaSearchConstants.CLASS
if searching for classes only
- * IJavaSearchConstants.INTERFACE
if searching for interfaces only
- * IJavaSearchConstants.TYPE
if searching for both classes and interfaces
+ * - {@link IJavaSearchConstants#CLASS} if searching for classes only
+ * - {@link IJavaSearchConstants#INTERFACE} if searching for interfaces only
+ * - {@link IJavaSearchConstants#TYPE} if searching for both classes and interfaces
*
* @param scope the scope to search in
* @param nameRequestor the requestor that collects the results of the search
* @param waitingPolicy one of
*
- * IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediately
- * IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
+ * - {@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately
+ * - {@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
* underlying indexer has not finished indexing the workspace
- * IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
+ * - {@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
* underlying indexer to finish indexing the workspace
*
* @param progressMonitor the progress monitor to report progress to, or null
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 @@
* <Exception>Sample(Exception)
*
* 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 @@
*
* - {@link IJavaSearchConstants#CLASS}: only look for classes
* - {@link IJavaSearchConstants#INTERFACE}: only look for interfaces
- * - {@link IJavaSearchConstants#TYPE}: look for both classes and interfaces
+ * - {@link IJavaSearchConstants#ENUM}: only look for enumeration
+ * - {@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type
+ * - {@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations
+ * - {@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces
+ * - {@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)
* - {@link IJavaSearchConstants#FIELD}: look for fields
* - {@link IJavaSearchConstants#METHOD}: look for methods
* - {@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors
@@ -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 SearchPattern.R_CASE_SENSITIVE
,
* e.g. R_EXACT_MATCH | R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
* or R_PREFIX_MATCH
if a prefix non case sensitive match is requested.
- * @param searchFor one of
- *
- * IJavaSearchConstants.CLASS
if searching for classes only
- * IJavaSearchConstants.INTERFACE
if searching for interfaces only
- * IJavaSearchConstants.TYPE
if searching for both classes and interfaces
- *
+ * @param searchFor determines the nature of the searched elements
+ *
+ * - {@link IJavaSearchConstants#CLASS}: only look for classes
+ * - {@link IJavaSearchConstants#INTERFACE}: only look for interfaces
+ * - {@link IJavaSearchConstants#ENUM}: only look for enumeration
+ * - {@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type
+ * - {@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations
+ * - {@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces
+ * - {@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)
+ *
* @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;