X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FHelp.java;h=f2d81139d3f5cf878af872939d31ff0b6411cee2;hb=8f750561f9693fbe9bbc7deb48b3d94815d49073;hp=dac17c02afc50a42b9b6fe2305be7a09124cf35b;hpb=35626511226b6eca47a7610f4682a3c686d64fa2;p=jalview.git diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java index dac17c0..f2d8113 100644 --- a/src/jalview/gui/Help.java +++ b/src/jalview/gui/Help.java @@ -1,7 +1,28 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.gui; import java.net.URL; +import javax.help.BadIDException; import javax.help.HelpBroker; import javax.help.HelpSet; import javax.help.HelpSetException; @@ -14,6 +35,24 @@ import javax.help.HelpSetException; */ public class Help { + public enum HelpId + { + Home("home"), SequenceFeatureSettings("seqfeatures.settings"), + StructureViewer("viewingpdbs"); + + private String id; + + private HelpId(String loc) + { + this.id = loc; + } + + @Override + public String toString() + { + return this.id; + } + } private static final long HALF_A_MO = 500; // half a second @@ -34,9 +73,12 @@ public class Help * This is a workaround for issue JAL-914 - both Desktop and AlignFrame * responding to F1 key, resulting in duplicate help windows opened. * + * @param id + * TODO + * * @throws HelpSetException */ - public static void showHelpWindow() throws HelpSetException + public static void showHelpWindow(HelpId id) throws HelpSetException { long timeNow = System.currentTimeMillis(); @@ -48,8 +90,21 @@ public class Help HelpSet hs = new HelpSet(cl, url); HelpBroker hb = hs.createHelpBroker(); - hb.setCurrentID("home"); + try + { + hb.setCurrentID(id.toString()); + } catch (BadIDException bad) + { + System.out.println("Bad help link: " + id.toString() + + ": must match a target in help.jhm"); + throw bad; + } hb.setDisplayed(true); } } + + public static void showHelpWindow() throws HelpSetException + { + showHelpWindow(HelpId.Home); + } }