blob: efb3b97a343c1599a9ac5886fe6d0213ed4da2dc (
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
|
/*******************************************************************************
* Copyright (c) 2005, 2016 Intel 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:
* Intel Corporation - initial API and implementation
* IBM Corporation - 122967 [Help] Remote help system
* IBM Corporation - add support for see / see also
* IBM Corporation - add support for filtering of the index view
*******************************************************************************/
package org.eclipse.help.internal.index;
import java.util.Iterator;
import org.eclipse.help.IIndex;
import org.eclipse.help.IIndexEntry;
import org.eclipse.help.internal.UAElement;
import org.w3c.dom.Element;
public class Index extends UAElement implements IIndex {
public static final String NAME = "index"; //$NON-NLS-1$
public Index() {
super(NAME);
}
public Index(IIndex src) {
super(NAME, src);
appendChildren(src.getChildren());
}
public Index(Element src) {
super(src);
}
@Override
public IIndexEntry[] getEntries() {
return getChildren(IIndexEntry.class);
}
/**
* @param see A see element
* @return the entry with matching keyword or null
*/
public IndexEntry getSeeTarget(IndexSee see) {
if (children == null) getChildren();
String keyword = see.getKeyword();
for (Iterator<UAElement> iter = children.iterator(); iter.hasNext();) {
UAElement next = iter.next();
if (next instanceof IndexEntry && keyword.equals(((IndexEntry)next).getKeyword())) {
return (IndexEntry)next;
}
}
return null;
}
}
|