blob: 71541e9e295abc33ed9e02257bbc2f0d36dc23ae (
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
|
/*******************************************************************************
* Copyright (c) 2015 Red Hat Inc. 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:
* Red Hat - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.man.help;
import java.net.URL;
import java.nio.file.Paths;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.help.search.IHelpSearchIndex;
import org.eclipse.help.search.ISearchDocument;
import org.eclipse.help.search.SearchParticipant;
/**
* This {@link SearchParticipant} implementation adds only the title of the man
* page to the index.
* <p>
* It takes way too long to index fully the tens of thousands man pages that a
* user may have installed on their system, so for now we simply do not index
* whole man pages.
*/
public class SimpleSearchParticipant extends SearchParticipant {
@Override
public IStatus addDocument(IHelpSearchIndex index, String pluginId,
String path, URL url, String id, ISearchDocument doc) {
String file = Paths.get(path).getFileName().toString();
String manpage = file.substring(0, file.length() - 5);
doc.setTitle(manpage);
doc.setSummary(manpage);
doc.addContents(manpage);
return Status.OK_STATUS;
}
}
|