Skip to main content

setCurrentID problems

No replies
Joined: 2006-02-17
Points: 0

I am trying to add JavaHelp to our system, which is fairly large. I need to be able to access the same helpset and helpbroker from anywhere in the GUI. I created a class with static variables for HelpSet and HelpBroker, and I would like to be able to do the following:

Set up a help button that will display a specific topic, based on the map ID I send it:

The problem is that it doesn't work. The content viewer comes up OK, but it always displays the same topic--the one defined as the in the map file.

Is it possible to do this? Can the helpset and helpbroker be accessed statically this way? If not, what approach should I use? I would greatly appreciate some help.

Thanks so much,

Here are the relevant parts of my StaticHelp class:

private static HelpSet staticHelpSet;
private static HelpBroker staticHelpBroker;

public static ActionListener setMapIDandDisplay(String sMapID) {
ActionListener alHelp = null;
if (helpSetIsLoaded() == false) {
alHelp = new CSH.DisplayHelpFromSource(helpBroker);
return (alHelp);

public static void initializeHelpSet() {
if (loadHelpSet()) {
helpBroker = staticHelpSet.createHelpBroker();

private static boolean loadHelpSet() {
ClassLoader cl = StaticHelp.class.getClassLoader();
try {
URL hsURL = HelpSet.findHelpSet(cl, helpsetName);
if (hsURL == null) {
logger.debug("findHelpSet returns null.");
logger.debug("Cannot find HelpSet: " + helpsetName);
logger.debug("HelpSet must be somewhere in the classpath.");
} else {
String sPath = hsURL.getPath();
String sFile = hsURL.getFile();
logger.debug("Path to HelpSet = " + sPath);
logger.debug("HelpSet File = " + sFile);
staticHelpSet = new HelpSet(null, hsURL);
bHelpSetIsLoaded = true;
} catch (Exception e) {
logger.debug("HelpSet " + e.getMessage());
logger.debug("HelpSet " + helpsetName + " not found.");
return (bHelpSetIsLoaded);