Merge branch 'sleuthkit:develop' into develop

This commit is contained in:
Seb2lyon 2021-05-12 18:53:55 +02:00
commit ea32abf166

View File

@ -29,6 +29,7 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeSupport;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.InvalidPathException; import java.nio.file.InvalidPathException;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -1215,8 +1216,6 @@ public class Case {
* Update the GUI to to reflect the current case. * Update the GUI to to reflect the current case.
*/ */
private static void updateGUIForCaseOpened(Case newCurrentCase) { private static void updateGUIForCaseOpened(Case newCurrentCase) {
if (RuntimeProperties.runningWithGUI()) {
SwingUtilities.invokeLater(() -> {
/* /*
* If the case database was upgraded for a new schema and a * If the case database was upgraded for a new schema and a
* backup database was created, notify the user. * backup database was created, notify the user.
@ -1242,6 +1241,14 @@ public class Case {
String path = entry.getValue(); String path = entry.getValue();
boolean fileExists = (new File(path).isFile() || DriveUtils.driveExists(path)); boolean fileExists = (new File(path).isFile() || DriveUtils.driveExists(path));
if (!fileExists) { if (!fileExists) {
try {
// Using invokeAndWait means that the dialog will
// open on the EDT but this thread will wait for an
// answer. Using invokeLater would cause this loop to
// end before all of the dialogs appeared.
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
int response = JOptionPane.showConfirmDialog( int response = JOptionPane.showConfirmDialog(
mainFrame, mainFrame,
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", path), NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", path),
@ -1254,6 +1261,12 @@ public class Case {
} }
} }
});
} catch (InterruptedException | InvocationTargetException ex) {
logger.log(Level.SEVERE, "Failed to show missing image confirmation dialog", ex); //NON-NLS
}
}
} }
/* /*
@ -1277,7 +1290,9 @@ public class Case {
* open/create case dialog. * open/create case dialog.
*/ */
RecentCases.getInstance().addRecentCase(newCurrentCase.getDisplayName(), newCurrentCase.getMetadata().getFilePath().toString()); RecentCases.getInstance().addRecentCase(newCurrentCase.getDisplayName(), newCurrentCase.getMetadata().getFilePath().toString());
final boolean hasData = newCurrentCase.hasData();
SwingUtilities.invokeLater(() -> {
/* /*
* Open the top components (windows within the main application * Open the top components (windows within the main application
* window). * window).
@ -1286,7 +1301,7 @@ public class Case {
* opened via the DirectoryTreeTopComponent 'propertyChange()' * opened via the DirectoryTreeTopComponent 'propertyChange()'
* method on a DATA_SOURCE_ADDED event. * method on a DATA_SOURCE_ADDED event.
*/ */
if (newCurrentCase.hasData()) { if (hasData) {
CoreComponentControl.openCoreWindows(); CoreComponentControl.openCoreWindows();
} else { } else {
//ensure that the DirectoryTreeTopComponent is open so that it's listener can open the core windows including making it visible. //ensure that the DirectoryTreeTopComponent is open so that it's listener can open the core windows including making it visible.
@ -1301,7 +1316,6 @@ public class Case {
mainFrame.setTitle(newCurrentCase.getDisplayName() + " - " + getNameForTitle()); mainFrame.setTitle(newCurrentCase.getDisplayName() + " - " + getNameForTitle());
}); });
} }
}
/* /*
* Update the GUI to to reflect the lack of a current case. * Update the GUI to to reflect the lack of a current case.