javax.help.HelpSetException Java Examples

The following examples show how to use javax.help.HelpSetException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GhidraHelpService.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void loadHelpSets() {

		Map<ResourceFile, Set<URL>> helpSetsByModule = findHelpSetsByModule();
		Set<Entry<ResourceFile, Set<URL>>> entries = helpSetsByModule.entrySet();
		for (Entry<ResourceFile, Set<URL>> entry : entries) {
			ResourceFile module = entry.getKey();
			Set<URL> moduleHelpSets = entry.getValue();
			for (URL url : moduleHelpSets) {
				try {
					addHelpSet(url, new GHelpClassLoader(module));
				}
				catch (HelpSetException e) {
					Msg.error(this, "Unexpected Exception Loading HelpSet: " + e.getMessage(), e);
				}
			}
		}
	}
 
Example #2
Source File: TestHelpService.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public static void install(URL masterHelpSetUrl) {
	try {
		new TestHelpService(masterHelpSetUrl);
	}
	catch (HelpSetException e) {
		Msg.error(TestHelpService.class, "Unable to load Test help", e);
	}
}
 
Example #3
Source File: JarHelpModuleLocation.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public HelpSet loadHelpSet() {

	// Our convention is to name the help set after the module
	File jarFile = getJarFile();
	String moduleName = getModuleName(jarFile);
	Path hsPath = helpDir.resolve(moduleName + "_HelpSet.hs");
	try {
		return new GHelpSet(null, hsPath.toUri().toURL());
	}
	catch (MalformedURLException | HelpSetException e) {
		throw new AssertException(
			"Pre-built help jar file is missing it's help set: " + helpDir, e);
	}
}
 
Example #4
Source File: GhidraHelpService.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public static void install() {
	try {
		new GhidraHelpService();
	}
	catch (HelpSetException e) {
		Msg.error(GhidraHelpService.class, "Unable to load Ghidra help", e);
	}
}
 
Example #5
Source File: TestHelpService.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private TestHelpService(URL baseHelpSetURL) throws HelpSetException {
	super(baseHelpSetURL);
	registerHelp();
}
 
Example #6
Source File: GhidraHelpService.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private GhidraHelpService() throws HelpSetException {
	super(findMasterHelpSetUrl());
	loadHelpSets();
	registerHelp();
}
 
Example #7
Source File: BoardMenuHelp.java    From Freerouting with GNU General Public License v3.0 4 votes vote down vote up
private void initialize_help(java.util.Locale p_locale)
{
    // try to find the helpset and create a HelpBroker object
    if (BoardFrame.help_broker == null)
    {
        String language = p_locale.getLanguage();
        String helpset_name;
        if (language.equalsIgnoreCase("de"))
        {
            helpset_name = "helpset/de/Help.hs";
        }
        else
        {
            helpset_name = "helpset/en/Help.hs";
        }
        try
        {
            URL hsURL = HelpSet.findHelpSet(this.getClass().getClassLoader(), helpset_name);
            if (hsURL == null)
            {
                System.out.println("HelpSet " + helpset_name + " not found.");
            }
            else
            {
                BoardFrame.help_set = new HelpSet(null, hsURL);
            }
        }
        catch (HelpSetException ee)
        {
            System.out.println("HelpSet " + helpset_name + " could not be opened.");
            System.out.println(ee.getMessage());
        }
        if (BoardFrame.help_set != null)
        {
            BoardFrame.help_broker = BoardFrame.help_set.createHelpBroker();
        }
        if (BoardFrame.help_broker != null)
        {
            // CSH.DisplayHelpFromSource is a convenience class to display the helpset
            contents_help = new CSH.DisplayHelpFromSource(BoardFrame.help_broker);
            direct_help = new CSH.DisplayHelpAfterTracking(BoardFrame.help_broker);
        }
    }
}
 
Example #8
Source File: BoardMenuHelp.java    From freerouting with GNU General Public License v3.0 4 votes vote down vote up
private void initialize_help(java.util.Locale p_locale)
{
    // try to find the helpset and create a HelpBroker object
    if (BoardFrame.help_broker == null)
    {
        String language = p_locale.getLanguage();
        String helpset_name;
        if (language.equalsIgnoreCase("de"))
        {
            helpset_name = "/eu/mihosoft/freerouting/helpset/de/Help.hs";
        }
        else
        {
            helpset_name = "/eu/mihosoft/freerouting/helpset/en/Help.hs";
        }
        try
        {
            // original author tries to get language specific url
            // via HelpSet utility methods which does not work that well
            // and doesn't really make sense if the language is specified
            // manually
            // TODO find out why previous approach does not work reliably
            URL hsURL = getClass().getResource(helpset_name);
            if (hsURL == null)
            {
                FRLogger.warn("HelpSet " + helpset_name + " not found.");
            }
            else
            {
                BoardFrame.help_set = new HelpSet(null, hsURL);
            }
        }
        catch (HelpSetException ee)
        {
            FRLogger.error("HelpSet " + helpset_name + " could not be opened.", ee);
        }
        if (BoardFrame.help_set != null)
        {
            BoardFrame.help_broker = BoardFrame.help_set.createHelpBroker();
        }
        if (BoardFrame.help_broker != null)
        {
            // CSH.DisplayHelpFromSource is a convenience class to display the helpset
            contents_help = new CSH.DisplayHelpFromSource(BoardFrame.help_broker);
            direct_help = new CSH.DisplayHelpAfterTracking(BoardFrame.help_broker);
        }
    }
}