Java Code Examples for org.eclipse.jdt.core.search.IJavaSearchConstants#ALL_OCCURRENCES
The following examples show how to use
org.eclipse.jdt.core.search.IJavaSearchConstants#ALL_OCCURRENCES .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaMatchFilter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@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; }
Example 2
Source File: QueryParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private boolean isHandled(QuerySpecification query) { switch (query.getLimitTo()) { case IJavaSearchConstants.REFERENCES: case IJavaSearchConstants.ALL_OCCURRENCES: { break; } default: { return false; } } if (query instanceof ElementQuerySpecification) { IJavaElement element = ((ElementQuerySpecification) query).getElement(); return element.getElementType() == IJavaElement.TYPE || element.getElementType() == IJavaElement.FIELD || element.getElementType() == IJavaElement.METHOD; } // if (query instanceof PatternQuerySpecification) { // PatternQuerySpecification patternQuery = (PatternQuerySpecification) query; // switch (patternQuery.getSearchFor()) { // case IJavaSearchConstants.UNKNOWN: // case IJavaSearchConstants.TYPE: // case IJavaSearchConstants.CLASS: // case IJavaSearchConstants.CLASS_AND_INTERFACE: // case IJavaSearchConstants.CLASS_AND_ENUM: { // return true; // } // } // } return false; }
Example 3
Source File: VariablePattern.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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); }
Example 4
Source File: JavaQueryParticipant.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
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); } }
Example 5
Source File: MethodPattern.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
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(); }
Example 6
Source File: ConstructorPattern.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
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(); }