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

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

import org.eclipse.help.*;

/**
 * IContext Implementation that performs lazy lookup of
 * context ID and HelpContext instantiation.
 * when any of the IContext methods are called.
 */
public class ContextImpl implements IContext {
	private String contextID;
	private IContext context = null;
	private boolean used = false;
	/**
	 * ContextImpl constructor.
	 */
	public ContextImpl(String contextId) {
		super();
		this.contextID = contextId;
	}
	/**
	 * Returns a list of related topics for this help context.
	 * 
	 * @return a list of related help topics
	 */
	public IHelpTopic[] getRelatedTopics() {
		if (!used) {
			context = HelpSystem.getContextManager().getContext(contextID);
			used = true;
		}
		if (context == null)
			return null;
		return context.getRelatedTopics();
	}
	/**
	 * Returns the text description for this context.
	 *
	 * @return the text description
	 */
	public String getText() {
		if (!used) {
			context = HelpSystem.getContextManager().getContext(contextID);
			used = true;
		}
		if (context == null)
			return null;
		return context.getText();
	}
}

Back to the top