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 java.util.logging.Level;
27 import javax.swing.Action;
28 import org.apache.commons.lang3.StringUtils;
29 import org.openide.util.NbBundle;
30 import org.openide.util.Utilities;
45 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
46 import org.
sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
64 static String getIconForFileType(AbstractFile file) {
65 String ext = file.getNameExtension();
66 if (StringUtils.isBlank(ext)) {
67 return "org/sleuthkit/autopsy/images/file-icon.png";
72 return "org/sleuthkit/autopsy/images/image-file.png";
75 return "org/sleuthkit/autopsy/images/video-file.png";
78 return "org/sleuthkit/autopsy/images/audio-file.png";
81 return "org/sleuthkit/autopsy/images/doc-file.png";
84 return "org/sleuthkit/autopsy/images/exe-file.png";
87 return "org/sleuthkit/autopsy/images/text-file.png";
90 return "org/sleuthkit/autopsy/images/web-file.png";
93 return "org/sleuthkit/autopsy/images/pdf-file.png";
96 return "org/sleuthkit/autopsy/images/archive-file.png";
98 return "org/sleuthkit/autopsy/images/file-icon.png";
120 super(file, directoryBrowseMode);
128 if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
129 if (file.getType().equals(TSK_DB_FILES_TYPE_ENUM.CARVED)) {
130 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/carved-file-icon-16.png");
132 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon-deleted.png");
135 this.setIconBaseWithExtension(getIconForFileType(file));
150 "FileNode.getActions.viewFileInDir.text=View File in Directory",
151 "FileNode.getActions.viewInNewWin.text=View in New Window",
152 "FileNode.getActions.openInExtViewer.text=Open in External Viewer",
153 "FileNode.getActions.searchFilesSameMD5.text=Search for files with the same MD5 hash"})
155 List<Action> actionsList =
new ArrayList<>();
156 actionsList.addAll(Arrays.asList(super.getActions(
true)));
159 actionsList.add(
new ViewContextAction(Bundle.FileNode_getActions_viewFileInDir_text(),
this));
160 actionsList.add(null);
163 actionsList.add(
new NewWindowViewAction(Bundle.FileNode_getActions_viewInNewWin_text(),
this));
164 actionsList.add(
new ExternalViewerAction(Bundle.FileNode_getActions_openInExtViewer_text(),
this));
166 actionsList.add(null);
169 actionsList.add(
new HashSearchAction(Bundle.FileNode_getActions_searchFilesSameMD5_text(),
this));
170 actionsList.add(null);
173 final Collection<AbstractFile> selectedFilesList =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
174 if (1 == selectedFilesList.size()) {
180 if (this.content.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0) {
183 }
catch (TskCoreException ex) {
184 logger.log(Level.WARNING,
"Unable to add unzip with password action to context menus", ex);
187 return actionsList.toArray(
new Action[actionsList.size()]);
199 public <T> T accept(ContentNodeVisitor<T> visitor) {
200 return visitor.visit(
this);
212 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
213 return visitor.visit(
this);
237 return getClass().getName();
static List< String > getArchiveExtensions()
static List< String > getTextExtensions()
static List< String > getExecutableExtensions()
static final Logger logger
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()
synchronized static Logger getLogger(String name)
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()