+ if (menu.getId() == TMenu.MID_HELP_HELP) {
+ new THelpWindow(this, THelpWindow.HELP_HELP);
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_HELP_CONTENTS) {
+ new THelpWindow(this, helpFile.getTableOfContents());
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_HELP_INDEX) {
+ new THelpWindow(this, helpFile.getIndex());
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_HELP_SEARCH) {
+ TInputBox inputBox = inputBox(i18n.
+ getString("searchHelpInputBoxTitle"),
+ i18n.getString("searchHelpInputBoxCaption"), "",
+ TInputBox.Type.OKCANCEL);
+ if (inputBox.isOk()) {
+ new THelpWindow(this,
+ helpFile.getSearchResults(inputBox.getText()));
+ }
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_HELP_PREVIOUS) {
+ if (helpTopics.size() > 1) {
+ Topic previous = helpTopics.remove(helpTopics.size() - 2);
+ helpTopics.remove(helpTopics.size() - 1);
+ new THelpWindow(this, previous);
+ } else {
+ new THelpWindow(this, helpFile.getTableOfContents());
+ }
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_HELP_ACTIVE_FILE) {
+ try {
+ List<String> filters = new ArrayList<String>();
+ filters.add("^.*\\.[Xx][Mm][Ll]$");
+ String filename = fileOpenBox(".", TFileOpenBox.Type.OPEN,
+ filters);
+ if (filename != null) {
+ helpTopics = new ArrayList<Topic>();
+ helpFile = new HelpFile();
+ helpFile.load(new FileInputStream(filename));
+ }
+ } catch (Exception e) {
+ // Show this exception to the user.
+ new TExceptionDialog(this, e);
+ }
+ return true;
+ }
+