Autopsy  4.0
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-16 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.io.IOException;
22 import java.util.logging.Level;
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;
35 
36 @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.timeline.Timeline")
37 @ActionRegistration(displayName = "#CTL_MakeTimeline", lazy = false)
38 @ActionReferences(value = {
39  @ActionReference(path = "Menu/Tools", position = 100)})
40 public class OpenTimelineAction extends CallableSystemAction {
41 
42  private static final Logger LOGGER = Logger.getLogger(OpenTimelineAction.class.getName());
43 
44  private static final boolean fxInited = Installer.isJavaFxInited();
45 
46  private static TimeLineController timeLineController = null;
47 
48  synchronized static void invalidateController() {
49  timeLineController = null;
50  }
51 
52  @Override
53  public boolean isEnabled() {
58  return Case.isCaseOpen() && fxInited;// && Case.getCurrentCase().hasData();
59  }
60 
61  @NbBundle.Messages({
62  "OpenTimelineAction.settingsErrorMessage=Failed to initialize timeline settings.",
63  "OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources."})
64  @Override
65  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
66  public void performAction() {
67  try {
68  Case currentCase = Case.getCurrentCase();
69  if (currentCase.hasData() == false) {
70  MessageNotifyUtil.Message.info(Bundle.OpenTimeLineAction_msgdlg_text());
71  LOGGER.log(Level.INFO, "Could not create timeline, there are no data sources.");// NON-NLS
72  return;
73  }
74  try {
75  if (timeLineController == null) {
76  timeLineController = new TimeLineController(currentCase);
77  } else if (timeLineController.getAutopsyCase() != currentCase) {
78  timeLineController.shutDownTimeLine();
79  timeLineController = new TimeLineController(currentCase);
80  }
81  timeLineController.openTimeLine();
82  } catch (IOException iOException) {
83  MessageNotifyUtil.Message.error(Bundle.OpenTimelineAction_settingsErrorMessage());
84  LOGGER.log(Level.SEVERE, "Failed to initialize per case timeline settings.", iOException);
85  }
86  } catch (IllegalStateException e) {
87  //there is no case... Do nothing.
88  }
89  }
90 
91  @Override
92  public String getName() {
93  return NbBundle.getMessage(OpenTimelineAction.class, "CTL_MakeTimeline");
94  }
95 
96  @Override
97  public HelpCtx getHelpCtx() {
98  return HelpCtx.DEFAULT_HELP;
99  }
100 
101  @Override
102  public boolean asynchronous() {
103  return false; // run on edt
104  }
105 }
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.