Autopsy  3.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 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 org.openide.DialogDisplayer;
27 import org.openide.NotifyDescriptor;
28 import org.openide.awt.ActionID;
29 import org.openide.awt.ActionReference;
30 import org.openide.awt.ActionRegistration;
31 import org.openide.modules.Places;
32 import org.openide.util.Exceptions;
33 import org.openide.util.NbBundle;
35 
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  @Override
47  public void actionPerformed(ActionEvent e) {
48  try {
49  File logDir;
50  if (Case.isCaseOpen()) {
51  logDir = new File(Case.getCurrentCase().getLogDirectoryPath());
52  }
53  else {
54  logDir = new File(Places.getUserDirectory().getAbsolutePath() + File.separator + "var" + File.separator + "log");
55  }
56  if (logDir.exists() == false) {
57  NotifyDescriptor d =
58  new NotifyDescriptor.Message(
59  NbBundle.getMessage(this.getClass(), "OpenLogFolder.error1", logDir.getAbsolutePath()),
60  NotifyDescriptor.ERROR_MESSAGE);
61  DialogDisplayer.getDefault().notify(d);
62  } else {
63  Desktop.getDesktop().open(logDir);
64  }
65  } catch (IOException ex) {
66  Exceptions.printStackTrace(ex);
67  }
68  }
69 }

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.