diff --git a/Case/src/org/sleuthkit/autopsy/casemodule/Case.java b/Case/src/org/sleuthkit/autopsy/casemodule/Case.java old mode 100644 new mode 100755 index e7d85c1761..74e41d2949 --- a/Case/src/org/sleuthkit/autopsy/casemodule/Case.java +++ b/Case/src/org/sleuthkit/autopsy/casemodule/Case.java @@ -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)) {