Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ViewSourceArtifactAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2018 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.directorytree;
20 
21 import java.awt.event.ActionEvent;
22 import java.util.logging.Level;
23 import javax.swing.AbstractAction;
27 import org.sleuthkit.datamodel.BlackboardArtifact;
28 import org.sleuthkit.datamodel.BlackboardAttribute;
29 import org.sleuthkit.datamodel.TskCoreException;
30 
35 class ViewSourceArtifactAction extends AbstractAction {
36 
37  private static final long serialVersionUID = 1L;
38  private static final Logger logger = Logger.getLogger(ViewSourceArtifactAction.class.getName());
39  private final BlackboardArtifact artifact;
40 
41  ViewSourceArtifactAction(String title, final BlackboardArtifact artifact) {
42  super(title);
43  this.artifact = artifact;
44  }
45 
46  @Override
47  public void actionPerformed(ActionEvent e) {
48  final DirectoryTreeTopComponent dirTree = DirectoryTreeTopComponent.findInstance();
49  try {
50  for (BlackboardAttribute attribute : artifact.getAttributes()) {
51  if (attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) {
52  BlackboardArtifact associatedArtifact = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboardArtifact(attribute.getValueLong());
53  if (associatedArtifact != null) {
54  dirTree.viewArtifact(associatedArtifact);
55  break;
56  }
57 
58  }
59  }
60  } catch (TskCoreException | NoCurrentCaseException ex) {
61  logger.log(Level.WARNING, "Unable to perform view artifact on an associated artifact of " + artifact.getDisplayName(), ex); //NON-NLS
62  }
63  }
64 
65  @Override
66  public Object clone() throws CloneNotSupportedException {
67  return super.clone();
68  }
69 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.