mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Invoke the addImage action after all of the case open proprty change listeners complete so that Cores are open
This commit is contained in:
parent
5f8a2581f2
commit
47b52ce1da
70
Case/src/org/sleuthkit/autopsy/casemodule/Case.java
Normal file → Executable file
70
Case/src/org/sleuthkit/autopsy/casemodule/Case.java
Normal file → Executable file
@ -38,6 +38,7 @@ import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.util.Lookup;
|
||||
@ -715,7 +716,7 @@ public class Case {
|
||||
* Call if there are no images in the case. Displays
|
||||
* a dialog offering to add one.
|
||||
*/
|
||||
private void noRootObjectsNotification() throws TskException {
|
||||
private static void noRootObjectsNotification() {
|
||||
NotifyDescriptor nd = new NotifyDescriptor(
|
||||
"This case contains no images. Would you like to add one?",
|
||||
"No images in case", NotifyDescriptor.YES_NO_OPTION,
|
||||
@ -776,48 +777,47 @@ public class Case {
|
||||
Object oldValue = evt.getOldValue();
|
||||
Object newValue = evt.getNewValue();
|
||||
|
||||
|
||||
if (changed.equals(Case.CASE_CURRENT_CASE)) {
|
||||
try {
|
||||
if (newValue != null) { // new case is open
|
||||
Case newCase = (Case) newValue;
|
||||
if (newValue != null) { // new case is open
|
||||
Case newCase = (Case) newValue;
|
||||
|
||||
// clear the temp folder when the case is created / opened
|
||||
Case.clearTempFolder();
|
||||
// clear the temp folder when the case is created / opened
|
||||
Case.clearTempFolder();
|
||||
|
||||
// enable these menus
|
||||
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
|
||||
|
||||
if (newCase.getRootObjectsCount() > 0) {
|
||||
// open all top components
|
||||
CoreComponentControl.openCoreWindows();
|
||||
} else {
|
||||
// close all top components
|
||||
CoreComponentControl.closeCoreWindows();
|
||||
// notify user
|
||||
newCase.noRootObjectsNotification();
|
||||
}
|
||||
} else { // case is closed
|
||||
// disable these menus
|
||||
CallableSystemAction.get(AddImageAction.class).setEnabled(false); // Add Image menu
|
||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(false); // Case Close menu
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false); // Case Properties menu
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false); // Delete Case menu
|
||||
// enable these menus
|
||||
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
|
||||
|
||||
if (newCase.getRootObjectsCount() > 0) {
|
||||
// open all top components
|
||||
CoreComponentControl.openCoreWindows();
|
||||
} else {
|
||||
// close all top components
|
||||
CoreComponentControl.closeCoreWindows();
|
||||
|
||||
Frame f = WindowManager.getDefault().getMainWindow();
|
||||
f.setTitle(Case.getAppName()); // set the window name to just application name
|
||||
// prompt user to add an image
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Case.noRootObjectsNotification();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (TskException ex) {
|
||||
Log.get(CaseListener.class).log(Level.WARNING, "Error handling change in current case.", ex);
|
||||
}
|
||||
}
|
||||
} else { // case is closed
|
||||
// disable these menus
|
||||
CallableSystemAction.get(AddImageAction.class).setEnabled(false); // Add Image menu
|
||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(false); // Case Close menu
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false); // Case Properties menu
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false); // Delete Case menu
|
||||
|
||||
// close all top components
|
||||
CoreComponentControl.closeCoreWindows();
|
||||
|
||||
Frame f = WindowManager.getDefault().getMainWindow();
|
||||
f.setTitle(Case.getAppName()); // set the window name to just application name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// changed in the case name
|
||||
if (changed.equals(Case.CASE_NAME)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user