19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Component;
22 import java.awt.event.ActionEvent;
23 import javax.swing.Action;
24 import javax.swing.ImageIcon;
25 import javax.swing.JButton;
26 import javax.swing.SwingWorker;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.NbBundle;
29 import org.openide.util.actions.CallableSystemAction;
30 import org.openide.util.actions.Presenter;
33 import java.util.logging.Level;
34 import org.openide.DialogDescriptor;
35 import org.openide.DialogDisplayer;
36 import org.openide.NotifyDescriptor;
37 import org.openide.windows.WindowManager;
38 import java.awt.Cursor;
39 import org.openide.awt.ActionID;
40 import org.openide.awt.ActionReference;
41 import org.openide.awt.ActionReferences;
42 import org.openide.awt.ActionRegistration;
48 @ActionID(category =
"Tools",
id =
"org.sleuthkit.autopsy.casemodule.CaseCloseAction")
49 @ActionRegistration(displayName =
"#CTL_CaseCloseAct", lazy =
false)
50 @ActionReferences(value = {
51 @ActionReference(path =
"Toolbars/Case", position = 104)})
52 public final class CaseCloseAction extends CallableSystemAction implements Presenter.Toolbar {
54 JButton toolbarButton =
new JButton();
60 putValue(
"iconBase",
"org/sleuthkit/autopsy/images/close-icon.png");
61 putValue(Action.NAME, NbBundle.getMessage(
CaseCloseAction.class,
"CTL_CaseCloseAct"));
66 this.setEnabled(
false);
80 String closeCurrentCase = NbBundle.getMessage(this.getClass(),
"CloseCaseWhileIngesting.Warning");
81 NotifyDescriptor descriptor =
new NotifyDescriptor.Confirmation(closeCurrentCase,
82 NbBundle.getMessage(
this.getClass(),
"CloseCaseWhileIngesting.Warning.title"),
83 NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE);
84 descriptor.setValue(NotifyDescriptor.NO_OPTION);
86 Object res = DialogDisplayer.getDefault().notify(descriptor);
87 if (res != null && res == DialogDescriptor.YES_OPTION) {
90 }
catch (Exception ex) {
91 Logger.
getLogger(NewCaseWizardAction.class.getName()).log(Level.WARNING,
"Error closing case.", ex);
101 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
102 new SwingWorker<Void, Void>() {
105 protected Void doInBackground()
throws Exception {
116 protected void done() {
117 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
148 return HelpCtx.DEFAULT_HELP;
158 ImageIcon icon =
new ImageIcon(getClass().getResource(
"btn_icon_close_case.png"));
159 toolbarButton.setIcon(icon);
160 toolbarButton.setText(this.getName());
161 return toolbarButton;
171 super.setEnabled(value);
172 toolbarButton.setEnabled(value);
static synchronized IngestManager getInstance()
Component getToolbarPresenter()
boolean isIngestRunning()
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
void setEnabled(boolean value)
static boolean isCaseOpen()
void actionPerformed(ActionEvent e)