Search in sources :

Example 1 with PatternQuerySpecification

use of org.eclipse.wst.jsdt.ui.search.PatternQuerySpecification in project webtools.sourceediting by eclipse.

the class JsQueryParticipant method search.

/**
 * @see org.eclipse.wst.jsdt.ui.search.IQueryParticipant#search(org.eclipse.wst.jsdt.ui.search.ISearchRequestor,
 *      org.eclipse.wst.jsdt.ui.search.QuerySpecification,
 *      org.eclipse.core.runtime.IProgressMonitor)
 */
public void search(ISearchRequestor requestor, QuerySpecification querySpecification, IProgressMonitor monitor) throws CoreException {
    // 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;
        IJavaScriptElement element = elementQuery.getElement();
        if (JsQueryParticipant.DEBUG) {
            // $NON-NLS-1$
            System.out.println("JSP Query Participant searching on ELEMENT: " + element);
        }
        SearchRequestor jspRequestor = new JsSearchRequestor(requestor);
        // pa_TODO need to adapt JavaSearchScope to a JSPSearchScope
        JsSearchSupport.getInstance().search(element, new JsSearchScope(), jspRequestor);
    } else if (querySpecification instanceof PatternQuerySpecification) {
        // pattern search (eg. from Java search page)
        PatternQuerySpecification patternQuery = (PatternQuerySpecification) querySpecification;
        String pattern = patternQuery.getPattern();
        if (JsQueryParticipant.DEBUG) {
            // $NON-NLS-1$
            System.out.println("JSP Query Participant searching on PATTERN: " + pattern);
        }
        SearchRequestor jspRequestor = new JsSearchRequestor(requestor);
        JsSearchSupport.getInstance().search(pattern, new JsSearchScope(), patternQuery.getSearchFor(), patternQuery.getLimitTo(), SearchPattern.R_PATTERN_MATCH, false, jspRequestor);
    }
}
Also used : SearchRequestor(org.eclipse.wst.jsdt.core.search.SearchRequestor) JsSearchRequestor(org.eclipse.wst.jsdt.web.ui.internal.java.search.JsSearchRequestor) ISearchRequestor(org.eclipse.wst.jsdt.ui.search.ISearchRequestor) JsSearchScope(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope) ElementQuerySpecification(org.eclipse.wst.jsdt.ui.search.ElementQuerySpecification) PatternQuerySpecification(org.eclipse.wst.jsdt.ui.search.PatternQuerySpecification) IJavaScriptElement(org.eclipse.wst.jsdt.core.IJavaScriptElement) JsSearchRequestor(org.eclipse.wst.jsdt.web.ui.internal.java.search.JsSearchRequestor)

Aggregations

IJavaScriptElement (org.eclipse.wst.jsdt.core.IJavaScriptElement)1 SearchRequestor (org.eclipse.wst.jsdt.core.search.SearchRequestor)1 ElementQuerySpecification (org.eclipse.wst.jsdt.ui.search.ElementQuerySpecification)1 ISearchRequestor (org.eclipse.wst.jsdt.ui.search.ISearchRequestor)1 PatternQuerySpecification (org.eclipse.wst.jsdt.ui.search.PatternQuerySpecification)1 JsSearchScope (org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope)1 JsSearchRequestor (org.eclipse.wst.jsdt.web.ui.internal.java.search.JsSearchRequestor)1