19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Desktop;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.io.IOException;
25 import java.net.MalformedURLException;
27 import org.netbeans.core.actions.HTMLViewAction;
28 import org.openide.awt.ActionID;
29 import org.openide.awt.ActionReference;
30 import org.openide.awt.ActionReferences;
31 import org.openide.awt.ActionRegistration;
32 import org.openide.awt.HtmlBrowser;
33 import org.openide.util.NbBundle;
34 import org.openide.util.NbBundle.Messages;
35 import java.util.logging.Level;
36 import java.util.logging.Logger;
43 id =
"org.sleuthkit.autopsy.corecomponents.OfflineHelpAction"
46 displayName =
"#CTL_OfflineHelpAction"
49 @ActionReference(path =
"Menu/Help", position = 1),
50 @ActionReference(path =
"Shortcuts", name =
"F2")
52 @Messages(
"CTL_OfflineHelpAction=Offline Autopsy Documentation")
72 String fileForHelp =
"";
73 String indexForHelp =
"";
74 String currentDirectory =
"";
78 fileForHelp = NbBundle.getMessage(
OfflineHelpAction.class,
"FILE_FOR_LOCAL_HELP");
79 indexForHelp = NbBundle.getMessage(
OfflineHelpAction.class,
"INDEX_FOR_LOCAL_HELP");
80 currentDirectory = System.getProperty(
"user.dir").replace(
"\\",
"/").replace(
" ",
"%20");
81 uri =
new URI(fileForHelp + currentDirectory + indexForHelp);
82 }
catch (Exception ex) {
83 Logger.log(Level.SEVERE,
"Unable to load Offline Documentation: "
84 + fileForHelp + currentDirectory + indexForHelp, ex);
88 if (Desktop.isDesktopSupported()) {
89 Desktop desktop = Desktop.getDesktop();
92 }
catch (IOException ex) {
93 Logger.log(Level.SEVERE,
"Unable to launch the system browser: "
94 + fileForHelp + currentDirectory + indexForHelp, ex);
97 org.openide.awt.StatusDisplayer.getDefault().setStatusText(
98 NbBundle.getMessage(HTMLViewAction.class,
"CTL_OpeningBrowser"));
100 HtmlBrowser.URLDisplayer.getDefault().showURL(uri.toURL());
101 }
catch (MalformedURLException ex) {
102 Logger.log(Level.SEVERE,
"Unable to launch the built-in browser: "
103 + fileForHelp + currentDirectory + indexForHelp, ex);
void actionPerformed(ActionEvent e)
static Logger getLogger(String name)