Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
BlackboardArtifactTagNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-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.datamodel;
20 
21 import java.util.List;
22 import java.util.logging.Level;
24 import javax.swing.Action;
25 import org.openide.nodes.Children;
26 import org.openide.nodes.Sheet;
27 import org.openide.util.NbBundle;
28 import org.openide.util.lookup.Lookups;
32 
41 
42  private static final String ICON_PATH = "org/sleuthkit/autopsy/images/green-tag-icon-16.png"; //NON-NLS
43  private final BlackboardArtifactTag tag;
44 
46  super(Children.LEAF, Lookups.fixed(tag, tag.getArtifact(), tag.getContent()));
47  super.setName(tag.getContent().getName());
48  super.setDisplayName(tag.getContent().getName());
49  this.setIconBaseWithExtension(ICON_PATH);
50  this.tag = tag;
51  }
52 
53  @Override
54  protected Sheet createSheet() {
55  Sheet propertySheet = super.createSheet();
56  Sheet.Set properties = propertySheet.get(Sheet.PROPERTIES);
57  if (properties == null) {
58  properties = Sheet.createPropertiesSet();
59  propertySheet.put(properties);
60  }
61 
62  properties.put(new NodeProperty<>(
63  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
64  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
65  "",
66  tag.getContent().getName()));
67  String contentPath;
68  try {
69  contentPath = tag.getContent().getUniquePath();
70  } catch (TskCoreException ex) {
71  Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex); //NON-NLS
72  contentPath = NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.unavail.text");
73  }
74  properties.put(new NodeProperty<>(
75  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
76  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
77  "",
78  contentPath));
79  properties.put(new NodeProperty<>(
80  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
81  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
82  "",
83  tag.getArtifact().getDisplayName()));
84  properties.put(new NodeProperty<>(
85  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
86  NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
87  "",
88  tag.getComment()));
89 
90  return propertySheet;
91  }
92 
93  @Override
94  public Action[] getActions(boolean context) {
95  List<Action> actions = DataModelActionsFactory.getActions(tag.getContent(), true);
96  actions.add(null); // Adds a menu item separator.
98  return actions.toArray(new Action[0]);
99  }
100 
101  @Override
102  public <T> T accept(DisplayableItemNodeVisitor<T> v) {
103  return v.visit(this);
104  }
105 
106  @Override
107  public boolean isLeafTypeNode() {
108  return true;
109  }
110 }
static List< Action > getActions(File file, boolean isArtifactSource)
static synchronized DeleteBlackboardArtifactTagAction getInstance()
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.