X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FHelp.java;h=658b34fbbad3ce98152659f054b59d1d947db972;hb=29625ee998523520e87bb88643247b3723e908bd;hp=83fcaf708ebd1944e9718d1f18ca0a3929451748;hpb=ae81fc691048b2151003030cb079bee26a0b610c;p=jalview.git diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java index 83fcaf7..658b34f 100644 --- a/src/jalview/gui/Help.java +++ b/src/jalview/gui/Help.java @@ -20,11 +20,7 @@ */ package jalview.gui; -import jalview.util.BrowserLauncher; -import jalview.util.Platform; - import java.awt.Point; -import java.io.IOException; import java.net.URL; import javax.help.BadIDException; @@ -32,6 +28,9 @@ import javax.help.HelpBroker; import javax.help.HelpSet; import javax.help.HelpSetException; +import jalview.util.BrowserLauncher; +import jalview.util.Platform; + /** * Utility class to show the help documentation window * @@ -42,18 +41,22 @@ public class Help private static final String HELP_PAGE_ROOT = "http://www.jalview.org/help/"; /** - * Defines selected help targets with links to inbuilt (Java) help page target, - * and externally hosted help page. Will need to be maintained manually if help - * pages are reorganised in future. + * Defines selected help targets with links to inbuilt (Java) help page + * target, and externally hosted help page. Will need to be maintained + * manually if help pages are reorganised in future. */ public enum HelpId { - Home("home", "help.html"), SequenceFeatureSettings("seqfeatures.settings", "html/features/featuresettings.html"), - StructureViewer("viewingpdbs", "html/features/viewingpdbs.html"), PdbFts("pdbfts", "html/features/pdbsequencefetcher.html#pdbfts"), - UniprotFts("uniprotfts", "html/features/uniprotsequencefetcher.html#uniprotfts"); + Home("home", "help.html"), + SequenceFeatureSettings("seqfeatures.settings", + "html/features/featuresettings.html"), + StructureViewer("viewingpdbs", "html/features/viewingpdbs.html"), + PdbFts("pdbfts", "html/features/pdbsequencefetcher.html#pdbfts"), + UniprotFts("uniprotfts", + "html/features/uniprotsequencefetcher.html#uniprotfts"); private String id; - + private String path; private HelpId(String hepLoc, String htmlPath) @@ -92,44 +95,57 @@ public class Help */ public static void showHelpWindow(HelpId id) throws HelpSetException { - if (Platform.isJS()) - { - try - { - BrowserLauncher.openURL(HELP_PAGE_ROOT + id.getPath()); - } catch (IOException e) {} - return; - } - - ClassLoader cl = Desktop.class.getClassLoader(); - URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$ - HelpSet hs = new HelpSet(cl, url); - - if (hb == null) + if (Platform.isJS()) { /* - * create help broker first time (only) - */ - hb = hs.createHelpBroker(); + try + { + */ + BrowserLauncher.openURL(HELP_PAGE_ROOT + id.getPath()); + /* + } catch (IOException e) + { + } + */ } - - try - { - hb.setCurrentID(id.getId()); - } catch (BadIDException bad) + else + /** + * Java only + * + * @j2sIgnore + */ { - System.out.println("Bad help link: " + id.getId() - + ": must match a target in help.jhm"); - throw bad; - } - /* - * set Help visible - at its current location if it is already shown, - * else at a location as determined by the window manager - */ - Point p = hb.getLocation(); - hb.setLocation(p); - hb.setDisplayed(true); + ClassLoader cl = Desktop.class.getClassLoader(); + URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$ + HelpSet hs = new HelpSet(cl, url); + + if (hb == null) + { + /* + * create help broker first time (only) + */ + hb = hs.createHelpBroker(); + } + + try + { + hb.setCurrentID(id.getId()); + } catch (BadIDException bad) + { + System.out.println("Bad help link: " + id.getId() + + ": must match a target in help.jhm"); + throw bad; + } + + /* + * set Help visible - at its current location if it is already shown, + * else at a location as determined by the window manager + */ + Point p = hb.getLocation(); + hb.setLocation(p); + hb.setDisplayed(true); + } } /**