Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0905d95754e659457e8f1af64c19004a560f6064 (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
package org.eclipse.help.internal.contributions.xml;

/*
 * Licensed Materials - Property of IBM,
 * WebSphere Studio Workbench
 * (c) Copyright IBM Corp 2000
 */

import java.util.*;
import org.eclipse.help.internal.contributions.*;

/**
 * Factory for topic contributions.
 * Each topic is also registered with the specified view,
 * as topics are created for a view only.
 */
public class HelpTopicFactory {
	protected static final HelpTopicFactory instance = new HelpTopicFactory();
	protected Map topicPool = new HashMap();
	protected static InfoView view;

	/**
	 * HelpTopicFactory constructor comment.
	 */
	protected HelpTopicFactory() {
		super();
	}
	/**
	 */
	public static Topic createTopic(Topic topicNode) {
		Topic topic = new HelpTopicRef(topicNode);
		if (view != null)
			 ((HelpInfoView) view).registerTopic(topic);
		return topic;
	}
	/**
	 */
	public static HelpTopicFactory getFactory() {
		return instance;
	}
	/**
	 */
	public Topic getTopic(Topic topicNode) {
		Topic topic = (Topic) topicPool.get(topicNode);
		if (topic == null) {
			topic = new HelpTopicRef(topicNode);
			topicPool.put(topicNode, topic);
		}
		return topic;
	}
	/**
	 */
	public static void setView(InfoView v) {
		view = v;
	}
	/**
	 */
	public static void setView(HelpInfoView v) {
		view = v;
	}
}

Back to the top