From adada499f0987aa1bb757c10a6baf4c24d5c7683 Mon Sep 17 00:00:00 2001 From: Tim McIver Date: Thu, 31 Jan 2013 17:43:42 -0500 Subject: [PATCH] Modified code to detect if files have been added to the database since the last time it ran and to regenerate timeline data when timeline is (re)started. Note that addition of files to the database is noticed by timeline only upon a restart (of timeline); timeline does not notice this while the timeline window is open. --- .../sleuthkit/autopsy/timeline/Simile2.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java index 9319b36026..b24d8b8477 100644 --- a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java @@ -136,6 +136,7 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, private String mactimeFileName; private List data; private boolean listeningToAddImage = false; + private long lastObjectId = -1; //Swing components and JavafX components don't play super well together //Swing components need to be initialized first, in the swing specific thread @@ -541,11 +542,24 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, return; } + if (jf != null && !jf.isVisible()) { + // change the lastObjectId to trigger a reparse of mactime data + ++lastObjectId; + return; + } + int answer = JOptionPane.showConfirmDialog(jf, "Timeline is out of date. Would you like to regenerate it?", "Select an option", JOptionPane.YES_NO_OPTION); if (answer != JOptionPane.YES_OPTION) { return; } + clearMactimeData(); + + // call performAction as if the user selected 'Make Timeline' from the menu + performAction(); + } + + private void clearMactimeData() { // get rid of the old data data = null; @@ -563,9 +577,6 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, currcase.removePropertyChangeListener(this); listeningToAddImage = false; } - - // call performAction as if the user selected 'Make Timeline' from the menu - performAction(); } /* @@ -950,6 +961,14 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, // initialize mactimeFileName mactimeFileName = Case.getCurrentCase().getName() + "-MACTIME.txt"; + + // see if data has been added to the database since the last + // time timeline ran + long objId = Case.getCurrentCase().getSleuthkitCase().getLastObjectId(); + if (objId != lastObjectId && lastObjectId != -1) { + clearMactimeData(); + } + lastObjectId = objId; customizeSwing(); customize();