Bug fixes for Case changes, etc.

This commit is contained in:
Richard Cordovano 2017-01-24 12:23:19 -05:00
parent a5ecb62da9
commit efb48b4d5c
5 changed files with 22 additions and 10 deletions

View File

@ -36,8 +36,11 @@ import org.sleuthkit.autopsy.coreutils.Logger;
/**
* The action associated with the Help/Open Log Folder menu item. It opens a
* file explorer window for the log subdirectory for the currently open case, or
* the log subdirectory of the user directory if there is no current case.
* file explorer window for either the log subdirectory for the currently open
* case, or the log subdirectory of the user directory, if there is no current
* case.
*
* This action should only be invoked in the event dispatch thread (EDT).
*/
@ActionRegistration(displayName = "#CTL_OpenLogFolder", iconInMenu = true)
@ActionReference(path = "Menu/Help", position = 1750)
@ -51,11 +54,15 @@ public final class OpenLogFolderAction implements ActionListener {
File logDir;
if (Case.isCaseOpen()) {
try {
/*
* Open the log directory for the case.
*/
Case currentCase = Case.getCurrentCase();
logDir = new File(currentCase.getLogDirectoryPath());
} catch (IllegalStateException ex) {
/*
* The case
* There is no open case, open the application level log
* directory.
*/
logDir = new File(Places.getUserDirectory().getAbsolutePath() + File.separator + "var" + File.separator + "log");
}
@ -64,14 +71,14 @@ public final class OpenLogFolderAction implements ActionListener {
}
try {
if (logDir.exists() == false) {
logger.log(Level.SEVERE, String.format("The log subdirectory %s does not exist", logDir));
if (logDir.exists()) {
Desktop.getDesktop().open(logDir);
} else {
logger.log(Level.SEVERE, String.format("The log directory %s does not exist", logDir));
NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()),
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDescriptor);
} else {
Desktop.getDesktop().open(logDir);
}
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Could not open log directory %s", logDir), ex);

View File

@ -40,6 +40,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* case. If the case is a single-user case, this is the case directory. If the
* case is a multi-user case, this is a subdirectory of the case directory
* specific to the host machine.
*
* This action should only be invoked in the event dispatch thread (EDT).
*/
@ActionRegistration(displayName = "#CTL_OpenOutputFolder", iconInMenu = true, lazy = true)
@ActionReference(path = "Menu/Tools", position = 1850, separatorBefore = 1849)

View File

@ -32,6 +32,8 @@ import org.sleuthkit.autopsy.ingest.IngestProgressSnapshotDialog;
/**
* The action associated with the Help/Get Ingest Progress Snapshot menu item.
* It opens a the Ingest Progress Snapshot dialog.
*
* This action should only be invoked in the event dispatch thread (EDT).
*/
@ActionID(category = "Help", id = "org.sleuthkit.autopsy.actions.ShowIngestProgressSnapshotAction")
@ActionRegistration(displayName = "#CTL_ShowIngestProgressSnapshotAction", lazy = false)
@ -44,7 +46,7 @@ public final class ShowIngestProgressSnapshotAction extends CallableSystemAction
@Override
public void performAction() {
IngestProgressSnapshotDialog dialog = new IngestProgressSnapshotDialog();
new IngestProgressSnapshotDialog();
}
@Override

View File

@ -811,12 +811,11 @@ public class Case {
* thrown.
*/
logger.log(Level.INFO, "Closed case with metadata file path {0}", currentCase.getCaseMetadata().getFilePath()); //NON-NLS
Case closedCase = currentCase;
eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), currentCase, null));
currentCase = null;
if (RuntimeProperties.runningWithGUI()) {
updateGUIForCaseClosed();
}
eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), closedCase, null));
progressIndicator.finish(Bundle.Case_progressMessage_finshing());
if (RuntimeProperties.runningWithGUI()) {
SwingUtilities.invokeLater(() -> ((ModalDialogProgressIndicator) progressIndicator).setVisible(false));

View File

@ -46,6 +46,8 @@ import org.sleuthkit.autopsy.ingest.IngestManager;
* The action associated with the Case/Close Case menu item and the Close Case
* toolbar button. It closes the current case and pops up the start up window
* that allows a user to open another case.
*
* This action should only be invoked in the event dispatch thread (EDT).
*/
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.casemodule.CaseCloseAction")
@ActionRegistration(displayName = "#CTL_CaseCloseAct", lazy = false)