60public final class CaseOpenAction extends CallableSystemAction implements ActionListener {
63 private static final String
DISPLAY_NAME = Bundle.CTL_CaseOpenAction();
86 void openCaseSelectionWindow() {
88 fileChooser.setDragEnabled(
false);
89 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
90 fileChooser.setMultiSelectionEnabled(
false);
101 OpenMultiUserCaseDialog multiUserCaseDialog = OpenMultiUserCaseDialog.getInstance();
102 multiUserCaseDialog.setAlwaysOnTop(
false);
103 String optionsDlgTitle = NbBundle.getMessage(Case.class,
"CloseCaseWhileIngesting.Warning.title");
104 String optionsDlgMessage = NbBundle.getMessage(Case.class,
"CloseCaseWhileIngesting.Warning");
105 if (IngestRunningCheck.checkAndConfirmProceed(optionsDlgTitle, optionsDlgMessage)) {
114 int retval = fileChooser.showOpenDialog(multiUserCaseDialog.isVisible()
115 ? multiUserCaseDialog : (Component) StartupWindowProvider.getInstance().getStartupWindow());
116 if (retval == JFileChooser.APPROVE_OPTION) {
120 StartupWindowProvider.getInstance().close();
125 multiUserCaseDialog.setVisible(
false);
131 final String path = fileChooser.getSelectedFile().getPath();
132 String dirPath = fileChooser.getSelectedFile().getParent();
133 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS,
PROP_BASECASE, dirPath.substring(0, dirPath.lastIndexOf(File.separator)));
134 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
135 new SwingWorker<Void, Void>() {
138 protected Void doInBackground() throws Exception {
139 Case.openAsCurrentCase(path);
144 protected void done() {
147 }
catch (InterruptedException | ExecutionException ex) {
148 if (ex instanceof InterruptedException || (
null != ex.getCause() && !(ex.getCause() instanceof CaseActionCancelledException))) {
149 LOGGER.log(Level.SEVERE, String.format(
"Error opening case with metadata file path %s", path), ex);
150 JOptionPane.showMessageDialog(
151 WindowManager.getDefault().getMainWindow(),
152 ex.getCause().getMessage(),
153 NbBundle.getMessage(
this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.title"),
154 JOptionPane.ERROR_MESSAGE);
156 StartupWindowProvider.getInstance().open();
158 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
175 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
177 OpenMultiUserCaseDialog multiUserCaseWindow = OpenMultiUserCaseDialog.getInstance();
178 multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
180 multiUserCaseWindow.setAlwaysOnTop(
true);
181 multiUserCaseWindow.setVisible(
true);
183 WindowManager.getDefault().getMainWindow().setCursor(
null);
185 openCaseSelectionWindow();
201 return HelpCtx.DEFAULT_HELP;