19 package org.sleuthkit.autopsy.keywordsearch;
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.openide.nodes.FilterNode;
28 import org.openide.nodes.Node;
29 import org.openide.nodes.Node.Property;
30 import org.openide.nodes.Sheet;
31 import org.openide.util.NbBundle;
32 import org.openide.util.Utilities;
33 import org.openide.util.lookup.Lookups;
34 import org.openide.util.lookup.ProxyLookup;
58 class KeywordSearchFilterNode
extends FilterNode {
66 KeywordSearchFilterNode(AdHocQueryResult adHocQueryResult, Node original) {
67 super(original, null,
new ProxyLookup(Lookups.singleton(adHocQueryResult), original.getLookup()));
71 public Node.PropertySet[] getPropertySets() {
72 Node.PropertySet[] propertySets = super.getPropertySets();
74 for (
int i = 0; i < propertySets.length; i++) {
75 Node.PropertySet ps = propertySets[i];
77 if (ps.getName().equals(Sheet.PROPERTIES)) {
78 Sheet.Set newPs =
new Sheet.Set();
79 newPs.setName(ps.getName());
80 newPs.setDisplayName(ps.getDisplayName());
81 newPs.setShortDescription(ps.getShortDescription());
83 Property<?>[] oldProperties = ps.getProperties();
86 for (Property<?> p : oldProperties) {
90 propertySets[i] = newPs;
106 public Action[] getActions(
boolean popup) {
108 List<Action> actions =
new ArrayList<>();
109 actions.addAll(Arrays.asList(super.getActions(popup)));
110 Content content = this.getOriginal().getLookup().lookup(Content.class);
111 actions.addAll(content.accept(
new GetPopupActionsContentVisitor()));
113 return actions.toArray(
new Action[actions.size()]);
124 public List<Action>
visit(DerivedFile f) {
129 public List<Action>
visit(Directory d) {
134 public List<Action>
visit(LayoutFile lf) {
136 boolean enableHashSearch = (lf.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.CARVED);
141 public List<Action>
visit(LocalFile lf) {
146 public List<Action>
visit(SlackFile f) {
151 public List<Action>
visit(VirtualDirectory dir) {
156 List<Action> actionsList =
new ArrayList<>();
157 actionsList.add(
new NewWindowViewAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), KeywordSearchFilterNode.this));
158 actionsList.add(
new ExternalViewerAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal()));
159 actionsList.add(null);
161 Action hashSearchAction =
new HashSearchAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.searchSameMd5"), getOriginal());
162 hashSearchAction.setEnabled(enableHashSearch);
163 actionsList.add(hashSearchAction);
164 actionsList.add(null);
167 final Collection<AbstractFile> selectedFilesList
168 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
169 if (selectedFilesList.size() == 1) {
static synchronized DeleteFileContentTagAction getInstance()
static synchronized AddContentTagAction getInstance()