19 package org.sleuthkit.autopsy.datamodel;
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.apache.commons.lang3.StringUtils;
28 import org.openide.util.NbBundle;
29 import org.openide.util.Utilities;
40 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
41 import org.
sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
57 static String getIconForFileType(AbstractFile file) {
58 String ext = file.getNameExtension();
59 if (StringUtils.isBlank(ext)) {
60 return "org/sleuthkit/autopsy/images/file-icon.png";
65 return "org/sleuthkit/autopsy/images/image-file.png";
68 return "org/sleuthkit/autopsy/images/video-file.png";
71 return "org/sleuthkit/autopsy/images/audio-file.png";
74 return "org/sleuthkit/autopsy/images/doc-file.png";
77 return "org/sleuthkit/autopsy/images/exe-file.png";
80 return "org/sleuthkit/autopsy/images/text-file.png";
83 return "org/sleuthkit/autopsy/images/web-file.png";
86 return "org/sleuthkit/autopsy/images/pdf-file.png";
89 return "org/sleuthkit/autopsy/images/archive-file.png";
91 return "org/sleuthkit/autopsy/images/file-icon.png";
113 super(file, directoryBrowseMode);
121 if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
122 if (file.getType().equals(TSK_DB_FILES_TYPE_ENUM.CARVED)) {
123 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/carved-file-icon-16.png");
125 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon-deleted.png");
128 this.setIconBaseWithExtension(getIconForFileType(file));
143 "FileNode.getActions.viewFileInDir.text=View File in Directory",
144 "FileNode.getActions.viewInNewWin.text=View in New Window",
145 "FileNode.getActions.openInExtViewer.text=Open in External Viewer",
146 "FileNode.getActions.searchFilesSameMD5.text=Search for files with the same MD5 hash"})
148 List<Action> actionsList =
new ArrayList<>();
149 actionsList.addAll(Arrays.asList(super.getActions(
true)));
152 actionsList.add(
new ViewContextAction(Bundle.FileNode_getActions_viewFileInDir_text(),
this));
153 actionsList.add(null);
156 actionsList.add(
new NewWindowViewAction(Bundle.FileNode_getActions_viewInNewWin_text(),
this));
157 actionsList.add(
new ExternalViewerAction(Bundle.FileNode_getActions_openInExtViewer_text(),
this));
159 actionsList.add(null);
162 actionsList.add(
new HashSearchAction(Bundle.FileNode_getActions_searchFilesSameMD5_text(),
this));
163 actionsList.add(null);
166 final Collection<AbstractFile> selectedFilesList =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
167 if (1 == selectedFilesList.size()) {
171 return actionsList.toArray(
new Action[actionsList.size()]);
183 public <T> T accept(ContentNodeVisitor<T> visitor) {
184 return visitor.visit(
this);
196 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
197 return visitor.visit(
this);
221 return getClass().getName();
static List< String > getArchiveExtensions()
static List< String > getTextExtensions()
static List< String > getExecutableExtensions()
static List< String > getVideoExtensions()
boolean directoryBrowseMode
static synchronized DeleteFileContentTagAction getInstance()
static List< String > getWebExtensions()
void setIcon(AbstractFile file)
FileNode(AbstractFile file, boolean directoryBrowseMode)
static List< String > getDocumentExtensions()
static List< String > getAudioExtensions()
static List< String > getPDFExtensions()
static List< String > getImageExtensions()
static ViewFileInTimelineAction createViewFileAction(AbstractFile file)
FileNode(AbstractFile file)
Action[] getActions(boolean context)
static synchronized AddContentTagAction getInstance()
boolean getDirectoryBrowseMode()