KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 import org.eclipse.help.internal.base.*;
16 import org.eclipse.help.internal.base.BaseHelpSystem;
17 import org.eclipse.help.internal.search.SearchIndexWithIndexingProgress;
18
19 public class IndexerJob extends Job {
20     public static final String JavaDoc FAMILY = "org.eclipse.help.base.indexer"; //$NON-NLS-1$
21
public IndexerJob() {
22         super(HelpBaseResources.IndexerJob_name);
23     }
24     protected IStatus run(IProgressMonitor monitor) {
25         SearchIndexWithIndexingProgress index = BaseHelpSystem.getLocalSearchManager().getIndex(Platform.getNL());
26         try {
27             BaseHelpSystem.getLocalSearchManager().ensureIndexUpdated(monitor, index);
28             return Status.OK_STATUS;
29         }
30         catch (OperationCanceledException e) {
31             return Status.CANCEL_STATUS;
32         }
33         catch (Exception JavaDoc e) {
34             return new Status(IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, IStatus.OK, HelpBaseResources.IndexerJob_error, e);
35         }
36     }
37     public boolean belongsTo(Object JavaDoc family) {
38         return FAMILY.equals(family);
39     }
40 }
41
Popular Tags