Example usage for org.eclipse.jdt.internal.core.search JavaSearchParticipant JavaSearchParticipant

List of usage examples for org.eclipse.jdt.internal.core.search JavaSearchParticipant JavaSearchParticipant

Introduction

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

Prototype

JavaSearchParticipant

Source Link

Usage

From source file:de.instantouch.model.search.SnakeTypeSearch.java

License:Open Source License

public ISnakeList<SnakeClassInfo<T>> findSnakeTypes(Class<T> snakeClass)
        throws JavaModelException, SnakeModelException {

    final ISnakeList<SnakeClassInfo<T>> allTypes = new SnakeList<SnakeClassInfo<T>>();

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    if (workspace == null) {
        throw new SnakeNotInitializedException("no workspace available");
    }/*from w  ww.j  a  v  a 2 s  . com*/

    JavaModelManager modelManager = JavaModelManager.getJavaModelManager();

    JavaWorkspaceScope workspaceScope = modelManager.getWorkspaceScope();

    SearchPattern snakePattern = SearchPattern.createPattern(snakeClass.getCanonicalName(),
            IJavaSearchConstants.CLASS, IJavaSearchConstants.IMPLEMENTORS, SearchPattern.R_EXACT_MATCH);

    SearchEngine searchEngine = new SearchEngine();

    SearchRequestor requestor = new SearchRequestor() {

        @Override
        public void acceptSearchMatch(SearchMatch match) throws CoreException {
            ;
            Object element = match.getElement();
            if (element instanceof BinaryType) {
                SnakeClassInfo<T> info = new SnakeClassInfo<T>();
                try {
                    info.createFrom((BinaryType) element);
                } catch (SnakeWrongTypeException e) {
                    SnakeLog.log(e);
                }
                allTypes.add(info);
            }

        }
    };

    SearchParticipant participants[] = { new JavaSearchParticipant() };

    try {
        searchEngine.search(snakePattern, participants, workspaceScope, requestor, null);
    } catch (CoreException e) {
        throw new SnakeModelException(e.getMessage());
    }

    return allTypes;

}

From source file:org.codehaus.groovy.eclipse.core.search.SyntheticAccessorSearchRequestor.java

License:Apache License

public void findSyntheticMatches(IJavaElement element, ISearchRequestor uiRequestor, IProgressMonitor monitor)
        throws CoreException {
    // findSyntheticMatches(element, IJavaSearchConstants.REFERENCES, new
    // SearchParticipant[] { new JavaSearchParticipant() },
    // SearchEngine.createJavaSearchScope(new IJavaElement[] { element }),
    // uiRequestor, monitor);
    findSyntheticMatches(element, IJavaSearchConstants.REFERENCES,
            new SearchParticipant[] { new JavaSearchParticipant() }, SearchEngine.createWorkspaceScope(),
            uiRequestor, monitor);//from  w w  w. ja  v a  2 s.com
}

From source file:org.codehaus.groovy.eclipse.search.SyntheticAccessorQueryParticipant.java

License:Apache License

private SearchParticipant[] getSearchParticipants() {
    return new SearchParticipant[] { new JavaSearchParticipant() };
}