本文整理汇总了Java中org.eclipse.jdt.core.search.IJavaSearchConstants.METHOD属性的典型用法代码示例。如果您正苦于以下问题:Java IJavaSearchConstants.METHOD属性的具体用法?Java IJavaSearchConstants.METHOD怎么用?Java IJavaSearchConstants.METHOD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.search.IJavaSearchConstants
的用法示例。
在下文中一共展示了IJavaSearchConstants.METHOD属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: findMatches
private Set<IIndexedJavaRef> findMatches(PatternQuerySpecification query) {
// Translate the IJavaSearchConstant element type constants to IJavaElement
// type constants.
int elementType;
switch (query.getSearchFor()) {
case IJavaSearchConstants.TYPE:
elementType = IJavaElement.TYPE;
break;
case IJavaSearchConstants.FIELD:
elementType = IJavaElement.FIELD;
break;
case IJavaSearchConstants.METHOD:
case IJavaSearchConstants.CONSTRUCTOR:
// IJavaElement.METHOD represents both methods & ctors
elementType = IJavaElement.METHOD;
break;
default:
// We only support searching for types, fields, methods, and ctors
return Collections.emptySet();
}
return JavaRefIndex.getInstance().findElementReferences(query.getPattern(),
elementType, query.isCaseSensitive());
}
示例3: 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;
}
示例4: createMethodFieldMatchLocationsControls
private void createMethodFieldMatchLocationsControls(Composite contents) {
Composite composite= new Composite(contents, SWT.NONE);
GridData gd= new GridData(SWT.LEFT, SWT.BEGINNING, true, true, 2, 1);
gd.minimumWidth= convertHorizontalDLUsToPixels(200);
composite.setLayoutData(gd);
GridLayout blayout= new GridLayout(1, false);
blayout.marginWidth= 0;
blayout.marginHeight= 0;
composite.setLayout(blayout);
if (fSearchFor == IJavaSearchConstants.METHOD || fSearchFor == IJavaSearchConstants.FIELD) {
createButton(composite, SearchMessages.MatchLocations_this_label, IJavaSearchConstants.THIS_REFERENCE);
createButton(composite, SearchMessages.MatchLocations_implicit_this_label, IJavaSearchConstants.IMPLICIT_THIS_REFERENCE);
createButton(composite, SearchMessages.MatchLocations_super_label, IJavaSearchConstants.SUPER_REFERENCE);
createButton(composite, SearchMessages.MatchLocations_qualified_label, IJavaSearchConstants.QUALIFIED_REFERENCE);
}
if (fSearchFor == IJavaSearchConstants.METHOD || fSearchFor == IJavaSearchConstants.CONSTRUCTOR) {
createButton(composite, SearchMessages.MatchLocations_method_reference_label, IJavaSearchConstants.METHOD_REFERENCE_EXPRESSION);
}
}
示例5: runMethodRefQuery
static JavaSearchQuery runMethodRefQuery(String methodName) {
JavaSearchQuery query =
new JavaSearchQuery(
new PatternQuerySpecification(
methodName,
IJavaSearchConstants.METHOD,
true,
IJavaSearchConstants.REFERENCES,
JavaSearchScopeFactory.getInstance().createWorkspaceScope(true),
"workspace scope"));
NewSearchUI.runQueryInForeground(null, query);
return query;
}
示例6: getTotalNumberOfSettings
public static int getTotalNumberOfSettings(int searchFor) {
if (searchFor == IJavaSearchConstants.TYPE) {
return 15;
} else if (searchFor == IJavaSearchConstants.CONSTRUCTOR) {
return 1;
} else if (searchFor == IJavaSearchConstants.METHOD) {
return 5;
} else if (searchFor == IJavaSearchConstants.FIELD) {
return 4;
}
return 0;
}
示例7: getTotalNumberOfSettings
public static int getTotalNumberOfSettings(int searchFor) {
if (searchFor == IJavaSearchConstants.TYPE) {
return 15;
} else if (searchFor == IJavaSearchConstants.CONSTRUCTOR) {
return 1;
} else if (searchFor == IJavaSearchConstants.METHOD) {
return 5;
} else if (searchFor == IJavaSearchConstants.FIELD) {
return 4;
}
return 0;
}
示例8: find
@Override
public void find() {
SearchEngine engine = new SearchEngine();
IJavaSearchScope workspaceScope = null;
if(getProject() != null) {
workspaceScope = SearchEngine.createJavaSearchScope(createSearchScope());
} else {
workspaceScope = SearchEngine.createWorkspaceScope();
}
int constructor = IJavaSearchConstants.METHOD;
if(isConstructor()) {
constructor = IJavaSearchConstants.CONSTRUCTOR;
}
if(null != getName() && !getName().isEmpty()) {
SearchPattern pattern = SearchPattern.createPattern(
getName(),
constructor,
IJavaSearchConstants.REFERENCES,
SearchPattern.R_EXACT_MATCH);
SearchParticipant[] participant = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
try {
engine.search(pattern, participant, workspaceScope, createSearchRequestor(), new NullProgressMonitor());
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例9: getTotalNumberOfSettings
public static int getTotalNumberOfSettings(int searchFor) {
if (searchFor == IJavaSearchConstants.TYPE) {
return 15;
} else if (searchFor == IJavaSearchConstants.METHOD || searchFor == IJavaSearchConstants.FIELD) {
return 4;
}
return 0;
}
示例10: getNumberOfSelectedSettings
public static int getNumberOfSelectedSettings(int locations, int searchFor) {
int count = 0;
if (searchFor == IJavaSearchConstants.TYPE) {
if (isSet(locations, IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.FIELD_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.RETURN_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.PARAMETER_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THROWS_CLAUSE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_VARIABLE_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.WILDCARD_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_ARGUMENT_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CAST_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CATCH_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE)) {
count++;
}
} else if (searchFor == IJavaSearchConstants.METHOD
|| searchFor == IJavaSearchConstants.FIELD) {
if (isSet(locations, IJavaSearchConstants.SUPER_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.QUALIFIED_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THIS_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.IMPLICIT_THIS_REFERENCE)) {
count++;
}
}
if (searchFor == IJavaSearchConstants.METHOD || searchFor == IJavaSearchConstants.CONSTRUCTOR) {
if (isSet(locations, IJavaSearchConstants.METHOD_REFERENCE_EXPRESSION)) {
count++;
}
}
return count;
}
示例11: getNumberOfSelectedSettings
public static int getNumberOfSelectedSettings(int locations, int searchFor) {
int count= 0;
if (searchFor == IJavaSearchConstants.TYPE) {
if (isSet(locations, IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.FIELD_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.RETURN_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.PARAMETER_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THROWS_CLAUSE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_VARIABLE_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.WILDCARD_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_ARGUMENT_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CAST_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CATCH_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE)) {
count++;
}
} else if (searchFor == IJavaSearchConstants.METHOD || searchFor == IJavaSearchConstants.FIELD) {
if (isSet(locations, IJavaSearchConstants.SUPER_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.QUALIFIED_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THIS_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.IMPLICIT_THIS_REFERENCE)) {
count++;
}
}
if (searchFor == IJavaSearchConstants.METHOD || searchFor == IJavaSearchConstants.CONSTRUCTOR) {
if (isSet(locations, IJavaSearchConstants.METHOD_REFERENCE_EXPRESSION)) {
count++;
}
}
return count;
}
示例12: getNumberOfSelectedSettings
public static int getNumberOfSelectedSettings(int locations, int searchFor) {
int count= 0;
if (searchFor == IJavaSearchConstants.TYPE) {
if (isSet(locations, IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.FIELD_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.RETURN_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.PARAMETER_DECLARATION_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THROWS_CLAUSE_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_VARIABLE_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.WILDCARD_BOUND_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.TYPE_ARGUMENT_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CAST_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CATCH_TYPE_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE)) {
count++;
}
} else if (searchFor == IJavaSearchConstants.METHOD || searchFor == IJavaSearchConstants.FIELD) {
if (isSet(locations, IJavaSearchConstants.SUPER_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.QUALIFIED_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.THIS_REFERENCE)) {
count++;
}
if (isSet(locations, IJavaSearchConstants.IMPLICIT_THIS_REFERENCE)) {
count++;
}
}
return count;
}