19 package org.sleuthkit.autopsy.corecomponents;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
25 import java.io.IOException;
26 import java.net.MalformedURLException;
27 import java.nio.file.Paths;
28 import org.netbeans.core.actions.HTMLViewAction;
29 import org.openide.awt.ActionID;
30 import org.openide.awt.ActionReference;
31 import org.openide.awt.ActionReferences;
32 import org.openide.awt.ActionRegistration;
33 import org.openide.awt.HtmlBrowser;
34 import org.openide.util.NbBundle;
35 import org.openide.util.NbBundle.Messages;
36 import java.util.logging.Level;
37 import org.openide.modules.InstalledFileLocator;
45 id =
"org.sleuthkit.autopsy.corecomponents.OfflineHelpAction"
48 displayName =
"#CTL_OfflineHelpAction"
51 @ActionReference(path =
"Menu/Help", position = 1),
52 @ActionReference(path =
"Shortcuts", name =
"F2")
54 @Messages(
"CTL_OfflineHelpAction=Offline Autopsy Documentation")
57 private static final String DOCS_FOLDER =
"docs";
58 private static final String HELP_HTML_FILE =
"index.html";
59 private static final String HELP_REL_PATH = Paths.get(
"..", DOCS_FOLDER, HELP_HTML_FILE).toString();
61 private static final Logger logger
77 File systemHelpFile = getOfflineHelpFile();
78 if (systemHelpFile == null) {
79 logger.log(Level.SEVERE,
"Unable to load Offline Documentation file at relative path: " + HELP_REL_PATH);
87 desktop.
open(systemHelpFile);
89 }
catch (IOException ex) {
90 logger.log(Level.SEVERE,
"Unable to launch the system browser: "
91 + systemHelpFile, ex);
95 org.openide.awt.StatusDisplayer.getDefault().setStatusText(
96 NbBundle.getMessage(HTMLViewAction.class,
"CTL_OpeningBrowser"));
98 HtmlBrowser.URLDisplayer.getDefault().showURL(systemHelpFile.toURI().toURL());
99 }
catch (MalformedURLException ex) {
100 logger.log(Level.SEVERE,
"Unable to launch the built-in browser: "
101 + systemHelpFile, ex);
109 return InstalledFileLocator.getDefault().locate(
File getOfflineHelpFile()
void actionPerformed(ActionEvent e)
synchronized static Logger getLogger(String name)
static boolean isDesktopSupported()
static Desktop getDesktop()