Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
OpenLogFolderAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014-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 org.openide.DialogDisplayer;
28 import org.openide.NotifyDescriptor;
29 import org.openide.awt.ActionID;
30 import org.openide.awt.ActionReference;
31 import org.openide.awt.ActionRegistration;
32 import org.openide.modules.Places;
33 import org.openide.util.NbBundle;
36 
40 @ActionRegistration(
41  displayName = "#CTL_OpenLogFolder", iconInMenu = true)
42 @ActionReference(path = "Menu/Help", position = 1750)
43 @ActionID(id = "org.sleuthkit.autopsy.actions.OpenLogFolderAction", category = "Help")
44 public final class OpenLogFolderAction implements ActionListener {
45 
46  private static final Logger logger = Logger.getLogger(OpenLogFolderAction.class.getName());
47 
48  @Override
49  public void actionPerformed(ActionEvent e) {
50  try {
51  File logDir;
52  if (Case.isCaseOpen()) {
53  logDir = new File(Case.getCurrentCase().getLogDirectoryPath());
54  } else {
55  logDir = new File(Places.getUserDirectory().getAbsolutePath() + File.separator + "var" + File.separator + "log");
56  }
57  if (logDir.exists() == false) {
58  NotifyDescriptor d
59  = new NotifyDescriptor.Message(
60  NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()),
61  NotifyDescriptor.ERROR_MESSAGE);
62  DialogDisplayer.getDefault().notify(d);
63  } else {
64  Desktop.getDesktop().open(logDir);
65  }
66  } catch (IOException ex) {
67  logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "OpenLogFolder.CouldNotOpenLogFolder"), ex); //NON-NLS
68 
69  }
70  }
71 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:161

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jan 2 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.