blob: d29e35fccf8dc0bf2b9049385c040e38f49287c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.search;
/**
* Adapts a LuceneSearchParticipant to SearchParticipant. This allows
* the deprecated extension point org.eclipse.help.base.luceneSearchParticipants
* to continue to function even though the rest of the help system has
* switched to use the class SearchParticipant instead of LuceneSearchParticipant
*/
import java.net.URL;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.help.search.IHelpSearchIndex;
import org.eclipse.help.search.ISearchDocument;
import org.eclipse.help.search.LuceneSearchParticipant;
import org.eclipse.help.search.SearchParticipant;
public class LuceneSearchParticipantAdapter extends SearchParticipant {
private LuceneSearchParticipant searchParticipant;
public LuceneSearchParticipantAdapter(LuceneSearchParticipant participant) {
this.searchParticipant = participant;
}
public IStatus addDocument(IHelpSearchIndex index, String pluginId, String name, URL url, String id,
ISearchDocument doc) {
// In the help system the only class that implements ISearchDocument is LuceneSearchDocument
// and the only class that implements IHelpSearchIndex is SearchIndex
LuceneSearchDocument luceneDoc = (LuceneSearchDocument)doc;
SearchIndex searchIndex = (SearchIndex) index;
return searchParticipant.addDocument(searchIndex, pluginId, name, url, id, luceneDoc.getDocument());
}
public Set getAllDocuments(String locale) {
return searchParticipant.getAllDocuments(locale);
}
public void clear() {
searchParticipant.clear();
}
public boolean equals(Object obj) {
return searchParticipant.equals(obj);
}
public Set getContributingPlugins() {
return searchParticipant.getContributingPlugins();
}
public int hashCode() {
return searchParticipant.hashCode();
}
public boolean open(String id) {
return searchParticipant.open(id);
}
}
|