Skip to main content
summaryrefslogtreecommitdiffstats
blob: 30fc5e18e9f11c928a1c473b36220028bff0287e (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*******************************************************************************
 * Copyright (c) 2009 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.ua.tests.help.toc;

import org.eclipse.help.AbstractTocProvider;
import org.eclipse.help.IToc;
import org.eclipse.help.ITocContribution;
import org.eclipse.ua.tests.help.other.UserToc;
import org.eclipse.ua.tests.help.other.UserTopic;

public class UaTestTocProvider extends AbstractTocProvider {
	
	UserToc toc;
	TocContribution contribution;
	private ITocContribution[] contributions;
	
	private class TocContribution implements ITocContribution {

		@Override
		public String getCategoryId() {
			return null;
		}

		@Override
		public String getContributorId() {
			return "org.eclipse.ua.tests";
		}

		@Override
		public String[] getExtraDocuments() {
			return new String[0];
		}

		@Override
		public String getId() {
			return "generatedToc";
		}

		@Override
		public String getLinkTo() {
			return "PLUGINS_ROOT/org.eclipse.ua.tests/data/help/toc/root.xml#generatedContent";
		}

		@Override
		public String getLocale() {
			return null;
		}

		@Override
		public IToc getToc() {
			return toc;
		}

		@Override
		public boolean isPrimary() {
			return false;
		}
		
	};

	public UaTestTocProvider() {
		toc = new UserToc("Generated Toc", null, true);
		UserTopic parentTopic = new UserTopic("Generated Parent", 
				"generated/Generated+Parent/Parent+page+with+searchable+word+egrology+.html", true);
		for (int i = 1; i <= 4; i++) {
			UserTopic childTopic = new UserTopic("Generated Child " + i, 
					"generated/Generated+Child" + i +
					"/Child+topic+" + i + ".html", true);
			parentTopic.addTopic(childTopic);
		}
		toc.addTopic(parentTopic);
		contribution = new TocContribution();
		contributions = new ITocContribution[] { contribution };
	}

	@Override
	public ITocContribution[] getTocContributions(String locale) {
		return contributions; 
	}

}

Back to the top