Search in sources :

Example 1 with UserSearchCompleteEvent

use of org.eclipse.ecf.presence.search.UserSearchCompleteEvent in project ecf by eclipse.

the class XMPPUserSearchManager method search.

/**
 * Specific implementation for XMPP
 *
 * @see IUserSearchManager#search(ICriteria, IUserSearchListener)
 */
public void search(final ICriteria criteria, final IUserSearchListener listener) {
    Assert.isNotNull(criteria);
    Assert.isNotNull(listener);
    Job job = new Job(Messages.XMPPUserSearchManager_JOB) {

        protected IStatus run(IProgressMonitor monitor) {
            try {
                ISearch search = search(criteria);
                UserSearchCompleteEvent complete = new UserSearchCompleteEvent(search);
                listener.handleUserSearchEvent(complete);
            } catch (UserSearchException e) {
                log(e.getLocalizedMessage(), e);
                return new Status(IStatus.ERROR, XmppPlugin.PLUGIN_ID, IStatus.ERROR, "Exception in user search", e);
            }
            return Status.OK_STATUS;
        }
    };
    job.schedule();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) UserSearchCompleteEvent(org.eclipse.ecf.presence.search.UserSearchCompleteEvent) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ISearch(org.eclipse.ecf.presence.search.ISearch) Job(org.eclipse.core.runtime.jobs.Job) UserSearchException(org.eclipse.ecf.presence.search.UserSearchException)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1 ISearch (org.eclipse.ecf.presence.search.ISearch)1 UserSearchCompleteEvent (org.eclipse.ecf.presence.search.UserSearchCompleteEvent)1 UserSearchException (org.eclipse.ecf.presence.search.UserSearchException)1