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.ProxyLookup;
59 class AdHocSearchFilterNode
extends FilterNode {
66 AdHocSearchFilterNode(Node original) {
67 super(original, null,
new ProxyLookup(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()]);
119 public List<Action>
visit(Report r) {
120 List<Action> actionsList =
new ArrayList<>();
121 actionsList.add(
new NewWindowViewAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), AdHocSearchFilterNode.this));
133 public List<Action>
visit(DerivedFile f) {
138 public List<Action>
visit(Directory d) {
143 public List<Action>
visit(LayoutFile lf) {
145 boolean enableHashSearch = (lf.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.CARVED);
150 public List<Action>
visit(LocalFile lf) {
155 public List<Action>
visit(SlackFile f) {
160 public List<Action>
visit(VirtualDirectory dir) {
165 List<Action> actionsList =
new ArrayList<>();
166 actionsList.add(
new NewWindowViewAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), AdHocSearchFilterNode.this));
167 actionsList.add(
new ExternalViewerAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal()));
168 actionsList.add(null);
170 Action hashSearchAction =
new HashSearchAction(NbBundle.getMessage(
this.getClass(),
"KeywordSearchFilterNode.getFileActions.searchSameMd5"), getOriginal());
171 hashSearchAction.setEnabled(enableHashSearch);
172 actionsList.add(hashSearchAction);
173 actionsList.add(null);
176 final Collection<AbstractFile> selectedFilesList
177 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
178 if (selectedFilesList.size() == 1) {
static synchronized DeleteFileContentTagAction getInstance()
static synchronized AddContentTagAction getInstance()