Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
OpenTimelineAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013 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.timeline;
20 
21 import java.util.logging.Level;
22 import javax.swing.JOptionPane;
23 import org.openide.awt.ActionID;
24 import org.openide.awt.ActionReference;
25 import org.openide.awt.ActionReferences;
26 import org.openide.awt.ActionRegistration;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.NbBundle;
29 import org.openide.util.actions.CallableSystemAction;
30 import org.openide.windows.WindowManager;
34 
35 @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.timeline.Timeline")
36 @ActionRegistration(displayName = "#CTL_MakeTimeline", lazy = false)
37 @ActionReferences(value = {
38  @ActionReference(path = "Menu/Tools", position = 100)})
39 public class OpenTimelineAction extends CallableSystemAction {
40 
41  private static final Logger LOGGER = Logger.getLogger(OpenTimelineAction.class.getName());
42 
43  private static final boolean fxInited = Installer.isJavaFxInited();
44 
45  synchronized static void invalidateController() {
46  timeLineController = null;
47  }
48 
49  private static TimeLineController timeLineController = null;
50 
51  public OpenTimelineAction() {
52  super();
53  }
54 
55  @Override
56  public boolean isEnabled() {
59  return Case.isCaseOpen() && fxInited;// && Case.getCurrentCase().hasData();
60  }
61 
62  @Override
63  public void performAction() {
64 
65  //check case
66  if (!Case.existsCurrentCase()) {
67  return;
68  }
69  final Case currentCase = Case.getCurrentCase();
70 
71  if (currentCase.hasData() == false) {
72  JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
73  NbBundle.getMessage(this.getClass(), "OpenTimeLineAction.msgdlg.text"));
74  LOGGER.log(Level.INFO, "Could not create timeline, there are no data sources.");// NON-NLS
75  return;
76  }
77  synchronized (OpenTimelineAction.class) {
78  if (timeLineController == null) {
79  timeLineController = new TimeLineController();
80  LOGGER.log(Level.WARNING, "Failed to get TimeLineController from lookup. Instantiating one directly.S");// NON-NLS
81  }
82  }
83  timeLineController.openTimeLine();
84  }
85 
86  @Override
87  public String getName() {
88  return NbBundle.getMessage(TimeLineTopComponent.class, "OpenTimelineAction.title");
89  }
90 
91  @Override
92  public HelpCtx getHelpCtx() {
93  return HelpCtx.DEFAULT_HELP;
94  }
95 
96  @Override
97  public boolean asynchronous() {
98  return false; // run on edt
99  }
100 }
static boolean existsCurrentCase()
Definition: Case.java:622
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.