本文整理汇总了Java中org.eclipse.jdt.core.search.IJavaSearchConstants.REFERENCES属性的典型用法代码示例。如果您正苦于以下问题:Java IJavaSearchConstants.REFERENCES属性的具体用法?Java IJavaSearchConstants.REFERENCES怎么用?Java IJavaSearchConstants.REFERENCES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.search.IJavaSearchConstants
的用法示例。
在下文中一共展示了IJavaSearchConstants.REFERENCES属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SelectFieldModeAction
public SelectFieldModeAction(CallHierarchyViewPart v, int mode) {
super(null, AS_RADIO_BUTTON);
if (mode == IJavaSearchConstants.REFERENCES) {
setText(CallHierarchyMessages.SelectFieldModeAction_all_references_label);
setDescription(CallHierarchyMessages.SelectFieldModeAction_all_references_description);
} else if (mode == IJavaSearchConstants.READ_ACCESSES) {
setText(CallHierarchyMessages.SelectFieldModeAction_read_accesses_label);
setDescription(CallHierarchyMessages.SelectFieldModeAction_read_accesses_description);
} else if (mode == IJavaSearchConstants.WRITE_ACCESSES) {
setText(CallHierarchyMessages.SelectFieldModeAction_write_accesses_label);
setDescription(CallHierarchyMessages.SelectFieldModeAction_write_accesses_description);
} else {
Assert.isTrue(false);
}
fView= v;
fMode= mode;
// FIXME(stephan) adjust/create new help context
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_TOGGLE_CALL_MODE_ACTION);
}
示例3: initFieldMode
private void initFieldMode() {
int mode;
try {
mode = fDialogSettings.getInt(DIALOGSTORE_FIELD_MODE);
switch (mode) {
case IJavaSearchConstants.REFERENCES:
case IJavaSearchConstants.READ_ACCESSES:
case IJavaSearchConstants.WRITE_ACCESSES:
break; // OK
default:
mode = IJavaSearchConstants.REFERENCES;
}
} catch (NumberFormatException e) {
mode = IJavaSearchConstants.REFERENCES;
}
// force the update
fCurrentFieldMode = -1;
// will fill the main tool bar
setFieldMode(mode);
}
示例4: 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;
}
示例5: runMethodRefQuery
static JavaSearchQuery runMethodRefQuery(
String TypeName, String methodName, String[] parameterTypes) throws JavaModelException {
IMethod method = getMethod(TypeName, methodName, parameterTypes);
JavaSearchQuery query =
new JavaSearchQuery(
new ElementQuerySpecification(
method,
IJavaSearchConstants.REFERENCES,
JavaSearchScopeFactory.getInstance().createWorkspaceScope(true),
"workspace scope"));
NewSearchUI.runQueryInForeground(null, query);
return query;
}
示例6: runTypeRefQuery
static JavaSearchQuery runTypeRefQuery(String typeName) throws JavaModelException {
IType type = getType(typeName);
JavaSearchQuery query =
new JavaSearchQuery(
new ElementQuerySpecification(
type,
IJavaSearchConstants.REFERENCES,
JavaSearchScopeFactory.getInstance().createWorkspaceScope(true),
"workspace scope"));
NewSearchUI.runQueryInForeground(null, query);
return query;
}
示例7: findWorkspaceReferences
public static Set<IIndexedJavaRef> findWorkspaceReferences(
IJavaElement element, boolean resolveMatches) {
JavaQueryParticipant searchEngine = new JavaQueryParticipant();
ElementQuerySpecification query = new ElementQuerySpecification(element,
IJavaSearchConstants.REFERENCES, WORKSPACE_SCOPE, "");
return searchEngine.findMatches(query, resolveMatches);
}
示例8: canHaveChildren
@Override
public boolean canHaveChildren() {
IMember member= getMember();
if (member instanceof IField) {
if (getLevel() == 1)
return true;
int mode= getFieldSearchMode();
return mode == IJavaSearchConstants.REFERENCES || mode == IJavaSearchConstants.READ_ACCESSES;
}
return member instanceof IMethod || member instanceof IType;
}
示例9: DeclarationOfReferencedMethodsPattern
public DeclarationOfReferencedMethodsPattern(IJavaElement enclosingElement) {
super(null, null, null, null, null, null, null, null, IJavaSearchConstants.REFERENCES, R_PATTERN_MATCH);
this.enclosingElement = enclosingElement;
this.knownMethods = new SimpleSet();
this.mustResolve = true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:7,代码来源:DeclarationOfReferencedMethodsPattern.java
示例10: getFieldSearchMode
public int getFieldSearchMode() {
if (fFieldSearchMode != 0)
return fFieldSearchMode;
MethodWrapper parent= getParent();
while (parent != null) {
if (parent.fFieldSearchMode != 0)
return parent.fFieldSearchMode;
else
parent= parent.getParent();
}
return IJavaSearchConstants.REFERENCES;
}
示例11: DeclarationOfAccessedFieldsPattern
public DeclarationOfAccessedFieldsPattern(IJavaElement enclosingElement) {
super(null, null, null, null, null, IJavaSearchConstants.REFERENCES, R_PATTERN_MATCH);
this.enclosingElement = enclosingElement;
this.knownFields = new SimpleSet();
this.mustResolve = true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:DeclarationOfAccessedFieldsPattern.java
示例12: 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);
}
示例13: createQuery
private static QuerySpecification createQuery(IJavaElement element) {
return new ElementQuerySpecification(element,
IJavaSearchConstants.REFERENCES, WORKSPACE_SCOPE, "");
}
示例14: testPatternSearch
public void testPatternSearch() throws CoreException {
Match[] expected;
// Search for type references by simple name
expected = new Match[] {
createWindowsTestMatch(840, 50), createWindowsTestMatch(1207, 50),
createWindowsTestMatch(1419, 50)};
assertSearchMatches(expected, createQuery("InnerSub",
IJavaSearchConstants.TYPE));
// Search for type with different casing
expected = new Match[] {
createWindowsTestMatch(840, 50), createWindowsTestMatch(1207, 50),
createWindowsTestMatch(1419, 50)};
assertSearchMatches(expected, createQuery("innersub",
IJavaSearchConstants.TYPE));
// Search for type with different casing with case-sensitive enabled
QuerySpecification query = new PatternQuerySpecification("innersub",
IJavaSearchConstants.TYPE, true, IJavaSearchConstants.REFERENCES,
WORKSPACE_SCOPE, "");
assertSearchMatches(NO_MATCHES, query);
// Search for field references
assertSearchMatch(createWindowsTestMatch(990, 5), createQuery("keith",
IJavaSearchConstants.FIELD));
// Search for method references using * wildcard
expected = new Match[] {
createWindowsTestMatch(1174, 5), createWindowsTestMatch(1259, 5),
createWindowsTestMatch(1340, 8)};
assertSearchMatches(expected, createQuery("sayH*",
IJavaSearchConstants.METHOD));
// Search for method references using ? wildcard
expected = new Match[] {
createWindowsTestMatch(1174, 5), createWindowsTestMatch(1259, 5)};
assertSearchMatches(expected, createQuery("sayH?",
IJavaSearchConstants.METHOD));
// Search for constructor references with qualified type name and parameters
assertSearchMatch(createWindowsTestMatch(892, 3), createQuery(
"com.hello.client.JavaQueryParticipantTest.InnerSub.InnerSub(String)",
IJavaSearchConstants.CONSTRUCTOR));
}
示例15: 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);
}
}