Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5d8f3b9c5df5104160f71085c0f1e7de24e9316a (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
/*******************************************************************************
 * Copyright (c) 2010, 2015 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.other;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.help.ICriteria;
import org.eclipse.help.IToc2;
import org.eclipse.help.IUAElement;

public class UserToc2 extends UserToc implements IToc2 {

	public UserToc2(String label, String href, boolean isEnabled) {
		super(label, href, isEnabled);
	}

	private List<ICriteria> criteria = new ArrayList<ICriteria>();

	@Override
	public IUAElement[] getChildren() {
		IUAElement[] criteriaElements = getCriteria();
		IUAElement[] topics = getTopics();
		IUAElement[] result = new IUAElement[criteriaElements.length + topics.length];
		System.arraycopy(topics, 0, result, 0, topics.length);
		System.arraycopy(criteriaElements, 0, result, topics.length, criteriaElements.length);
		return result;
	}
	
	public void addCriterion(ICriteria child) {
		criteria.add(child);
	}

	@Override
	public ICriteria[] getCriteria() {
		return criteria.toArray(new ICriteria[0]);
	}

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

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

}

Back to the top