use of javax.help.HelpSet in project ACS by ACS-Community.
the class CommandCenterGui method showHelpBrowser.
protected void showHelpBrowser() {
if (helpBroker == null) {
HelpSet helpSet = controller.getHelpSet();
if (helpSet == null) {
ErrorBox.showMessageDialog(frame, "Online Help could not be loaded", true);
return;
}
helpBroker = (DefaultHelpBroker) helpSet.createHelpBroker();
}
helpBroker.setCurrentID("intro");
helpBroker.setDisplayed(true);
}
use of javax.help.HelpSet in project intellij-community by JetBrains.
the class HelpManagerImpl method createHelpSet.
@Nullable
private static HelpSet createHelpSet() {
String urlToHelp = ApplicationInfo.getInstance().getHelpURL() + "/" + HELP_HS;
HelpSet mainHelpSet = loadHelpSet(urlToHelp);
if (mainHelpSet == null)
return null;
// merge plugins help sets
IdeaPluginDescriptor[] pluginDescriptors = PluginManagerCore.getPlugins();
for (IdeaPluginDescriptor pluginDescriptor : pluginDescriptors) {
HelpSetPath[] sets = pluginDescriptor.getHelpSets();
for (HelpSetPath hsPath : sets) {
String url = "jar:file:///" + pluginDescriptor.getPath().getAbsolutePath() + "/help/" + hsPath.getFile() + "!";
if (!hsPath.getPath().startsWith("/")) {
url += "/";
}
url += hsPath.getPath();
HelpSet pluginHelpSet = loadHelpSet(url);
if (pluginHelpSet != null) {
mainHelpSet.add(pluginHelpSet);
}
}
}
return mainHelpSet;
}
use of javax.help.HelpSet in project JMRI by JMRI.
the class HelpUtil method initOK.
public static boolean initOK() {
if (!init) {
init = true;
try {
Locale locale = Locale.getDefault();
String language = locale.getLanguage();
String helpsetName = "help/" + language + "/JmriHelp_" + language + ".hs";
URL hsURL = FileUtil.findURL(helpsetName);
if (hsURL != null) {
log.debug("JavaHelp using {}", helpsetName);
} else {
log.warn("JavaHelp: File " + helpsetName + " not found, dropping to default");
language = "en";
helpsetName = "help/" + language + "/JmriHelp_" + language + ".hs";
hsURL = FileUtil.findURL(helpsetName);
}
try {
globalHelpSet = new HelpSet(null, hsURL);
} catch (java.lang.NoClassDefFoundError ee) {
log.debug("classpath={}", System.getProperty("java.class.path", "<unknown>"));
log.debug("classversion={}", System.getProperty("java.class.version", "<unknown>"));
log.error("Help classes not found, help system omitted");
return false;
} catch (java.lang.Exception e2) {
log.error("HelpSet " + helpsetName + " not found, help system omitted");
return false;
}
globalHelpBroker = globalHelpSet.createHelpBroker();
} catch (java.lang.NoSuchMethodError e2) {
log.error("Is jh.jar available? Error starting help system: " + e2);
}
failed = false;
}
return !failed;
}
use of javax.help.HelpSet in project keystore-explorer by kaikramer.
the class HelpAction method createAndDisplayHelp.
private void createAndDisplayHelp() throws HelpSetException {
URL hsUrl = getClass().getResource(res.getString("HelpAction.HelpSet"));
HelpSet hs = new HelpSet(getClass().getClassLoader(), hsUrl);
if (LnfUtil.isDarculaAvailable()) {
URL hsDarculaUrl = getClass().getResource(res.getString("HelpAction.DarculaHelpSet"));
HelpSet hsDarcula = new HelpSet(getClass().getClassLoader(), hsDarculaUrl);
hs.add(hsDarcula);
}
helpBroker = new DefaultHelpBroker(hs);
WindowPresentation windowPresentation = helpBroker.getWindowPresentation();
windowPresentation.createHelpWindow();
// Make window immune to modal dialogs in application
Window helpWindow = windowPresentation.getHelpWindow();
helpWindow.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
// Set help icons - set lots of different sizes to give each OS the most
// flexibility in choosing an icon for display
ArrayList<Image> icons = new ArrayList<Image>();
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.16x16"))));
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.24x24"))));
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.32x32"))));
helpWindow.setIconImages(icons);
helpBroker.setLocation(new Point(frame.getX() + 25, frame.getY() + 25));
helpBroker.setSize(new Dimension(850, 600));
helpBroker.setCurrentID(START_ID);
helpBroker.setDisplayed(true);
}
use of javax.help.HelpSet in project edumips64 by lupino3.
the class GUIHelp method showHelp.
/**
* Shows the EduMIPS64 help window.
*
* @param parent the window that owns this help dialog
* @param helpSetUrl the URL to the directory of the help set.
*/
public static void showHelp(Window parent, URL helpSetUrl, ConfigStore cfg) throws HelpSetException, BadIDException, MalformedURLException {
// Clean up the URL from spaces.
String cleanUrl = helpSetUrl.getProtocol() + ":" + helpSetUrl.getPath().replace("%20", " ");
URL[] aurl = GUIHelp.parseURLs(cleanUrl);
URLClassLoader urlclassloader = new URLClassLoader(aurl);
URL url = HelpSet.findHelpSet(urlclassloader, HELPSET);
int desiredFontSize = cfg.getInt(ConfigKey.UI_FONT_SIZE);
float windowScalingFactor = desiredFontSize / 12.0f;
HelpSet helpset = new HelpSet(urlclassloader, url);
HelpBroker helpBroker = helpset.createHelpBroker();
helpBroker.initPresentation();
helpBroker.setSize(new Dimension((int) (800 * windowScalingFactor), (int) (600 * windowScalingFactor)));
// Update the font.
helpBroker.setSize(helpBroker.getSize());
Font newFont = helpBroker.getFont().deriveFont((float) desiredFontSize);
((DefaultHelpBroker) helpBroker).setActivationWindow(parent);
helpBroker.initPresentation();
helpBroker.setFont(newFont);
helpBroker.setDisplayed(true);
}
Aggregations