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.
This commit is contained in:
Tim McIver 2013-01-31 17:43:42 -05:00
parent 5810f0a36c
commit adada499f0

View File

@ -136,6 +136,7 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
private String mactimeFileName; private String mactimeFileName;
private List<YearEpoch> data; private List<YearEpoch> data;
private boolean listeningToAddImage = false; private boolean listeningToAddImage = false;
private long lastObjectId = -1;
//Swing components and JavafX components don't play super well together //Swing components and JavafX components don't play super well together
//Swing components need to be initialized first, in the swing specific thread //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; 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); 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) { if (answer != JOptionPane.YES_OPTION) {
return; return;
} }
clearMactimeData();
// call performAction as if the user selected 'Make Timeline' from the menu
performAction();
}
private void clearMactimeData() {
// get rid of the old data // get rid of the old data
data = null; data = null;
@ -563,9 +577,6 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
currcase.removePropertyChangeListener(this); currcase.removePropertyChangeListener(this);
listeningToAddImage = false; listeningToAddImage = false;
} }
// call performAction as if the user selected 'Make Timeline' from the menu
performAction();
} }
/* /*
@ -951,6 +962,14 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
// initialize mactimeFileName // initialize mactimeFileName
mactimeFileName = Case.getCurrentCase().getName() + "-MACTIME.txt"; 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(); customizeSwing();
customize(); customize();
} }