KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > search > federated > FederatedSearchJob


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.search.federated;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.core.runtime.jobs.Job;
15
16 /**
17  * A federated search job.
18  */

19 public class FederatedSearchJob extends Job {
20     public static final String JavaDoc FAMILY = "org.eclipse.help.base.searchEngine"; //$NON-NLS-1$
21
private String JavaDoc expression;
22     private FederatedSearchEntry entry;
23
24     /**
25      * @param name
26      */

27     public FederatedSearchJob(String JavaDoc expression, FederatedSearchEntry entry) {
28         super(entry.getEngineName());
29         this.expression = expression;
30         this.entry = entry;
31     }
32     
33     /* (non-Javadoc)
34      * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
35      */

36     protected IStatus run(IProgressMonitor monitor) {
37         try {
38             entry.getEngine().run(expression, entry.getScope(), entry.getResultCollector(), monitor);
39             return Status.OK_STATUS;
40         }
41         catch (CoreException e) {
42             return e.getStatus();
43         }
44     }
45     public boolean belongsTo(Object JavaDoc family) {
46         return family.equals(FAMILY);
47     }
48 }
49
Popular Tags