From 472b002ec5d94cec9785e97023b893632ca7d435 Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Wed, 14 Feb 2018 15:18:27 -0500 Subject: [PATCH 1/7] disabled timeline functionality for linux --- .../autopsy/timeline/OpenTimelineAction.java | 8 ++++++-- .../autopsy/timeline/PromptDialogManager.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java index 4d81571db0..651f8d9029 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java @@ -36,6 +36,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -83,7 +84,7 @@ public final class OpenTimelineAction extends CallableSystemAction { * disabled that check because if it is executed while a data source is * being added, it blocks the edt. We still do that in ImageGallery. */ - return super.isEnabled() && Case.isCaseOpen() && Installer.isJavaFxInited(); + return PlatformUtil.isWindowsOS() && super.isEnabled() && Case.isCaseOpen() && Installer.isJavaFxInited(); } @Override @@ -97,7 +98,10 @@ public final class OpenTimelineAction extends CallableSystemAction { } } setEnabled(false); - } else { + } else if(!isEnabled()){ + Platform.runLater(PromptDialogManager::showLinuxTimelineMessage); + setEnabled(false); + }else{ showTimeline(); } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java index a216c9366a..8229d00a64 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java @@ -222,5 +222,19 @@ public final class PromptDialogManager { dialog.setHeaderText(Bundle.PromptDialogManager_showTooManyFiles_headerText()); dialog.showAndWait(); } + + @NbBundle.Messages({ + "PromptDialogManager.showLinuxTimelineMessage.contextText=" + + "Timeline functionality is not available for linux right now." + + "Timeline will be disabled. ", + "PromptDialogManager.showLinuxTimelineMessage.headerText="}) + static void showLinuxTimelineMessage(){ + Alert dialog = new Alert(Alert.AlertType.INFORMATION, Bundle.PromptDialogManager_showLinuxTimelineMessage_contextText(),ButtonType.OK); + dialog.initModality(Modality.APPLICATION_MODAL); + dialog.setTitle(Bundle.Timeline_dialogs_title()); + setDialogIcons(dialog); + dialog.setHeaderText(Bundle.PromptDialogManager_showLinuxTimelineMessage_headerText()); + dialog.showAndWait(); + } } From aaf39427cefa3153404003b6e0d12b11e802ad87 Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Wed, 14 Feb 2018 16:55:07 -0500 Subject: [PATCH 2/7] modified lookandfeel to make timeline work on autopsy-linux --- .../autopsy/corecomponents/Installer.java | 12 ++++++++++++ .../autopsy/timeline/OpenTimelineAction.java | 8 ++------ .../autopsy/timeline/PromptDialogManager.java | 14 -------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index c908f3b35d..4867ae70a9 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -28,6 +28,7 @@ import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.UnsupportedLookAndFeelException; import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI; import org.openide.modules.ModuleInstall; +import org.openide.util.Exceptions; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.StartupWindowProvider; import org.sleuthkit.autopsy.coreutils.Logger; @@ -72,6 +73,8 @@ public class Installer extends ModuleInstall { private void setLookAndFeel() { if (System.getProperty("os.name").toLowerCase().contains("mac")) { //NON-NLS setOSXLookAndFeel(); + }else if (System.getProperty("os.name").toLowerCase().contains("nux")){ + setUnixLookAndFeel(); } } @@ -111,4 +114,13 @@ public class Installer extends ModuleInstall { UIManager.put(entry.getKey(), entry.getValue()); }); } + + private void setUnixLookAndFeel(){ + try { + //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { + Exceptions.printStackTrace(ex); + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java index 651f8d9029..4d81571db0 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java @@ -36,7 +36,6 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; -import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -84,7 +83,7 @@ public final class OpenTimelineAction extends CallableSystemAction { * disabled that check because if it is executed while a data source is * being added, it blocks the edt. We still do that in ImageGallery. */ - return PlatformUtil.isWindowsOS() && super.isEnabled() && Case.isCaseOpen() && Installer.isJavaFxInited(); + return super.isEnabled() && Case.isCaseOpen() && Installer.isJavaFxInited(); } @Override @@ -98,10 +97,7 @@ public final class OpenTimelineAction extends CallableSystemAction { } } setEnabled(false); - } else if(!isEnabled()){ - Platform.runLater(PromptDialogManager::showLinuxTimelineMessage); - setEnabled(false); - }else{ + } else { showTimeline(); } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java index 8229d00a64..a216c9366a 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java @@ -222,19 +222,5 @@ public final class PromptDialogManager { dialog.setHeaderText(Bundle.PromptDialogManager_showTooManyFiles_headerText()); dialog.showAndWait(); } - - @NbBundle.Messages({ - "PromptDialogManager.showLinuxTimelineMessage.contextText=" - + "Timeline functionality is not available for linux right now." - + "Timeline will be disabled. ", - "PromptDialogManager.showLinuxTimelineMessage.headerText="}) - static void showLinuxTimelineMessage(){ - Alert dialog = new Alert(Alert.AlertType.INFORMATION, Bundle.PromptDialogManager_showLinuxTimelineMessage_contextText(),ButtonType.OK); - dialog.initModality(Modality.APPLICATION_MODAL); - dialog.setTitle(Bundle.Timeline_dialogs_title()); - setDialogIcons(dialog); - dialog.setHeaderText(Bundle.PromptDialogManager_showLinuxTimelineMessage_headerText()); - dialog.showAndWait(); - } } From 0ccc9e69a2685f66f046a26de7c2a7de09446278 Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Thu, 15 Feb 2018 10:26:22 -0500 Subject: [PATCH 3/7] setLinuxlookandfeel to crossplatform LAF to make timeline work and disable timeline for native LAF --- .../autopsy/corecomponents/Installer.java | 10 ++++++++-- .../autopsy/timeline/OpenTimelineAction.java | 6 +++++- .../autopsy/timeline/PromptDialogManager.java | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index 4867ae70a9..092fd70641 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -41,6 +41,7 @@ public class Installer extends ModuleInstall { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(Installer.class.getName()); private static Installer instance; + public static boolean enableTimeline = true; public synchronized static Installer getDefault() { if (null == instance) { @@ -117,10 +118,15 @@ public class Installer extends ModuleInstall { private void setUnixLookAndFeel(){ try { - //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error setting crossplatform look-and-feel, setting default look-and-feel",ex); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + enableTimeline=false; + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex1) { + Exceptions.printStackTrace(ex1); + } } } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java index 4d81571db0..e19b91575b 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java @@ -34,6 +34,7 @@ import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.Installer; +import static org.sleuthkit.autopsy.corecomponents.Installer.enableTimeline; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.ThreadConfined; @@ -97,7 +98,10 @@ public final class OpenTimelineAction extends CallableSystemAction { } } setEnabled(false); - } else { + }else if(!enableTimeline) { + Platform.runLater(PromptDialogManager::showTimeLineDisabledMessage); + setEnabled(false); + }else { showTimeline(); } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java index a216c9366a..a379fc7d8d 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/PromptDialogManager.java @@ -222,5 +222,20 @@ public final class PromptDialogManager { dialog.setHeaderText(Bundle.PromptDialogManager_showTooManyFiles_headerText()); dialog.showAndWait(); } + + @NbBundle.Messages({ + "PromptDialogManager.showTimeLineDisabledMessage.contentText=" + + "Timeline functionality is not available for Linux yet." + + " Timeline will be disabled. ", + "PromptDialogManager.showTimeLineDisabledMessage.headerText="}) + static void showTimeLineDisabledMessage() { + Alert dialog = new Alert(Alert.AlertType.INFORMATION, + Bundle.PromptDialogManager_showTimeLineDisabledMessage_contentText(), ButtonType.OK); + dialog.initModality(Modality.APPLICATION_MODAL); + dialog.setTitle(Bundle.Timeline_dialogs_title()); + setDialogIcons(dialog); + dialog.setHeaderText(Bundle.PromptDialogManager_showTimeLineDisabledMessage_headerText()); + dialog.showAndWait(); + } } From e3b05a836ed99b4b2eaadf8ddd7a5906815b0fa2 Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Thu, 15 Feb 2018 10:30:08 -0500 Subject: [PATCH 4/7] setLinuxlookandfeel to crossplatform LAF to make timeline work and disable timeline for native LAF --- Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index 092fd70641..4588fe40e2 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -28,7 +28,6 @@ import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.UnsupportedLookAndFeelException; import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI; import org.openide.modules.ModuleInstall; -import org.openide.util.Exceptions; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.StartupWindowProvider; import org.sleuthkit.autopsy.coreutils.Logger; @@ -125,7 +124,7 @@ public class Installer extends ModuleInstall { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); enableTimeline=false; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex1) { - Exceptions.printStackTrace(ex1); + logger.log(Level.WARNING, "Error setting native look-and-feel",ex1); } } } From d135eca507f4b61cf101de50ead1ae27b3a18e0b Mon Sep 17 00:00:00 2001 From: Raman Date: Fri, 16 Feb 2018 08:38:16 -0500 Subject: [PATCH 5/7] Disabled EasyPMD rule: GuardLogStatementJavaUtil --- ruleset.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruleset.xml b/ruleset.xml index 558f99fc38..17e957e8e2 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -185,7 +185,8 @@ - + From 8a1d4abcdc9370b09b1da3cf41d9e54f5e2e188b Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Fri, 16 Feb 2018 09:41:21 -0500 Subject: [PATCH 6/7] added enable enable_timeline settings in a propert file --- .../autopsy/corecomponents/Installer.java | 22 ++++++++++++------- .../autopsy/timeline/OpenTimelineAction.java | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index 4588fe40e2..b7817b1490 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -31,6 +31,7 @@ import org.openide.modules.ModuleInstall; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.StartupWindowProvider; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.ModuleSettings; /** * Manages this module's life cycle. Opens the startup dialog during startup. @@ -40,7 +41,6 @@ public class Installer extends ModuleInstall { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(Installer.class.getName()); private static Installer instance; - public static boolean enableTimeline = true; public synchronized static Installer getDefault() { if (null == instance) { @@ -115,17 +115,23 @@ public class Installer extends ModuleInstall { }); } + private void setModuleSettings(String value) { + if (ModuleSettings.configExists("timeline")) { + ModuleSettings.setConfigSetting("timeline", "enable_timeline", value); + } else { + ModuleSettings.makeConfigFile("timeline"); + ModuleSettings.setConfigSetting("timeline", "enable_timeline", value); + } + } + private void setUnixLookAndFeel(){ try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + UIManager.put("swing.boldMetal", Boolean.FALSE); + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + setModuleSettings("true"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(Level.WARNING, "Error setting crossplatform look-and-feel, setting default look-and-feel",ex); - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - enableTimeline=false; - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex1) { - logger.log(Level.WARNING, "Error setting native look-and-feel",ex1); - } + setModuleSettings("false"); } } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java index e19b91575b..aca5c4e7f7 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/OpenTimelineAction.java @@ -34,9 +34,9 @@ import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.Installer; -import static org.sleuthkit.autopsy.corecomponents.Installer.enableTimeline; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; +import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -98,7 +98,7 @@ public final class OpenTimelineAction extends CallableSystemAction { } } setEnabled(false); - }else if(!enableTimeline) { + }else if("false".equals(ModuleSettings.getConfigSetting("timeline", "enable_timeline"))) { Platform.runLater(PromptDialogManager::showTimeLineDisabledMessage); setEnabled(false); }else { From df56203f53c506201a7e1ea2123c8cc51f355464 Mon Sep 17 00:00:00 2001 From: rishwanth1995 Date: Fri, 16 Feb 2018 09:54:20 -0500 Subject: [PATCH 7/7] added enable enable_timeline settings in a propert file --- Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java index b7817b1490..0ecfec0b30 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Installer.java @@ -127,7 +127,7 @@ public class Installer extends ModuleInstall { private void setUnixLookAndFeel(){ try { UIManager.put("swing.boldMetal", Boolean.FALSE); - UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); setModuleSettings("true"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(Level.WARNING, "Error setting crossplatform look-and-feel, setting default look-and-feel",ex);