Search in sources :

Example 11 with JSPSearchScope

use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope in project webtools.sourceediting by eclipse.

the class JSPSearchTests method testSearchField.

public void testSearchField() {
    TestJspSearchRequestor requestor = new TestJspSearchRequestor();
    requestor.addCheckMatch("searchTestJSP.jsp", 93, 106);
    JSPSearchSupport.getInstance().search("searchForThis", new JSPSearchScope(), FIELD, ALL_OCCURRENCES, SearchPattern.R_EXACT_MATCH, true, requestor, new NullProgressMonitor());
    assertTrue("did not find all expected matches: searchForThis", requestor.checkValid());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) JSPSearchScope(org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope)

Example 12 with JSPSearchScope

use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope in project webtools.sourceediting by eclipse.

the class JSPSearchTests method testSearchProjectClasses.

public void testSearchProjectClasses() {
    TestJspSearchRequestor requestor = new TestJspSearchRequestor();
    requestor.addCheckMatch("searchTestJSP3.jsp", 148, 157);
    requestor.addCheckMatch("searchTestJSP3.jsp", 170, 179);
    requestor.addCheckMatch("searchTestJSP3.jsp", 263, 273);
    requestor.addCheckMatch("searchTestJSP3.jsp", 299, 309);
    requestor.addCheckMatch("searchTestJSP3.jsp", 408, 417);
    requestor.addCheckMatch("searchTestJSP3.jsp", 430, 439);
    JSPSearchSupport.getInstance().search("Jellybean*", new JSPSearchScope(), TYPE, ALL_OCCURRENCES, SearchPattern.R_PATTERN_MATCH, true, requestor, new NullProgressMonitor());
    assertTrue("did not find all expected matches: search*", requestor.checkValid());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) JSPSearchScope(org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope)

Example 13 with JSPSearchScope

use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope in project webtools.sourceediting by eclipse.

the class JSPSearchTests method testSearchLocalVariable.

public void testSearchLocalVariable() {
    IDOMModel xmlModel = null;
    try {
        IPath jspTestFilePath = new Path("judo/SEARCH/searchTestJSP3.jsp");
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(jspTestFilePath);
        xmlModel = (IDOMModel) getStructuredModelForRead(file);
        ModelHandlerForJSP.ensureTranslationAdapterFactory(xmlModel);
        IDOMDocument doc = xmlModel.getDocument();
        JSPTranslationAdapter adapter = (JSPTranslationAdapter) doc.getAdapterFor(IJSPTranslation.class);
        JSPTranslation translation = adapter.getJSPTranslation();
        IJavaElement element = translation.getElementsFromJspRange(377, 384)[0];
        TestJspSearchRequestor requestor = new TestJspSearchRequestor();
        requestor.addCheckMatch("searchTestJSP3.jsp", 377, 384);
        JSPSearchSupport.getInstance().search(element, new JSPSearchScope(), requestor, new NullProgressMonitor());
        assertTrue("did not find all expected matches: search*", requestor.checkValid());
    } finally {
        if (xmlModel != null)
            xmlModel.releaseFromRead();
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IJavaElement(org.eclipse.jdt.core.IJavaElement) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) IJSPTranslation(org.eclipse.jst.jsp.core.internal.java.IJSPTranslation) JSPTranslation(org.eclipse.jst.jsp.core.internal.java.JSPTranslation) IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) JSPSearchScope(org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope) IJSPTranslation(org.eclipse.jst.jsp.core.internal.java.IJSPTranslation) JSPTranslationAdapter(org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter)

Aggregations

JSPSearchScope (org.eclipse.jst.jsp.core.internal.java.search.JSPSearchScope)13 JSPSearchSupport (org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IJavaElement (org.eclipse.jdt.core.IJavaElement)2 Change (org.eclipse.ltk.core.refactoring.Change)2 CompositeChange (org.eclipse.ltk.core.refactoring.CompositeChange)2 TextChange (org.eclipse.ltk.core.refactoring.TextChange)2 IFile (org.eclipse.core.resources.IFile)1 IPath (org.eclipse.core.runtime.IPath)1 IStatus (org.eclipse.core.runtime.IStatus)1 Path (org.eclipse.core.runtime.Path)1 Status (org.eclipse.core.runtime.Status)1 SearchDocument (org.eclipse.jdt.core.search.SearchDocument)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 IJSPTranslation (org.eclipse.jst.jsp.core.internal.java.IJSPTranslation)1 JSPTranslation (org.eclipse.jst.jsp.core.internal.java.JSPTranslation)1 JSPTranslationAdapter (org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter)1