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 * 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 * file explorer window for either the log subdirectory for the currently open
* the log subdirectory of the user directory if there is no current case. * 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) @ActionRegistration(displayName = "#CTL_OpenLogFolder", iconInMenu = true)
@ActionReference(path = "Menu/Help", position = 1750) @ActionReference(path = "Menu/Help", position = 1750)
@ -51,11 +54,15 @@ public final class OpenLogFolderAction implements ActionListener {
File logDir; File logDir;
if (Case.isCaseOpen()) { if (Case.isCaseOpen()) {
try { try {
/*
* Open the log directory for the case.
*/
Case currentCase = Case.getCurrentCase(); Case currentCase = Case.getCurrentCase();
logDir = new File(currentCase.getLogDirectoryPath()); logDir = new File(currentCase.getLogDirectoryPath());
} catch (IllegalStateException ex) { } 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"); logDir = new File(Places.getUserDirectory().getAbsolutePath() + File.separator + "var" + File.separator + "log");
} }
@ -64,14 +71,14 @@ public final class OpenLogFolderAction implements ActionListener {
} }
try { try {
if (logDir.exists() == false) { if (logDir.exists()) {
logger.log(Level.SEVERE, String.format("The log subdirectory %s does not exist", logDir)); Desktop.getDesktop().open(logDir);
} else {
logger.log(Level.SEVERE, String.format("The log directory %s does not exist", logDir));
NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message( NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()), NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()),
NotifyDescriptor.ERROR_MESSAGE); NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(notifyDescriptor); DialogDisplayer.getDefault().notify(notifyDescriptor);
} else {
Desktop.getDesktop().open(logDir);
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Could not open log directory %s", logDir), 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. 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 * case is a multi-user case, this is a subdirectory of the case directory
* specific to the host machine. * 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) @ActionRegistration(displayName = "#CTL_OpenOutputFolder", iconInMenu = true, lazy = true)
@ActionReference(path = "Menu/Tools", position = 1850, separatorBefore = 1849) @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. * The action associated with the Help/Get Ingest Progress Snapshot menu item.
* It opens a the Ingest Progress Snapshot dialog. * 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") @ActionID(category = "Help", id = "org.sleuthkit.autopsy.actions.ShowIngestProgressSnapshotAction")
@ActionRegistration(displayName = "#CTL_ShowIngestProgressSnapshotAction", lazy = false) @ActionRegistration(displayName = "#CTL_ShowIngestProgressSnapshotAction", lazy = false)
@ -44,7 +46,7 @@ public final class ShowIngestProgressSnapshotAction extends CallableSystemAction
@Override @Override
public void performAction() { public void performAction() {
IngestProgressSnapshotDialog dialog = new IngestProgressSnapshotDialog(); new IngestProgressSnapshotDialog();
} }
@Override @Override

View File

@ -811,12 +811,11 @@ public class Case {
* thrown. * thrown.
*/ */
logger.log(Level.INFO, "Closed case with metadata file path {0}", currentCase.getCaseMetadata().getFilePath()); //NON-NLS 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; currentCase = null;
if (RuntimeProperties.runningWithGUI()) { if (RuntimeProperties.runningWithGUI()) {
updateGUIForCaseClosed(); updateGUIForCaseClosed();
} }
eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), closedCase, null));
progressIndicator.finish(Bundle.Case_progressMessage_finshing()); progressIndicator.finish(Bundle.Case_progressMessage_finshing());
if (RuntimeProperties.runningWithGUI()) { if (RuntimeProperties.runningWithGUI()) {
SwingUtilities.invokeLater(() -> ((ModalDialogProgressIndicator) progressIndicator).setVisible(false)); 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 * 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 * toolbar button. It closes the current case and pops up the start up window
* that allows a user to open another case. * 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") @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.casemodule.CaseCloseAction")
@ActionRegistration(displayName = "#CTL_CaseCloseAct", lazy = false) @ActionRegistration(displayName = "#CTL_CaseCloseAct", lazy = false)