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

Copyright © 2012-2018 Basis Technology. Generated on: Fri Jun 21 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.