[[#variablee055720]]static final String HELP_DOCS = "file:///" // $NON-NLS-1$
+ JMeterUtils.getJMeterHome() + "/printable_docs/usermanual/"; // $NON-NLS-1$
[[#variablee055720]]static final String HELP_PAGE = HELP_DOCS + "component_reference.html"; // $NON-NLS-1$
public static final String HELP_FUNCTIONS = HELP_DOCS + "functions.html"; // $NON-NLS-1$
private static JDialog helpWindow;
private static HtmlPane helpDoc;
private static JScrollPane scroller;
private static String currentPage;
static {
commands.add( [[#variablee054e00]]);
helpDoc = new HtmlPane();
scroller = new JScrollPane(helpDoc);
helpDoc.setEditable(false);
try {
helpDoc.setPage(HELP_PAGE);
currentPage = HELP_PAGE;
}
catch (IOException
err) {
String msg = "Couldn\'t load help file " + err.toString();
log.error(msg);
currentPage = ""; // Avoid NPE in resetPage() // $NON-NLS-1$ // Avoid NPE in resetPage()
}
}
/**
* @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
*/
public void doAction(ActionEvent e) {
if (helpWindow == null) {
helpWindow = new JDialog(new Frame(), // independent frame to
// allow it to be overlaid
// by the main frame
JMeterUtils.getResString("help"), //$NON-NLS-1$
false);
helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
ComponentUtil.centerComponentInWindow(helpWindow, 60);
}
helpWindow.getContentPane().removeAll();
helpWindow.getContentPane().add(scroller);
helpWindow.show();
if (e.getSource() instanceof String[]) {
String[] source = (String[]) e.getSource();
resetPage(source[0]);
helpDoc.scrollToReference(source[1]);
}
else {
resetPage(HELP_PAGE);
helpDoc.scrollToReference( [[#variablee0556a0]].getInstance().getTreeListener().getCurrentNode().getDocAnchor());
}
}
private void resetPage(String source) {
if ( !currentPage.equals(source)) {
try {
helpDoc.setPage(source);
currentPage = source;
}
catch (IOException
err) {
log.error(err.toString());
JMeterUtils.reportErrorToUser("Problem loading a help page - see log for details");
currentPage = ""; // $NON-NLS-1$
}
}
}
/**
* @see org.apache.jmeter.gui.action.Command#getActionNames()
*/
public Set getActionNames() {
return commands;
}
|