19 package org.sleuthkit.autopsy.casemodule;
 
   21 import java.awt.Component;
 
   22 import java.awt.Cursor;
 
   23 import java.awt.event.ActionEvent;
 
   24 import java.util.concurrent.ExecutionException;
 
   25 import java.util.logging.Level;
 
   26 import javax.swing.Action;
 
   27 import javax.swing.ImageIcon;
 
   28 import javax.swing.JButton;
 
   29 import javax.swing.SwingWorker;
 
   30 import org.openide.awt.ActionID;
 
   31 import org.openide.awt.ActionReference;
 
   32 import org.openide.awt.ActionReferences;
 
   33 import org.openide.awt.ActionRegistration;
 
   34 import org.openide.util.HelpCtx;
 
   35 import org.openide.util.NbBundle;
 
   36 import org.openide.util.actions.CallableSystemAction;
 
   37 import org.openide.util.actions.Presenter;
 
   38 import org.openide.windows.WindowManager;
 
   50 @ActionID(category = 
"Tools", 
id = 
"org.sleuthkit.autopsy.casemodule.CaseCloseAction")
 
   51 @ActionRegistration(displayName = 
"#CTL_CaseCloseAct", lazy = 
false)
 
   52 @ActionReferences(value = {
 
   53     @ActionReference(path = 
"Toolbars/Case", position = 107)})
 
   54 public final class CaseCloseAction extends CallableSystemAction implements Presenter.Toolbar {
 
   56     private static final long serialVersionUID = 1L;
 
   58     private final JButton toolbarButton = 
new JButton();
 
   65         putValue(
"iconBase", 
"org/sleuthkit/autopsy/images/close-icon.png"); 
 
   66         putValue(Action.NAME, NbBundle.getMessage(
CaseCloseAction.class, 
"CTL_CaseCloseAct")); 
 
   68         this.setEnabled(
false);
 
   78         String optionsDlgTitle = NbBundle.getMessage(
Case.class, 
"CloseCaseWhileIngesting.Warning.title");
 
   79         String optionsDlgMessage = NbBundle.getMessage(
Case.class, 
"CloseCaseWhileIngesting.Warning");
 
   81             WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
   82             new SwingWorker<Void, Void>() {
 
   85                 protected Void doInBackground() 
throws Exception {
 
   91                 protected void done() {
 
   94                     } 
catch (InterruptedException ex) {
 
   95                         logger.log(Level.SEVERE, 
"Unexpected interrupt closing the current case", ex);
 
   96                     } 
catch (ExecutionException ex) {
 
   97                         logger.log(Level.SEVERE, 
"Error closing the current case", ex);
 
  100                     WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 
  112         actionPerformed(null);
 
  132         return HelpCtx.DEFAULT_HELP;
 
  142         ImageIcon icon = 
new ImageIcon(getClass().getResource(
"btn_icon_close_case.png")); 
 
  143         toolbarButton.setIcon(icon);
 
  144         toolbarButton.setText(this.getName());
 
  145         return toolbarButton;
 
  155         super.setEnabled(value);
 
  156         toolbarButton.setEnabled(value);
 
static void closeCurrentCase()
Component getToolbarPresenter()
static boolean checkAndConfirmProceed(String optionsDlgTitle, String optionsDlgMessage)
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
void setEnabled(boolean value)
void actionPerformed(ActionEvent e)
static void error(String message)