| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.gui; |
| 22 |
|
|
| 23 |
|
import java.awt.Point; |
| 24 |
|
import java.net.URL; |
| 25 |
|
|
| 26 |
|
import javax.help.BadIDException; |
| 27 |
|
import javax.help.HelpBroker; |
| 28 |
|
import javax.help.HelpSet; |
| 29 |
|
import javax.help.HelpSetException; |
| 30 |
|
|
| 31 |
|
import jalview.util.BrowserLauncher; |
| 32 |
|
import jalview.util.Platform; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
@author |
| 38 |
|
|
| |
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 6 |
Complexity Density: 0.4 |
|
| 39 |
|
public class Help |
| 40 |
|
{ |
| 41 |
|
private static final String HELP_PAGE_ROOT = "http://www.jalview.org/help/"; |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| |
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 48 |
|
public enum HelpId |
| 49 |
|
{ |
| 50 |
|
Home("home", "help.html"), |
| 51 |
|
SequenceFeatureSettings("seqfeatures.settings", |
| 52 |
|
"html/features/featuresettings.html"), |
| 53 |
|
StructureViewer("viewingpdbs", "html/features/viewingpdbs.html"), |
| 54 |
|
PdbFts("pdbfts", "html/features/pdbsequencefetcher.html#pdbfts"), |
| 55 |
|
UniprotFts("uniprotfts", |
| 56 |
|
"html/features/uniprotsequencefetcher.html#uniprotfts"); |
| 57 |
|
|
| 58 |
|
private String id; |
| 59 |
|
|
| 60 |
|
private String path; |
| 61 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 62 |
5 |
private HelpId(String hepLoc, String htmlPath)... |
| 63 |
|
{ |
| 64 |
5 |
this.id = hepLoc; |
| 65 |
5 |
this.path = htmlPath; |
| 66 |
|
} |
| 67 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 68 |
5 |
String getId()... |
| 69 |
|
{ |
| 70 |
5 |
return this.id; |
| 71 |
|
} |
| 72 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0 |
String getPath()... |
| 74 |
|
{ |
| 75 |
0 |
return this.path; |
| 76 |
|
} |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
private static HelpBroker hb; |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 84 |
0 |
private Help()... |
| 85 |
|
{ |
| 86 |
|
|
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
@param |
| 93 |
|
|
| 94 |
|
@throws |
| 95 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
| 96 |
0 |
public static void showHelpWindow(HelpId id) throws HelpSetException... |
| 97 |
|
{ |
| 98 |
0 |
if (Platform.isJS()) |
| 99 |
|
{ |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
0 |
BrowserLauncher.openURL(HELP_PAGE_ROOT + id.getPath()); |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
} |
| 111 |
|
else |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
{ |
| 118 |
|
|
| 119 |
0 |
ClassLoader cl = Desktop.class.getClassLoader(); |
| 120 |
0 |
URL url = HelpSet.findHelpSet(cl, "help/help"); |
| 121 |
0 |
HelpSet hs = new HelpSet(cl, url); |
| 122 |
|
|
| 123 |
0 |
if (hb == null) |
| 124 |
|
{ |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
0 |
hb = hs.createHelpBroker(); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
0 |
try |
| 132 |
|
{ |
| 133 |
0 |
hb.setCurrentID(id.getId()); |
| 134 |
|
} catch (BadIDException bad) |
| 135 |
|
{ |
| 136 |
0 |
jalview.bin.Console.outPrintln("Bad help link: " + id.getId() |
| 137 |
|
+ ": must match a target in help.jhm"); |
| 138 |
0 |
throw bad; |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
0 |
Point p = hb.getLocation(); |
| 146 |
0 |
hb.setLocation(p); |
| 147 |
0 |
hb.setDisplayed(true); |
| 148 |
|
} |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
|
| 154 |
|
@throws |
| 155 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 156 |
0 |
public static void showHelpWindow() throws HelpSetException... |
| 157 |
|
{ |
| 158 |
0 |
showHelpWindow(HelpId.Home); |
| 159 |
|
} |
| 160 |
|
} |