Autopsy  4.9.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
LayoutFileNode.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.datamodel;
20 
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.Collection;
24 import java.util.HashSet;
25 import java.util.List;
26 import java.util.Map;
27 import javax.swing.Action;
28 import org.openide.util.NbBundle;
29 import org.openide.util.Utilities;
36 import org.sleuthkit.datamodel.AbstractFile;
37 import org.sleuthkit.datamodel.LayoutFile;
38 import org.sleuthkit.datamodel.TskData;
39 
43 public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
44 
45  @Deprecated
46  public static enum LayoutContentPropertyType {
47 
48  PARTS {
49  @Override
50  public String toString() {
51  return NbBundle.getMessage(this.getClass(), "LayoutFileNode.propertyType.parts");
52  }
53  }
54  }
55 
56  public static String nameForLayoutFile(LayoutFile lf) {
57  return lf.getName();
58  }
59 
60  public LayoutFileNode(LayoutFile lf) {
61  super(lf);
62 
63  this.setDisplayName(nameForLayoutFile(lf));
64 
65  if (lf.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.CARVED)) {
66  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/carved-file-icon-16.png"); //NON-NLS
67  } else {
68  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png"); //NON-NLS
69  }
70  }
71 
72  public <T> T accept(ContentNodeVisitor<T> visitor) {
73  return visitor.visit(this);
74  }
75 
76  @Override
77  public boolean isLeafTypeNode() {
78  return false;
79  }
80 
81  @Override
82  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
83  return visitor.visit(this);
84  }
85 
86  @Override
87  public Action[] getActions(boolean context) {
88  List<Action> actionsList = new ArrayList<>();
89  actionsList.addAll(Arrays.asList(super.getActions(true)));
90  actionsList.add(new NewWindowViewAction(
91  NbBundle.getMessage(this.getClass(), "LayoutFileNode.getActions.viewInNewWin.text"), this));
92  actionsList.add(new ExternalViewerAction(
93  NbBundle.getMessage(this.getClass(), "LayoutFileNode.getActions.openInExtViewer.text"), this));
94  actionsList.add(null); // creates a menu separator
95  actionsList.add(ExtractAction.getInstance());
96  actionsList.add(null); // creates a menu separator
97  actionsList.add(AddContentTagAction.getInstance());
98 
99  final Collection<AbstractFile> selectedFilesList
100  = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
101  if (selectedFilesList.size() == 1) {
102  actionsList.add(DeleteFileContentTagAction.getInstance());
103  }
104 
105  actionsList.addAll(ContextMenuExtensionPoint.getActions());
106  return actionsList.toArray(new Action[actionsList.size()]);
107  }
108 
109  @Override
110  public String getItemType() {
111  return getClass().getName();
112  }
113 
114 }
static synchronized ExtractAction getInstance()
static synchronized DeleteFileContentTagAction getInstance()
static String nameForLayoutFile(LayoutFile lf)
static synchronized AddContentTagAction getInstance()

Copyright © 2012-2018 Basis Technology. Generated on: Tue Dec 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.