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;
44 public final class CaseCloseAction extends CallableSystemAction implements Presenter.Toolbar {
46 JButton toolbarButton =
new JButton();
52 putValue(
"iconBase",
"org/sleuthkit/autopsy/images/close-icon.png");
53 putValue(Action.NAME, NbBundle.getMessage(
CaseCloseAction.class,
"CTL_CaseCloseAct"));
72 String closeCurrentCase = NbBundle.getMessage(this.getClass(),
"CloseCaseWhileIngesting.Warning");
73 NotifyDescriptor descriptor =
new NotifyDescriptor.Confirmation(closeCurrentCase,
74 NbBundle.getMessage(
this.getClass(),
"CloseCaseWhileIngesting.Warning.title"),
75 NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE);
76 descriptor.setValue(NotifyDescriptor.NO_OPTION);
78 Object res = DialogDisplayer.getDefault().notify(descriptor);
79 if (res != null && res == DialogDescriptor.YES_OPTION) {
82 }
catch (Exception ex) {
83 Logger.
getLogger(NewCaseWizardAction.class.getName()).log(Level.WARNING,
"Error closing case.", ex);
93 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
94 new SwingWorker<Void, Void>() {
97 protected Void doInBackground()
throws Exception {
108 protected void done() {
109 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
140 return HelpCtx.DEFAULT_HELP;
150 ImageIcon icon =
new ImageIcon(getClass().getResource(
"btn_icon_close_case.png"));
151 toolbarButton.setIcon(icon);
152 toolbarButton.setText(this.
getName());
153 return toolbarButton;
163 super.setEnabled(value);
164 toolbarButton.setEnabled(value);
static synchronized IngestManager getInstance()
static boolean existsCurrentCase()
Component getToolbarPresenter()
boolean isIngestRunning()
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
void setEnabled(boolean value)
void actionPerformed(ActionEvent e)