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;
44 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
45 import org.
sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
63 static String getIconForFileType(AbstractFile file) {
64 String ext = file.getNameExtension();
65 if (StringUtils.isBlank(ext)) {
66 return "org/sleuthkit/autopsy/images/file-icon.png";
71 return "org/sleuthkit/autopsy/images/image-file.png";
74 return "org/sleuthkit/autopsy/images/video-file.png";
77 return "org/sleuthkit/autopsy/images/audio-file.png";
80 return "org/sleuthkit/autopsy/images/doc-file.png";
83 return "org/sleuthkit/autopsy/images/exe-file.png";
86 return "org/sleuthkit/autopsy/images/text-file.png";
89 return "org/sleuthkit/autopsy/images/web-file.png";
92 return "org/sleuthkit/autopsy/images/pdf-file.png";
95 return "org/sleuthkit/autopsy/images/archive-file.png";
97 return "org/sleuthkit/autopsy/images/file-icon.png";
119 super(file, directoryBrowseMode);
127 if (file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
128 if (file.getType().equals(TSK_DB_FILES_TYPE_ENUM.CARVED)) {
129 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/carved-file-icon-16.png");
131 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon-deleted.png");
134 this.setIconBaseWithExtension(getIconForFileType(file));
149 "FileNode.getActions.viewFileInDir.text=View File in Directory",
150 "FileNode.getActions.viewInNewWin.text=View in New Window",
151 "FileNode.getActions.openInExtViewer.text=Open in External Viewer",
152 "FileNode.getActions.searchFilesSameMD5.text=Search for files with the same MD5 hash"})
154 List<Action> actionsList =
new ArrayList<>();
155 actionsList.addAll(Arrays.asList(super.getActions(
true)));
158 actionsList.add(
new ViewContextAction(Bundle.FileNode_getActions_viewFileInDir_text(),
this));
159 actionsList.add(null);
162 actionsList.add(
new NewWindowViewAction(Bundle.FileNode_getActions_viewInNewWin_text(),
this));
163 actionsList.add(
new ExternalViewerAction(Bundle.FileNode_getActions_openInExtViewer_text(),
this));
165 actionsList.add(null);
168 actionsList.add(null);
171 final Collection<AbstractFile> selectedFilesList =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
172 if (1 == selectedFilesList.size()) {
178 if (this.content.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0) {
181 }
catch (TskCoreException ex) {
182 logger.log(Level.WARNING,
"Unable to add unzip with password action to context menus", ex);
185 return actionsList.toArray(
new Action[actionsList.size()]);
197 public <T> T accept(ContentNodeVisitor<T> visitor) {
198 return visitor.visit(
this);
210 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
211 return visitor.visit(
this);
235 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()