Search in sources :

Example 6 with JavaSearchQuery

use of org.eclipse.jdt.internal.ui.search.JavaSearchQuery in project che by eclipse.

the class SearchTestHelper method runMethodRefQuery.

static JavaSearchQuery runMethodRefQuery(String methodName) {
    JavaSearchQuery query = new JavaSearchQuery(new PatternQuerySpecification(methodName, IJavaSearchConstants.METHOD, true, IJavaSearchConstants.REFERENCES, JavaSearchScopeFactory.getInstance().createWorkspaceScope(true), "workspace scope"));
    NewSearchUI.runQueryInForeground(null, query);
    return query;
}
Also used : JavaSearchQuery(org.eclipse.jdt.internal.ui.search.JavaSearchQuery) PatternQuerySpecification(org.eclipse.jdt.ui.search.PatternQuerySpecification)

Example 7 with JavaSearchQuery

use of org.eclipse.jdt.internal.ui.search.JavaSearchQuery in project che by eclipse.

the class SearchTestHelper method countMethodRefs.

static int countMethodRefs(String methodName) {
    JavaSearchQuery query = runMethodRefQuery(methodName);
    JavaSearchResult result = (JavaSearchResult) query.getSearchResult();
    return result.getMatchCount();
}
Also used : JavaSearchQuery(org.eclipse.jdt.internal.ui.search.JavaSearchQuery) JavaSearchResult(org.eclipse.jdt.internal.ui.search.JavaSearchResult)

Example 8 with JavaSearchQuery

use of org.eclipse.jdt.internal.ui.search.JavaSearchQuery in project che by eclipse.

the class SearchTestHelper method runTypeRefQuery.

static JavaSearchQuery runTypeRefQuery(String typeName) throws JavaModelException {
    IType type = getType(typeName);
    JavaSearchQuery query = new JavaSearchQuery(new ElementQuerySpecification(type, IJavaSearchConstants.REFERENCES, JavaSearchScopeFactory.getInstance().createWorkspaceScope(true), "workspace scope"));
    NewSearchUI.runQueryInForeground(null, query);
    return query;
}
Also used : JavaSearchQuery(org.eclipse.jdt.internal.ui.search.JavaSearchQuery) ElementQuerySpecification(org.eclipse.jdt.ui.search.ElementQuerySpecification) IType(org.eclipse.jdt.core.IType)

Aggregations

JavaSearchQuery (org.eclipse.jdt.internal.ui.search.JavaSearchQuery)8 JavaSearchResult (org.eclipse.jdt.internal.ui.search.JavaSearchResult)5 ElementQuerySpecification (org.eclipse.jdt.ui.search.ElementQuerySpecification)3 ISearchResult (org.eclipse.search.ui.ISearchResult)3 BaseTest (org.eclipse.che.plugin.java.server.che.BaseTest)2 IJavaProject (org.eclipse.jdt.core.IJavaProject)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Region (org.eclipse.che.ide.ext.java.shared.dto.Region)1 JavaProject (org.eclipse.che.ide.ext.java.shared.dto.model.JavaProject)1 FindUsagesResponse (org.eclipse.che.ide.ext.java.shared.dto.search.FindUsagesResponse)1 Path (org.eclipse.core.runtime.Path)1 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)1 IJavaElement (org.eclipse.jdt.core.IJavaElement)1 IMember (org.eclipse.jdt.core.IMember)1 IMethod (org.eclipse.jdt.core.IMethod)1 IPackageDeclaration (org.eclipse.jdt.core.IPackageDeclaration)1 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)1