mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
add startup window after error when recent case could not open
This commit is contained in:
parent
2e4e453ae6
commit
3f408e9e34
@ -16,11 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Event;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
@ -31,8 +31,8 @@ import javax.swing.table.AbstractTableModel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
/**
|
||||
* Panel show from the splash dialog that shows recent cases and allows them
|
||||
* to be opened.
|
||||
* Panel show from the splash dialog that shows recent cases and allows them to
|
||||
* be opened.
|
||||
*/
|
||||
class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
|
||||
@ -73,10 +73,10 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@ -185,8 +185,7 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
try {
|
||||
StartupWindow.getInstance().close();
|
||||
CueBannerPanel.closeOpenRecentCasesWindow();
|
||||
}
|
||||
catch(Exception ex){
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex);
|
||||
}
|
||||
// Open the recent cases
|
||||
@ -194,6 +193,9 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
if (caseName.equals("") || casePath.equals("") || (!new File(casePath).exists())) {
|
||||
JOptionPane.showMessageDialog(null, "Error: Case " + caseName + " doesn't exist.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
RecentCases.getInstance().removeRecentCase(caseName, casePath); // remove the recent case if it doesn't exist anymore
|
||||
|
||||
StartupWindow.getInstance().open();
|
||||
|
||||
} else {
|
||||
Case.open(casePath); // open the case
|
||||
}
|
||||
@ -202,7 +204,6 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JTable imagesTable;
|
||||
@ -287,11 +288,10 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
||||
|
||||
private String shortenPath(String path) {
|
||||
if (path.length() > 50) {
|
||||
path = path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) + "..." +
|
||||
path.substring((path.length() - 20) + path.substring(path.length() - 20).indexOf(File.separator));
|
||||
path = path.substring(0, 10 + path.substring(10).indexOf(File.separator) + 1) + "..."
|
||||
+ path.substring((path.length() - 20) + path.substring(path.length() - 20).indexOf(File.separator));
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,16 @@ class RecentItems implements ActionListener {
|
||||
// check if the file exists
|
||||
if(caseName.equals("") || casePath.equals("") || (!new File(casePath).exists())){
|
||||
// throw an error here
|
||||
JOptionPane.showMessageDialog(caller, "Error: Case doesn't exist.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(caller, "Error: Case " + caseName + " doesn't exist.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
RecentCases.getInstance().removeRecentCase(caseName, casePath); // remove the recent case if it doesn't exist anymore
|
||||
|
||||
StartupWindow.getInstance().open();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
Case.open(casePath); // open the case
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case.", ex);
|
||||
} catch (CaseActionException ex) {
|
||||
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user