Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
OpenOutputFolderAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2015 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 package org.sleuthkit.autopsy.actions;
20 
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.awt.Desktop;
24 import java.io.File;
25 import java.io.IOException;
26 import java.util.logging.Level;
27 import javax.swing.JOptionPane;
28 import org.openide.DialogDisplayer;
29 import org.openide.NotifyDescriptor;
30 import org.openide.awt.ActionID;
31 import org.openide.awt.ActionReference;
32 import org.openide.awt.ActionRegistration;
33 import org.openide.util.NbBundle;
36 
40 @ActionRegistration(
41  displayName = "#CTL_OpenOutputFolder", iconInMenu = true)
42 @ActionReference(path = "Menu/Help", position = 1850)
43 @ActionID(id = "org.sleuthkit.autopsy.actions.OpenOutputFolderAction", category = "Help")
44 public final class OpenOutputFolderAction implements ActionListener {
45 
46  private static final Logger logger = Logger.getLogger(OpenOutputFolderAction.class.getName());
47 
48  @Override
49  public void actionPerformed(ActionEvent e) {
50 
51  try {
52  File outputDir;
53  if (Case.isCaseOpen()) {
54  outputDir = new File(Case.getCurrentCase().getOutputDirectory());
55  if (outputDir.exists() == false) {
56  NotifyDescriptor d
57  = new NotifyDescriptor.Message(NbBundle.getMessage(this.getClass(),
58  "OpenOutputFolder.error1", outputDir.getAbsolutePath()),
59  NotifyDescriptor.ERROR_MESSAGE);
60  DialogDisplayer.getDefault().notify(d);
61  } else {
62  Desktop.getDesktop().open(outputDir);
63  }
64  } else {
65  JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), "OpenOutputFolder.noCaseOpen"));
66  }
67  } catch (IOException ex) {
68  logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "OpenOutputFolder.CouldNotOpenOutputFolder"), ex); //NON-NLS
69  }
70  }
71 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:166

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.