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;
57 class KeywordSearchFilterNode
extends FilterNode {
59 KeywordSearchFilterNode(QueryResults highlights, Node original) {
60 super(original, null,
new ProxyLookup(Lookups.singleton(highlights), original.getLookup()));
64 public Node.PropertySet[] getPropertySets() {
65 Node.PropertySet[] propertySets = super.getPropertySets();
67 for (
int i = 0; i < propertySets.length; i++) {
68 Node.PropertySet ps = propertySets[i];
70 if (ps.getName().equals(Sheet.PROPERTIES)) {
71 Sheet.Set newPs =
new Sheet.Set();
72 newPs.setName(ps.getName());
73 newPs.setDisplayName(ps.getDisplayName());
74 newPs.setShortDescription(ps.getShortDescription());
76 Property<?>[] oldProperties = ps.getProperties();
79 for (Property<?> p : oldProperties) {
83 propertySets[i] = newPs;
99 public Action[] getActions(
boolean popup) {
101 List<Action> actions =
new ArrayList<>();
102 actions.addAll(Arrays.asList(super.getActions(popup)));
103 Content content = this.getOriginal().getLookup().lookup(Content.class);
104 actions.addAll(content.accept(
new GetPopupActionsContentVisitor()));
106 return actions.toArray(
new Action[actions.size()]);
117 public List<Action>
visit(DerivedFile f) {
122 public List<Action>
visit(Directory d) {
127 public List<Action>
visit(LayoutFile lf) {
129 boolean enableHashSearch = (lf.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.CARVED);
134 public List<Action>
visit(LocalFile lf) {
139 public List<Action>
visit(SlackFile f) {
144 public List<Action>
visit(VirtualDirectory dir) {
149 List<Action> actionsList =
new ArrayList<>();
150 actionsList.add(
new NewWindowViewAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), KeywordSearchFilterNode.this));
151 actionsList.add(
new ExternalViewerAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal()));
152 actionsList.add(null);
154 Action hashSearchAction =
new HashSearchAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.searchSameMd5"), getOriginal());
155 hashSearchAction.setEnabled(enableHashSearch);
156 actionsList.add(hashSearchAction);
157 actionsList.add(null);
160 final Collection<AbstractFile> selectedFilesList
161 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
162 if (selectedFilesList.size() == 1) {
static synchronized DeleteFileContentTagAction getInstance()
static synchronized AddContentTagAction getInstance()