19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Cursor;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
25 import java.util.concurrent.ExecutionException;
26 import java.util.logging.Level;
27 import javax.swing.JFileChooser;
28 import javax.swing.JOptionPane;
29 import javax.swing.SwingWorker;
30 import javax.swing.filechooser.FileFilter;
31 import javax.swing.filechooser.FileNameExtensionFilter;
32 import org.openide.util.HelpCtx;
33 import org.openide.util.NbBundle;
34 import org.openide.util.actions.CallableSystemAction;
35 import org.openide.util.lookup.ServiceProvider;
36 import org.openide.windows.WindowManager;
49 @ServiceProvider(service = CaseOpenAction.class)
50 public final class
CaseOpenAction extends CallableSystemAction implements ActionListener {
52 private static final long serialVersionUID = 1L;
53 private static final String PROP_BASECASE =
"LBL_BaseCase_PATH";
55 private final JFileChooser fileChooser =
new JFileChooser();
67 fileChooser.setDragEnabled(
false);
68 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
69 fileChooser.setMultiSelectionEnabled(
false);
70 fileChooser.setFileFilter(caseMetadataFileFilter);
84 String optionsDlgTitle = NbBundle.getMessage(
Case.class,
"CloseCaseWhileIngesting.Warning.title");
85 String optionsDlgMessage = NbBundle.getMessage(
Case.class,
"CloseCaseWhileIngesting.Warning");
91 int retval = fileChooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
92 if (retval == JFileChooser.APPROVE_OPTION) {
102 final String path = fileChooser.getSelectedFile().getPath();
103 String dirPath = fileChooser.getSelectedFile().getParent();
105 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
106 new SwingWorker<Void, Void>() {
109 protected Void doInBackground()
throws Exception {
115 protected void done() {
118 }
catch (InterruptedException | ExecutionException ex) {
120 logger.log(Level.SEVERE, String.format(
"Error opening case with metadata file path %s", path), ex);
121 JOptionPane.showMessageDialog(
122 WindowManager.getDefault().getMainWindow(),
123 ex.getCause().getMessage(),
124 NbBundle.getMessage(this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.title"),
125 JOptionPane.ERROR_MESSAGE);
129 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
139 actionPerformed(null);
144 return NbBundle.getMessage(
CaseOpenAction.class,
"CTL_OpenAction");
149 return HelpCtx.DEFAULT_HELP;
void actionPerformed(ActionEvent e)
static boolean checkAndConfirmProceed(String optionsDlgTitle, String optionsDlgMessage)
final FileFilter caseMetadataFileFilter
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
static void openAsCurrentCase(String caseMetadataFilePath)
static String getConfigSetting(String moduleName, String settingName)
static final String MAIN_SETTINGS
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()