mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Bug fixes for Case changes, etc.
This commit is contained in:
parent
efb48b4d5c
commit
ec108b0b06
@ -40,6 +40,7 @@ final public class ExitAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (IngestRunningCheck.checkAndConfirmProceed()) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Case.closeCurrentCase();
|
||||
@ -51,3 +52,4 @@ final public class ExitAction implements ActionListener {
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.actions;
|
||||
|
||||
import org.openide.DialogDescriptor;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
|
||||
/**
|
||||
* A helper for actions that checks to see if ingest is running. If it is,
|
||||
* prompts the user to confirm they want to proceed with whatever operation was
|
||||
* initiated (e.g., closing the case).
|
||||
*/
|
||||
public class IngestRunningCheck {
|
||||
|
||||
/**
|
||||
* Checks to see if ingest is running. If it is, prompts the user to confirm
|
||||
* they want to proceed with whatever operation was initiated (e.g., closing
|
||||
* the case).
|
||||
*
|
||||
* @return True to proceed, false otherwise.
|
||||
*/
|
||||
@Messages({
|
||||
"IngestRunningCheck.confirmationDialog.title=Ingest is Running",
|
||||
"IngestRunningCheck.confirmationDialog.message=Ingest is running, are you sure you want to proceed?"
|
||||
|
||||
})
|
||||
public static boolean checkAndConfirmProceed() {
|
||||
if (IngestManager.getInstance().isIngestRunning()) {
|
||||
NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(
|
||||
Bundle.IngestRunningCheck_confirmationDialog_message(),
|
||||
Bundle.IngestRunningCheck_confirmationDialog_title(),
|
||||
NotifyDescriptor.YES_NO_OPTION,
|
||||
NotifyDescriptor.WARNING_MESSAGE);
|
||||
descriptor.setValue(NotifyDescriptor.NO_OPTION);
|
||||
Object response = DialogDisplayer.getDefault().notify(descriptor);
|
||||
return (DialogDescriptor.YES_OPTION == response);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private contructor to prevent instantiation of a utility class.
|
||||
*/
|
||||
private IngestRunningCheck() {
|
||||
}
|
||||
|
||||
}
|
@ -43,7 +43,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
*
|
||||
* 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 = false)
|
||||
@ActionReference(path = "Menu/Tools", position = 1850, separatorBefore = 1849)
|
||||
@ActionID(id = "org.sleuthkit.autopsy.actions.OpenOutputFolderAction", category = "Help")
|
||||
public final class OpenOutputFolderAction extends CallableSystemAction {
|
||||
@ -51,6 +51,14 @@ public final class OpenOutputFolderAction extends CallableSystemAction {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = Logger.getLogger(OpenOutputFolderAction.class.getName());
|
||||
|
||||
public OpenOutputFolderAction() {
|
||||
/*
|
||||
* Initially disabled. The Case class enables this action when a case is
|
||||
* opened and disables it when a case is closed.
|
||||
*/
|
||||
this.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performAction() {
|
||||
File outputDir;
|
||||
|
@ -52,6 +52,8 @@ import org.sleuthkit.datamodel.Image;
|
||||
|
||||
/**
|
||||
* An action that invokes the Add Data Source wizard.
|
||||
*
|
||||
* This action should only be invoked in the event dispatch thread (EDT).
|
||||
*/
|
||||
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.casemodule.AddImageAction")
|
||||
@ActionRegistration(displayName = "#CTL_AddImage", lazy = false)
|
||||
@ -103,7 +105,11 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
}
|
||||
});
|
||||
|
||||
this.setEnabled(false); // disable this action class
|
||||
/*
|
||||
* Disable this action until a case is opened. Currently, the Case class
|
||||
* enables the action.
|
||||
*/
|
||||
this.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,6 +58,7 @@ import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.actions.OpenOutputFolderAction;
|
||||
import org.sleuthkit.autopsy.casemodule.CaseMetadata.CaseMetadataException;
|
||||
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceFailedEvent;
|
||||
@ -1279,6 +1280,7 @@ public class Case {
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(OpenTimelineAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(OpenOutputFolderAction.class).setEnabled(false);
|
||||
|
||||
/*
|
||||
* Add the case to the recent cases tracker that supplies a list
|
||||
@ -1325,6 +1327,7 @@ public class Case {
|
||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false);
|
||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false);
|
||||
CallableSystemAction.get(OpenTimelineAction.class).setEnabled(false);
|
||||
CallableSystemAction.get(OpenOutputFolderAction.class).setEnabled(false);
|
||||
|
||||
/*
|
||||
* Clear the notifications in the notfier component in the lower
|
||||
|
Loading…
x
Reference in New Issue
Block a user