Search in sources :

Example 1 with JSPSearchRequestor

use of org.eclipse.jst.jsp.ui.internal.java.search.JSPSearchRequestor in project webtools.sourceediting by eclipse.

the class JSPQueryParticipant method search.

/**
 * @see org.eclipse.jdt.ui.search.IQueryParticipant#search(org.eclipse.jdt.ui.search.ISearchRequestor, org.eclipse.jdt.ui.search.QuerySpecification, org.eclipse.core.runtime.IProgressMonitor)
 */
public void search(ISearchRequestor requestor, QuerySpecification querySpecification, IProgressMonitor monitor) throws CoreException {
    if (shouldSupplyJSPSearchResultsToJavaSearch()) {
        // do search based on the particular Java query
        if (querySpecification instanceof ElementQuerySpecification) {
            // element search (eg. from global find references in Java file)
            ElementQuerySpecification elementQuery = (ElementQuerySpecification) querySpecification;
            IJavaElement element = elementQuery.getElement();
            if (DEBUG)
                // $NON-NLS-1$
                System.out.println("JSP Query Participant searching on ELEMENT: " + element);
            SearchRequestor jspRequestor = new JSPSearchRequestor(requestor);
            // pa_TODO need to adapt JavaSearchScope to a JSPSearchScope
            JSPSearchSupport.getInstance().search(element, new JSPSearchScope(), jspRequestor, monitor);
        } else if (querySpecification instanceof PatternQuerySpecification) {
            // pattern search (eg. from Java search page)
            PatternQuerySpecification patternQuery = (PatternQuerySpecification) querySpecification;
            String pattern = patternQuery.getPattern();
            if (DEBUG)
                // $NON-NLS-1$
                System.out.println("JSP Query Participant searching on PATTERN: " + pattern);
            SearchRequestor jspRequestor = new JSPSearchRequestor(requestor);
            JSPSearchSupport.getInstance().search(pattern, new JSPSearchScope(), patternQuery.getSearchFor(), patternQuery.getLimitTo(), SearchPattern.R_PATTERN_MATCH, false, jspRequestor, monitor);
        }
    }
}
Also used : SearchRequestor(org.eclipse.jdt.core.search.SearchRequestor) ISearchRequestor(org.eclipse.jdt.ui.search.ISearchRequestor) JSPSearchRequestor(org.eclipse.jst.jsp.ui.internal.java.search.JSPSearchRequestor) IJavaElement(org.eclipse.jdt.core.IJavaElement) ElementQuerySpecification(org.eclipse.jdt.ui.search.ElementQuerySpecification) PatternQuerySpecification(org.eclipse.jdt.ui.search.PatternQuerySpecification) JSPSearchScope(org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope) JSPSearchRequestor(org.eclipse.jst.jsp.ui.internal.java.search.JSPSearchRequestor)

Aggregations

IJavaElement (org.eclipse.jdt.core.IJavaElement)1 SearchRequestor (org.eclipse.jdt.core.search.SearchRequestor)1 ElementQuerySpecification (org.eclipse.jdt.ui.search.ElementQuerySpecification)1 ISearchRequestor (org.eclipse.jdt.ui.search.ISearchRequestor)1 PatternQuerySpecification (org.eclipse.jdt.ui.search.PatternQuerySpecification)1 JSPSearchScope (org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope)1 JSPSearchRequestor (org.eclipse.jst.jsp.ui.internal.java.search.JSPSearchRequestor)1