19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.Action;
24 import org.apache.commons.lang3.StringUtils;
25 import org.openide.util.NbBundle;
35 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
36 import org.
sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
54 super(file, directoryBrowseMode);
61 if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
62 if (file.getType().equals(TSK_DB_FILES_TYPE_ENUM.CARVED)) {
63 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/carved-file-icon-16.png");
65 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon-deleted.png");
68 this.setIconBaseWithExtension(getIconForFileType(file));
81 List<Action> actionsList =
new ArrayList<>();
83 actionsList.add(
new ViewContextAction(NbBundle.getMessage(
this.getClass(),
"FileNode.viewFileInDir.text"),
this));
84 actionsList.add(null);
87 NbBundle.getMessage(
this.getClass(),
"FileNode.getActions.viewInNewWin.text"),
this));
89 NbBundle.getMessage(
this.getClass(),
"FileNode.getActions.openInExtViewer.text"),
this));
90 actionsList.add(null);
93 NbBundle.getMessage(
this.getClass(),
"FileNode.getActions.searchFilesSameMD5.text"),
this));
94 actionsList.add(null);
97 return actionsList.toArray(
new Action[0]);
101 public <T> T accept(ContentNodeVisitor< T> v) {
102 return v.visit(
this);
106 public <T> T accept(DisplayableItemNodeVisitor< T> v) {
107 return v.visit(
this);
112 static String getIconForFileType(AbstractFile file) {
114 String ext = file.getNameExtension();
116 if (StringUtils.isBlank(ext)) {
117 return "org/sleuthkit/autopsy/images/file-icon.png";
122 if (ImageUtils.isImageThumbnailSupported(file)
123 || FileTypeExtensions.getImageExtensions().contains(ext)) {
124 return "org/sleuthkit/autopsy/images/image-file.png";
127 if (FileTypeExtensions.getVideoExtensions().contains(ext)) {
128 return "org/sleuthkit/autopsy/images/video-file.png";
131 if (FileTypeExtensions.getAudioExtensions().contains(ext)) {
132 return "org/sleuthkit/autopsy/images/audio-file.png";
135 if (FileTypeExtensions.getDocumentExtensions().contains(ext)) {
136 return "org/sleuthkit/autopsy/images/doc-file.png";
139 if (FileTypeExtensions.getExecutableExtensions().contains(ext)) {
140 return "org/sleuthkit/autopsy/images/exe-file.png";
143 if (FileTypeExtensions.getTextExtensions().contains(ext)) {
144 return "org/sleuthkit/autopsy/images/text-file.png";
147 if (FileTypeExtensions.getWebExtensions().contains(ext)) {
148 return "org/sleuthkit/autopsy/images/web-file.png";
151 if (FileTypeExtensions.getPDFExtensions().contains(ext)) {
152 return "org/sleuthkit/autopsy/images/pdf-file.png";
155 if (FileTypeExtensions.getArchiveExtensions().contains(ext)) {
156 return "org/sleuthkit/autopsy/images/archive-file.png";
159 return "org/sleuthkit/autopsy/images/file-icon.png";
Action[] getActions(boolean popup)
boolean directoryBrowseMode
void setIcon(AbstractFile file)
FileNode(AbstractFile file, boolean directoryBrowseMode)
FileNode(AbstractFile file)
static synchronized AddContentTagAction getInstance()
boolean getDirectoryBrowseMode()