From 01cce8917a46f366b013d4976acd76e7dae4b80f Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 13 Feb 2015 11:48:35 -0500 Subject: [PATCH 1/5] Online Documentation under Help Menu opens in browser --- .../autopsy/corecomponents/Bundle.properties | 2 + .../corecomponents/OnlineHelpAction.java | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties index a595cbc1e5..be35962d76 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties @@ -27,6 +27,8 @@ Format_OperatingSystem_Value={0} version {1} running on {2} LBL_Copyright=
Autopsy™ is a digital forensics platform based on The Sleuth Kit™ and other tools.
Copyright © 2003-2014.
URL_ON_IMG=http://www.sleuthkit.org/ +URL_ON_HELP=http://sleuthkit.org/autopsy/docs/user-docs/3.1/ + LBL_Close=Close DataContentViewerString.copyMenuItem.text=Copy DataContentViewerHex.copyMenuItem.text=Copy diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java new file mode 100755 index 0000000000..b9cfcf4c65 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java @@ -0,0 +1,72 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2014 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.corecomponents; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; +import org.netbeans.core.actions.HTMLViewAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.awt.HtmlBrowser; +import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; + +import java.util.logging.Level; +import java.util.logging.Logger; +@ActionID( + category = "Help", + id = "org.sleuthkit.autopsy.corecomponents.OnlineHelpAction" +) +@ActionRegistration( + displayName = "#CTL_OnlineHelpAction" +) +@ActionReferences({ + @ActionReference(path = "Menu/Help", position = 0), + @ActionReference(path = "Shortcuts", name = "F1") +}) +@Messages("CTL_OnlineHelpAction=Online Documentation") +public final class OnlineHelpAction implements ActionListener { + + private URL url; + private static final Logger Logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(AboutWindowPanel.class.getName()); + + @Override + public void actionPerformed(ActionEvent e) { + // TODO implement action body + try { + url = new URL(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N + showUrl(); + } catch (MalformedURLException ex) { + Logger.log(Level.SEVERE, "Unable to load Online DOcumentation", ex); + } + url = null; + } + + private void showUrl() { + if (url != null) { + org.openide.awt.StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS + HtmlBrowser.URLDisplayer.getDefault().showURL(url); + } + } + +} From 44ea86391830d1bdb2fa57874f0c8c3b7982588e Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 13 Feb 2015 13:36:49 -0500 Subject: [PATCH 2/5] Online Documentation opens in the system browser by default --- .../corecomponents/OnlineHelpAction.java | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java index b9cfcf4c65..90625c73ad 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java @@ -20,8 +20,11 @@ package org.sleuthkit.autopsy.corecomponents; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.Desktop; +import java.io.IOException; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URISyntaxException; +import java.net.URI; import org.netbeans.core.actions.HTMLViewAction; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; @@ -33,6 +36,9 @@ import org.openide.util.NbBundle.Messages; import java.util.logging.Level; import java.util.logging.Logger; +/** + * Implements a hyperlink to the Online Documentation. + */ @ActionID( category = "Help", id = "org.sleuthkit.autopsy.corecomponents.OnlineHelpAction" @@ -47,26 +53,47 @@ import java.util.logging.Logger; @Messages("CTL_OnlineHelpAction=Online Documentation") public final class OnlineHelpAction implements ActionListener { - private URL url; + private URI uri; private static final Logger Logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(AboutWindowPanel.class.getName()); @Override public void actionPerformed(ActionEvent e) { // TODO implement action body try { - url = new URL(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N - showUrl(); - } catch (MalformedURLException ex) { - Logger.log(Level.SEVERE, "Unable to load Online DOcumentation", ex); + uri = new URI(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N + viewOnlineHelp(); + } catch (URISyntaxException ex) { + Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); } - url = null; + uri = null; } - private void showUrl() { - if (url != null) { - org.openide.awt.StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS - HtmlBrowser.URLDisplayer.getDefault().showURL(url); - } + /** + * Displays the Online Documentation in the system browser. + * If not available, displays it in the built-in OpenIDE HTML Browser. + */ + private void viewOnlineHelp() { + if (uri != null) { + // Display URL in the SYstem browser + if(Desktop.isDesktopSupported()){ + Desktop desktop = Desktop.getDesktop(); + try { + desktop.browse(uri); + } catch (IOException ex) { + // TODO Auto-generated catch block + Logger.log(Level.SEVERE, "Unable to launch the system browser", ex); + } + } + else { + org.openide.awt.StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS + try { + HtmlBrowser.URLDisplayer.getDefault().showURL(uri.toURL()); + } + catch(MalformedURLException ex){ + Logger.log(Level.SEVERE, "Unable to launch the built-in browser", ex); + } + } + } } } From e1bc923fdb0125f89bc4f6c0f068975a6fa0a30b Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 13 Feb 2015 13:56:17 -0500 Subject: [PATCH 3/5] Menu/Help/Help Contents removed from the UI --- Core/build.xml | 4 +--- Core/manifest.mf | 2 +- Core/nbproject/project.xml | 9 --------- KeywordSearch/nbproject/project.xml | 9 --------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Core/build.xml b/Core/build.xml index 2d313a2de7..9a3fe484fe 100644 --- a/Core/build.xml +++ b/Core/build.xml @@ -8,9 +8,7 @@ - - - + diff --git a/Core/manifest.mf b/Core/manifest.mf index 10bd758bba..3a50c0d8a7 100644 --- a/Core/manifest.mf +++ b/Core/manifest.mf @@ -3,7 +3,7 @@ OpenIDE-Module: org.sleuthkit.autopsy.core/10 OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml OpenIDE-Module-Implementation-Version: 12 -OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help +OpenIDE-Module-Requires: org.openide.windows.WindowManager AutoUpdate-Show-In-Client: true AutoUpdate-Essential-Module: true OpenIDE-Module-Install: org/sleuthkit/autopsy/core/Installer.class diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 178e1bd134..84f8bba38a 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -24,15 +24,6 @@ - - org.netbeans.modules.javahelp - - - - 1 - 2.27.1 - - org.netbeans.modules.options.api diff --git a/KeywordSearch/nbproject/project.xml b/KeywordSearch/nbproject/project.xml index 74e14747a0..6a540e5835 100644 --- a/KeywordSearch/nbproject/project.xml +++ b/KeywordSearch/nbproject/project.xml @@ -15,15 +15,6 @@ 1.24.1 - - org.netbeans.modules.javahelp - - - - 1 - 2.22.1 - - org.netbeans.modules.options.api From 0871c52a0d944d5b6df43934cd3b09a425cd09b3 Mon Sep 17 00:00:00 2001 From: sidhesh Date: Fri, 13 Feb 2015 17:34:27 -0500 Subject: [PATCH 4/5] Fixed indentation --- .../corecomponents/OnlineHelpAction.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) mode change 100755 => 100644 Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java old mode 100755 new mode 100644 index 90625c73ad..f81fae5574 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java @@ -36,6 +36,7 @@ import org.openide.util.NbBundle.Messages; import java.util.logging.Level; import java.util.logging.Logger; + /** * Implements a hyperlink to the Online Documentation. */ @@ -59,23 +60,23 @@ public final class OnlineHelpAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO implement action body - try { - uri = new URI(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N - viewOnlineHelp(); - } catch (URISyntaxException ex) { - Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); + try { + uri = new URI(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N + viewOnlineHelp(); + } catch (URISyntaxException ex) { + Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); + } + uri = null; } - uri = null; - } - + /** - * Displays the Online Documentation in the system browser. - * If not available, displays it in the built-in OpenIDE HTML Browser. + * Displays the Online Documentation in the system browser. If not + * available, displays it in the built-in OpenIDE HTML Browser. */ private void viewOnlineHelp() { if (uri != null) { // Display URL in the SYstem browser - if(Desktop.isDesktopSupported()){ + if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(uri); @@ -83,17 +84,15 @@ public final class OnlineHelpAction implements ActionListener { // TODO Auto-generated catch block Logger.log(Level.SEVERE, "Unable to launch the system browser", ex); } - } - else { + } else { org.openide.awt.StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HTMLViewAction.class, "CTL_OpeningBrowser")); //NON-NLS try { HtmlBrowser.URLDisplayer.getDefault().showURL(uri.toURL()); - } - catch(MalformedURLException ex){ + } catch (MalformedURLException ex) { Logger.log(Level.SEVERE, "Unable to launch the built-in browser", ex); - } + } } - } + } } - + } From c4eb4d30a932b6a3a364f17173fac03ea10ac2f5 Mon Sep 17 00:00:00 2001 From: sidhesh Date: Fri, 13 Feb 2015 17:59:29 -0500 Subject: [PATCH 5/5] viewOnlineHelp() creates the URI object. --- .../autopsy/corecomponents/OnlineHelpAction.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java index f81fae5574..1e28c815a2 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/OnlineHelpAction.java @@ -60,13 +60,7 @@ public final class OnlineHelpAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO implement action body - try { - uri = new URI(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); // NOI18N - viewOnlineHelp(); - } catch (URISyntaxException ex) { - Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); - } - uri = null; + viewOnlineHelp(); } /** @@ -74,6 +68,11 @@ public final class OnlineHelpAction implements ActionListener { * available, displays it in the built-in OpenIDE HTML Browser. */ private void viewOnlineHelp() { + try { + uri = new URI(NbBundle.getMessage(OnlineHelpAction.class, "URL_ON_HELP")); + } catch (URISyntaxException ex) { + Logger.log(Level.SEVERE, "Unable to load Online Documentation", ex); + } if (uri != null) { // Display URL in the SYstem browser if (Desktop.isDesktopSupported()) {