blob: b9f5b9f8cbf43e9c8c65696427c1c2de7ff68ed4 [file] [log] [blame]
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();
}
}