Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
RecentItems.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 package org.sleuthkit.autopsy.casemodule;
21 
22 import java.awt.EventQueue;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.io.File;
26 import java.util.logging.Level;
27 import javax.swing.JOptionPane;
28 import javax.swing.JPanel;
29 import org.openide.util.NbBundle;
31 
36 class RecentItems implements ActionListener {
37 
38  String caseName;
39  String casePath;
40  private JPanel caller; // for error handling
41 
43  public RecentItems(String caseName, String casePath){
44  this.caseName = caseName;
45  this.casePath = casePath;
46  }
47 
53  @Override
54  public void actionPerformed(ActionEvent e) {
55  // check if the file exists
56  if(caseName.equals("") || casePath.equals("") || (!new File(casePath).exists())){
57  // throw an error here
58  JOptionPane.showMessageDialog(caller,
59  NbBundle.getMessage(this.getClass(), "RecentItems.openRecentCase.msgDlg.text",
60  caseName),
61  NbBundle.getMessage(this.getClass(), "RecentItems.openRecentCase.msgDlg.err"),
62  JOptionPane.ERROR_MESSAGE);
63  RecentCases.getInstance().removeRecentCase(caseName, casePath); // remove the recent case if it doesn't exist anymore
64 
65  //if case is not opened, open the start window
66  if (Case.isCaseOpen() == false) {
67  EventQueue.invokeLater(new Runnable() {
68 
69  @Override
70  public void run() {
71  StartupWindowProvider.getInstance().open();
72  }
73 
74  });
75 
76  }
77  }
78  else {
79  try {
80  Case.open(casePath); // open the case
81  } catch (CaseActionException ex) {
82  Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS
83  }
84  }
85  }
86 }
static Logger getLogger(String name)
Definition: Logger.java:131

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.