Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
OnlineHelpAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.corecomponents;
20 
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.awt.Desktop;
24 import java.io.IOException;
25 import java.net.MalformedURLException;
26 import java.net.URISyntaxException;
27 import java.net.URI;
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;
39 
43 @ActionID(
44  category = "Help",
45  id = "org.sleuthkit.autopsy.corecomponents.OnlineHelpAction"
46 )
47 @ActionRegistration(
48  displayName = "#CTL_OnlineHelpAction"
49 )
50 @ActionReferences({
51  @ActionReference(path = "Menu/Help", position = 0),
52  @ActionReference(path = "Shortcuts", name = "F1")
53 })
54 @Messages("CTL_OnlineHelpAction=Online Autopsy Documentation")
55 public final class OnlineHelpAction implements ActionListener {
56 
57  private URI uri;
58  private static final Logger Logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(AboutWindowPanel.class.getName());
59 
60  @Override
61  public void actionPerformed(ActionEvent e) {
62  // TODO implement action body
63  viewOnlineHelp();
64  }
65 
70  private void viewOnlineHelp() {
71  try {
72  uri = new URI("http://sleuthkit.org/autopsy/docs/user-docs/" + Version.getVersion() + "/");
73  } catch (URISyntaxException ex) {
74  Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); //NON-NLS
75  }
76  if (uri != null) {
77  // Display URL in the System browser
78  if (Desktop.isDesktopSupported()) {
79  Desktop desktop = Desktop.getDesktop();
80  try {
81  desktop.browse(uri);
82  } catch (IOException ex) {
83  // TODO Auto-generated catch block
84  Logger.log(Level.SEVERE, "Unable to launch the system browser", ex); //NON-NLS
85  }
86  } else {
87  org.openide.awt.StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS
88  try {
89  HtmlBrowser.URLDisplayer.getDefault().showURL(uri.toURL());
90  } catch (MalformedURLException ex) {
91  Logger.log(Level.SEVERE, "Unable to launch the built-in browser", ex); //NON-NLS
92  }
93  }
94  }
95  }
96 
97 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.