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;
46 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
47 import org.
sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
65 static String getIconForFileType(AbstractFile file) {
66 String ext = file.getNameExtension();
67 if (StringUtils.isBlank(ext)) {
68 return "org/sleuthkit/autopsy/images/file-icon.png";
73 return "org/sleuthkit/autopsy/images/image-file.png";
76 return "org/sleuthkit/autopsy/images/video-file.png";
79 return "org/sleuthkit/autopsy/images/audio-file.png";
82 return "org/sleuthkit/autopsy/images/doc-file.png";
85 return "org/sleuthkit/autopsy/images/exe-file.png";
88 return "org/sleuthkit/autopsy/images/text-file.png";
91 return "org/sleuthkit/autopsy/images/web-file.png";
94 return "org/sleuthkit/autopsy/images/pdf-file.png";
97 return "org/sleuthkit/autopsy/images/archive-file.png";
99 return "org/sleuthkit/autopsy/images/file-icon.png";
121 super(file, directoryBrowseMode);
129 if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
130 if (file.getType().equals(TSK_DB_FILES_TYPE_ENUM.CARVED)) {
131 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/carved-file-x-icon-16.png");
133 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon-deleted.png");
136 this.setIconBaseWithExtension(getIconForFileType(file));
151 "FileNode.getActions.viewFileInDir.text=View File in Directory",
152 "FileNode.getActions.viewInNewWin.text=View in New Window",
153 "FileNode.getActions.openInExtViewer.text=Open in External Viewer Ctrl+E",
154 "FileNode.getActions.searchFilesSameMD5.text=Search for files with the same MD5 hash"})
156 List<Action> actionsList =
new ArrayList<>();
157 actionsList.addAll(Arrays.asList(super.getActions(
true)));
160 actionsList.add(
new ViewContextAction(Bundle.FileNode_getActions_viewFileInDir_text(),
this));
161 actionsList.add(null);
164 actionsList.add(
new NewWindowViewAction(Bundle.FileNode_getActions_viewInNewWin_text(),
this));
165 final Collection<AbstractFile> selectedFilesList
166 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
167 if (selectedFilesList.size() == 1) {
169 Bundle.FileNode_getActions_openInExtViewer_text(),
this));
174 actionsList.add(null);
178 actionsList.add(null);
181 if (1 == selectedFilesList.size()) {
187 if (this.content.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0) {
190 }
catch (TskCoreException ex) {
191 logger.log(Level.WARNING,
"Unable to add unzip with password action to context menus", ex);
194 return actionsList.toArray(
new Action[actionsList.size()]);
206 public <T> T accept(ContentNodeVisitor<T> visitor) {
207 return visitor.visit(
this);
219 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
220 return visitor.visit(
this);
244 return getClass().getName();
static List< String > getArchiveExtensions()
static List< String > getTextExtensions()
static List< String > getExecutableExtensions()
static final Logger logger
static List< String > getVideoExtensions()
static synchronized ExportCSVAction getInstance()
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 synchronized ExternalViewerShortcutAction getInstance()
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()