KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > ui > internal > search > LocalSearchScopeFactory


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.ui.internal.search;
12
13 import java.util.Dictionary JavaDoc;
14
15 import org.eclipse.help.internal.base.BaseHelpSystem;
16 import org.eclipse.help.internal.search.federated.LocalHelpScope;
17 import org.eclipse.help.internal.workingset.WorkingSet;
18 import org.eclipse.help.search.ISearchScope;
19 import org.eclipse.help.ui.ISearchScopeFactory;
20 import org.eclipse.jface.preference.IPreferenceStore;
21
22 /**
23  * Creates the scope for local search using the help working sets
24  */

25 public class LocalSearchScopeFactory implements ISearchScopeFactory {
26     public final static String JavaDoc P_WORKING_SET = "workingSet"; //$NON-NLS-1$
27
public final static String JavaDoc P_CAPABILITY_FILTERING = "capabilityFiltering"; //$NON-NLS-1$
28

29     /* (non-Javadoc)
30      * @see org.eclipse.help.ui.ISearchScopeFactory#createSearchScope(org.eclipse.jface.preference.IPreferenceStore)
31      */

32     public ISearchScope createSearchScope(IPreferenceStore store, String JavaDoc engineId, Dictionary JavaDoc parameters) {
33         String JavaDoc name = store.getString(engineId+"."+P_WORKING_SET); //$NON-NLS-1$
34
WorkingSet workingSet = null;
35         if (name != null)
36             workingSet = BaseHelpSystem.getWorkingSetManager().getWorkingSet(name);
37         boolean capabilityFiltering = store.getBoolean(engineId+"."+P_CAPABILITY_FILTERING); //$NON-NLS-1$
38
return new LocalHelpScope(workingSet, !capabilityFiltering);
39     }
40 }
41
Popular Tags