Example usage for org.eclipse.jdt.internal.core.search.matching MatchLocator setFocus

List of usage examples for org.eclipse.jdt.internal.core.search.matching MatchLocator setFocus

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.search.matching MatchLocator setFocus.

Prototype

public static void setFocus(SearchPattern pattern, IJavaElement focus) 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests.java

License:Open Source License

protected void search(String patternString, int searchFor, int limitTo, IJavaElement focus,
        IJavaSearchScope scope, SearchRequestor requestor) throws CoreException {
    int matchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
    if (patternString.indexOf('*') != -1 || patternString.indexOf('?') != -1)
        matchRule |= SearchPattern.R_PATTERN_MATCH;
    SearchPattern pattern = SearchPattern.createPattern(patternString, searchFor, limitTo, matchRule);
    // that's why we maintain this copy:
    MatchLocator.setFocus(pattern, focus);
    ///*from   w  w  w.j a  v a 2s  .co m*/
    assertNotNull("Pattern should not be null", pattern);
    new SearchEngine().search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() },
            scope, requestor, null);
}