use of javax.help.HelpSet in project logisim-evolution by reds-heig.
the class MenuHelp method loadBroker.
private void loadBroker() {
String helpUrl = Strings.get("helpsetUrl");
if (helpUrl == null) {
helpUrl = "doc/doc_en.hs";
}
if (helpSet == null || helpFrame == null || !helpUrl.equals(helpSetUrl)) {
ClassLoader loader = MenuHelp.class.getClassLoader();
try {
URL hsURL = HelpSet.findHelpSet(loader, helpUrl);
if (hsURL == null) {
disableHelp();
JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpNotFoundError"));
return;
}
helpSetUrl = helpUrl;
helpSet = new HelpSet(null, hsURL);
helpComponent = new JHelp(helpSet);
if (helpFrame == null) {
helpFrame = new LFrame();
helpFrame.setTitle(Strings.get("helpWindowTitle"));
helpFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
helpFrame.getContentPane().add(helpComponent);
helpFrame.setPreferredSize(new Dimension((int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() >> 1, (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() >> 1));
helpFrame.pack();
} else {
helpFrame.getContentPane().removeAll();
helpFrame.getContentPane().add(helpComponent);
helpComponent.revalidate();
}
} catch (Exception e) {
disableHelp();
e.printStackTrace();
JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpUnavailableError"));
return;
}
}
}
use of javax.help.HelpSet in project ffx by mjschnie.
the class MainPanel method help.
/**
* <p>
* help</p>
*/
public void help() {
String helpHS = "ffx/help/jhelpset.hs";
ClassLoader cl = getClass().getClassLoader();
HelpSet hs = null;
try {
URL hsURL = HelpSet.findHelpSet(cl, helpHS);
hs = new HelpSet(null, hsURL);
} catch (Exception e) {
logger.warning("HelpSet not found: " + e);
return;
}
JHelp jhelp = new JHelp(hs);
JFrame helpFrame = new JFrame();
JFrame.setDefaultLookAndFeelDecorated(true);
helpFrame.add(jhelp);
helpFrame.setTitle("Force Field X Help");
helpFrame.setSize(jhelp.getPreferredSize());
helpFrame.setVisible(true);
jhelp.setCurrentID("ForceFieldXBook");
helpFrame.toFront();
}
use of javax.help.HelpSet in project bundle-app-ui by astrapi69.
the class DesktopMenu method newHelpMenu.
/**
* Factory method for create new {@link JMenu} for the help menu.
*
* @param listener
* the listener
* @return the j menu
*/
private JMenu newHelpMenu(final ActionListener listener) {
// Help menu
// $NON-NLS-1$
final JMenu menuHelp = new JMenu("Help");
menuHelp.setMnemonic('H');
// Help JMenuItems
// Help content
// $NON-NLS-1$
final JMenuItem mihHelpContent = new JMenuItem("Content", 'c');
MenuExtensions.setCtrlAccelerator(mihHelpContent, 'H');
menuHelp.add(mihHelpContent);
// found bug with the javax.help
// Exception in thread "main" java.lang.SecurityException: no manifiest
// section for signature file entry
// com/sun/java/help/impl/TagProperties.class
// Solution is to remove the rsa files from the jar
final HelpSet hs = getHelpSet();
final DefaultHelpBroker helpBroker = (DefaultHelpBroker) hs.createHelpBroker();
final WindowPresentation pres = helpBroker.getWindowPresentation();
pres.createHelpWindow();
helpWindow = pres.getHelpWindow();
helpWindow.setLocationRelativeTo(null);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (final Exception e1) {
log.error(e1.getLocalizedMessage(), e1);
}
SwingUtilities.updateComponentTreeUI(helpWindow);
// 2. assign help to components
CSH.setHelpIDString(mihHelpContent, "Overview");
// 3. handle events
final CSH.DisplayHelpFromSource displayHelpFromSource = new CSH.DisplayHelpFromSource(helpBroker);
mihHelpContent.addActionListener(displayHelpFromSource);
mihHelpContent.addActionListener(new ShowHelpDialogAction("Content"));
// Donate
final JMenuItem mihDonate = new JMenuItem(// $NON-NLS-1$
Messages.getString("com.find.duplicate.files.menu.item.donate"));
mihDonate.addActionListener(new OpenBrowserToDonateAction("Donate"));
menuHelp.add(mihDonate);
// Licence
// $NON-NLS-1$
final JMenuItem mihLicence = new JMenuItem("Licence");
mihLicence.addActionListener(new ShowLicenseFrameAction("Licence"));
menuHelp.add(mihLicence);
// Info
// $NON-NLS-1$
final JMenuItem mihInfo = new JMenuItem("Info", 'i');
MenuExtensions.setCtrlAccelerator(mihInfo, 'I');
mihInfo.addActionListener(new ShowInfoDialogAction("Info"));
menuHelp.add(mihInfo);
return menuHelp;
}
use of javax.help.HelpSet in project zaproxy by zaproxy.
the class ExtensionHelp method loadExtensionHelpSet.
private static void loadExtensionHelpSet(Extension ext) {
URL helpSetUrl = getExtensionHelpSetUrl(ext);
if (helpSetUrl != null) {
try {
logger.debug("Load help files for extension '" + ext.getName() + "' and merge with core help.");
addHelpSet(ext.getAddOn(), new HelpSet(ext.getClass().getClassLoader(), helpSetUrl));
} catch (HelpSetException e) {
logger.error("An error occured while adding help file of extension '" + ext.getName() + "': " + e.getMessage(), e);
}
}
}
use of javax.help.HelpSet in project zaproxy by zaproxy.
the class ExtensionHelp method loadAddOnHelpSet.
private static void loadAddOnHelpSet(AddOn addOn) {
addOn.getLoadedExtensions().forEach(ExtensionHelp::loadExtensionHelpSet);
AddOn.HelpSetData helpSetData = addOn.getHelpSetData();
if (helpSetData.isEmpty()) {
return;
}
ClassLoader classLoader = addOn.getClassLoader();
URL helpSetUrl = LocaleUtils.findResource(helpSetData.getBaseName(), HELP_SET_FILE_EXTENSION, helpSetData.getLocaleToken(), Constant.getLocale(), classLoader::getResource);
if (helpSetUrl == null) {
logger.error("Declared helpset not found for '" + addOn.getId() + "' add-on, with base name: " + helpSetData.getBaseName() + (helpSetData.getLocaleToken().isEmpty() ? "" : " and locale token: " + helpSetData.getLocaleToken()));
return;
}
try {
logger.debug("Loading help for '" + addOn.getId() + "' add-on and merging with core help.");
addHelpSet(addOn, new HelpSet(classLoader, helpSetUrl));
} catch (HelpSetException e) {
logger.error("An error occured while adding help for '" + addOn.getId() + "' add-on:", e);
}
}
Aggregations