本文整理汇总了Java中org.eclipse.jdt.core.search.IJavaSearchConstants.ALL_OCCURRENCES属性的典型用法代码示例。如果您正苦于以下问题:Java IJavaSearchConstants.ALL_OCCURRENCES属性的具体用法?Java IJavaSearchConstants.ALL_OCCURRENCES怎么用?Java IJavaSearchConstants.ALL_OCCURRENCES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.search.IJavaSearchConstants
的用法示例。
在下文中一共展示了IJavaSearchConstants.ALL_OCCURRENCES属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isApplicable
@Override
public boolean isApplicable(JavaSearchQuery query) {
QuerySpecification spec = query.getSpecification();
switch (spec.getLimitTo()) {
case IJavaSearchConstants.REFERENCES:
case IJavaSearchConstants.ALL_OCCURRENCES:
if (spec instanceof ElementQuerySpecification) {
ElementQuerySpecification elementSpec = (ElementQuerySpecification) spec;
return elementSpec.getElement() instanceof IMethod;
} else if (spec instanceof PatternQuerySpecification) {
PatternQuerySpecification patternSpec = (PatternQuerySpecification) spec;
return patternSpec.getSearchFor() == IJavaSearchConstants.METHOD;
}
}
return false;
}
示例2: isApplicable
@Override
public boolean isApplicable(JavaSearchQuery query) {
QuerySpecification spec= query.getSpecification();
switch (spec.getLimitTo()) {
case IJavaSearchConstants.REFERENCES:
case IJavaSearchConstants.ALL_OCCURRENCES:
if (spec instanceof ElementQuerySpecification) {
ElementQuerySpecification elementSpec= (ElementQuerySpecification) spec;
return elementSpec.getElement() instanceof IMethod;
} else if (spec instanceof PatternQuerySpecification) {
PatternQuerySpecification patternSpec= (PatternQuerySpecification) spec;
return patternSpec.getSearchFor() == IJavaSearchConstants.METHOD;
}
}
return false;
}
示例3: VariablePattern
public VariablePattern(int patternKind, char[] name, int limitTo, int matchRule) {
super(patternKind, matchRule);
this.fineGrain = limitTo & FINE_GRAIN_MASK;
if (this.fineGrain == 0) {
switch (limitTo & 0xF) {
case IJavaSearchConstants.DECLARATIONS :
this.findDeclarations = true;
break;
case IJavaSearchConstants.REFERENCES :
this.readAccess = true;
this.writeAccess = true;
break;
case IJavaSearchConstants.READ_ACCESSES :
this.readAccess = true;
break;
case IJavaSearchConstants.WRITE_ACCESSES :
this.writeAccess = true;
break;
case IJavaSearchConstants.ALL_OCCURRENCES :
this.findDeclarations = true;
this.readAccess = true;
this.writeAccess = true;
break;
}
this.findReferences = this.readAccess || this.writeAccess;
}
this.name = (this.isCaseSensitive || this.isCamelCase) ? name : CharOperation.toLowerCase(name);
}
示例4: search
public void search(ISearchRequestor requestor, QuerySpecification query,
IProgressMonitor monitor) throws CoreException {
try {
monitor.subTask("Locating GWT matches...");
// Make sure we're searching for Java references
switch (query.getLimitTo()) {
case IJavaSearchConstants.REFERENCES:
case IJavaSearchConstants.ALL_OCCURRENCES:
// These we handle as expected
break;
case IJavaSearchConstants.READ_ACCESSES:
case IJavaSearchConstants.WRITE_ACCESSES:
// We don't actually check field references to see if they're read or
// write accesses; we just treat this as a generic references search
break;
default:
// Anything else (e.g., Declarations), we don't support
return;
}
Set<IIndexedJavaRef> matchingJavaRefs = null;
// Find all matching Java references in the index. The search algorithm
// differs depending on whether we're doing an element query
// (Ctrl-Shift-G) or a pattern query (Java Search dialog box)
if (query instanceof ElementQuerySpecification) {
ElementQuerySpecification elementQuery = (ElementQuerySpecification) query;
matchingJavaRefs = findMatches(elementQuery, true);
} else {
assert (query instanceof PatternQuerySpecification);
PatternQuerySpecification patternQuery = (PatternQuerySpecification) query;
matchingJavaRefs = findMatches(patternQuery);
}
for (IIndexedJavaRef javaRef : matchingJavaRefs) {
Match match = createMatch(javaRef, query);
if (match != null) {
// Report the match location to the Java Search engine
requestor.reportMatch(match);
}
}
} catch (Exception e) {
// If we allow any exceptions to escape, the JDT will disable us
GWTPluginLog.logError("Error finding Java Search matches", e);
}
}
示例5: MethodPattern
public MethodPattern(
char[] selector,
char[] declaringQualification,
char[] declaringSimpleName,
char[] returnQualification,
char[] returnSimpleName,
char[][] parameterQualifications,
char[][] parameterSimpleNames,
IType declaringType,
int limitTo,
int matchRule) {
this(matchRule);
this.fineGrain = limitTo & FINE_GRAIN_MASK;
if (this.fineGrain == 0) {
switch (limitTo & 0xF) {
case IJavaSearchConstants.DECLARATIONS :
this.findReferences = false;
break;
case IJavaSearchConstants.REFERENCES :
this.findDeclarations = false;
break;
case IJavaSearchConstants.ALL_OCCURRENCES :
break;
}
} else {
this.findDeclarations = false;
}
this.selector = (this.isCaseSensitive || this.isCamelCase) ? selector : CharOperation.toLowerCase(selector);
this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
this.declaringSimpleName = this.isCaseSensitive ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
this.returnQualification = this.isCaseSensitive ? returnQualification : CharOperation.toLowerCase(returnQualification);
this.returnSimpleName = this.isCaseSensitive ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName);
if (parameterSimpleNames != null) {
this.parameterCount = parameterSimpleNames.length;
this.parameterQualifications = new char[this.parameterCount][];
this.parameterSimpleNames = new char[this.parameterCount][];
for (int i = 0; i < this.parameterCount; i++) {
this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]);
this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]);
}
} else {
this.parameterCount = -1;
}
this.declaringType = declaringType;
if (this.declaringType != null) {
this.declaringPackageName = this.declaringType.getPackageFragment().getElementName().toCharArray();
}
this.mustResolve = mustResolve();
}
示例6: ConstructorPattern
public ConstructorPattern(
char[] declaringSimpleName,
char[] declaringQualification,
char[][] parameterQualifications,
char[][] parameterSimpleNames,
int limitTo,
int matchRule) {
this(matchRule);
this.fineGrain = limitTo & FINE_GRAIN_MASK;
if (this.fineGrain == 0) {
switch (limitTo) {
case IJavaSearchConstants.DECLARATIONS :
this.findReferences = false;
break;
case IJavaSearchConstants.REFERENCES :
this.findDeclarations = false;
break;
case IJavaSearchConstants.ALL_OCCURRENCES :
break;
}
} else {
this.findDeclarations = false;
}
this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
this.declaringSimpleName = (this.isCaseSensitive || this.isCamelCase) ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
if (parameterSimpleNames != null) {
this.parameterCount = parameterSimpleNames.length;
boolean synthetic = this.parameterCount>0 && declaringQualification != null && CharOperation.equals(CharOperation.concat(parameterQualifications[0], parameterSimpleNames[0], '.'), declaringQualification);
int offset = 0;
if (synthetic) {
// skip first synthetic parameter
this.parameterCount--;
offset++;
}
this.parameterQualifications = new char[this.parameterCount][];
this.parameterSimpleNames = new char[this.parameterCount][];
for (int i = 0; i < this.parameterCount; i++) {
this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i+offset] : CharOperation.toLowerCase(parameterQualifications[i+offset]);
this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i+offset] : CharOperation.toLowerCase(parameterSimpleNames[i+offset]);
}
} else {
this.parameterCount = -1;
}
this.mustResolve = mustResolve();
}