19 package org.sleuthkit.autopsy.timeline.explorernodes;
21 import java.lang.reflect.InvocationTargetException;
22 import java.text.MessageFormat;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.HashSet;
27 import java.util.List;
28 import java.util.logging.Level;
29 import javax.annotation.Nonnull;
30 import javax.swing.Action;
31 import org.joda.time.DateTime;
32 import org.joda.time.DateTimeZone;
33 import org.openide.nodes.Children;
34 import org.openide.nodes.PropertySupport;
35 import org.openide.nodes.Sheet;
36 import org.openide.util.NbBundle;
37 import org.openide.util.Utilities;
38 import org.openide.util.lookup.Lookups;
67 private final TimelineEvent
event;
78 EventNode(@Nonnull TimelineEvent event, @Nonnull Content file, @Nonnull BlackboardArtifact artifact) {
79 super(Children.LEAF, Lookups.fixed(event, file, artifact));
81 TimelineEventType evenType =
event.getEventType();
91 EventNode(@Nonnull TimelineEvent event, @Nonnull Content file) {
92 super(Children.LEAF, Lookups.fixed(event, file));
94 TimelineEventType evenType =
event.getEventType();
100 "NodeProperty.displayName.icon=Icon",
101 "NodeProperty.displayName.description=Description",
102 "NodeProperty.displayName.eventType=Event Type",
103 "NodeProperty.displayName.known=Known",
104 "NodeProperty.displayName.dateTime=Date/Time"})
106 Sheet sheet = super.createSheet();
107 Sheet.Set properties = sheet.get(Sheet.PROPERTIES);
108 if (properties == null) {
109 properties = Sheet.createPropertiesSet();
110 sheet.put(properties);
113 properties.put(
new NodeProperty<>(
"icon", Bundle.NodeProperty_displayName_icon(),
"icon",
true));
115 properties.put(
new NodeProperty<>(
"description", Bundle.NodeProperty_displayName_description(),
"description",
event.getFullDescription()));
116 properties.put(
new NodeProperty<>(
"eventType", Bundle.NodeProperty_displayName_eventType(),
"event type",
event.getEventType().getDisplayName()));
134 "EventNode.getAction.errorTitle=Error getting actions",
135 "EventNode.getAction.linkedFileMessage=There was a problem getting actions for the selected result. "
136 +
" The 'View File in Timeline' action will not be available."})
138 List<Action> actionsList =
new ArrayList<>();
139 Collections.addAll(actionsList, super.getActions(context));
145 final BlackboardArtifact artifact = getLookup().lookup(BlackboardArtifact.class);
146 final Content sourceFile = getLookup().lookup(Content.class);
147 if (artifact != null) {
150 AbstractFile linkedfile =
findLinked(artifact);
151 if (linkedfile != null) {
154 }
catch (TskCoreException ex) {
155 logger.log(Level.SEVERE, MessageFormat.format(
"Error getting linked file from blackboard artifact{0}.", artifact.getArtifactID()), ex);
160 if (sourceFile instanceof AbstractFile) {
167 actionsList.addAll(factoryActions);
168 if (factoryActions.isEmpty()) {
175 return actionsList.toArray(
new Action[actionsList.size()]);
185 throw new UnsupportedOperationException(
"Not supported yet.");
190 return getClass().getName();
197 final private class TimeProperty extends PropertySupport.ReadWrite<String> {
206 TimeProperty(String name, String displayName, String shortDescription, String value) {
207 super(name, String.class, displayName, shortDescription);
208 setValue(
"suppressCustomEditor", Boolean.TRUE);
213 }
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
214 logger.log(Level.SEVERE,
"Unexpected error setting date/time property on EventNode explorer node", ex);
221 public String
getValue() throws IllegalAccessException, InvocationTargetException {
226 public void setValue(String newValue)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
229 firePropertyChange(
"time", oldValue, newValue);
245 SleuthkitCase sleuthkitCase = eventsModel.getSleuthkitCase();
251 final TimelineEvent eventById = eventsModel.getEventById(eventID);
252 Content file = sleuthkitCase.getContentById(eventById.getFileObjID());
254 if (eventById.getArtifactID().isPresent()) {
255 BlackboardArtifact blackboardArtifact = sleuthkitCase.getBlackboardArtifact(eventById.getArtifactID().get());
256 return new EventNode(eventById, file, blackboardArtifact);
263 final Collection<BlackboardArtifact> selectedArtifactsList
264 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
265 return selectedArtifactsList.size() == 1;
static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel)
Action[] getActions(boolean context)
static boolean isExactlyOneArtifactSelected()
static List< Action > getActions(File file, boolean isArtifactSource)
static synchronized AddBlackboardArtifactTagAction getInstance()
static synchronized DeleteFileBlackboardArtifactTagAction getInstance()
String getDateTimeString()
static ViewFileInTimelineAction createViewSourceFileAction(AbstractFile file)
static ReadOnlyObjectProperty< TimeZone > timeZoneProperty()
static AbstractFile findLinked(BlackboardArtifact artifact)
void setValue(String newValue)
static void error(String title, String message)
synchronized static Logger getLogger(String name)
final TimelineEvent event
static String getImagePath(TimelineEventType type)
static DateTimeFormatter getZonedFormatter()
static final Logger logger
static ViewFileInTimelineAction createViewFileAction(AbstractFile file)