TSK-316 No hex / strings view from "Keyword List" search

- fixed
- added alternative contructor to KeyValueNode that takes Lookup, which is often neccessary
This commit is contained in:
adam-m 2012-01-19 14:21:20 -05:00
parent f6a52eebc4
commit e45946e506
3 changed files with 14 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import java.awt.Cursor;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.datamodel.DataConversion;
@ -268,7 +269,8 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
@Override
public void setNode(Node selectedNode) {
if (selectedNode != null) {
Content content = selectedNode.getLookup().lookup(Content.class);
Lookup lookup = selectedNode.getLookup();
Content content = lookup.lookup(Content.class);
if (content != null) {
this.setDataView(content, 0, false);
return;

View File

@ -23,6 +23,7 @@ import java.util.Map;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Sheet;
import org.openide.util.Lookup;
public class KeyValueNode extends AbstractNode {
@ -34,6 +35,12 @@ public class KeyValueNode extends AbstractNode {
this.thing = thing;
}
public KeyValueNode(KeyValueThing thing, Children children, Lookup lookup) {
super(children, lookup);
this.setName(thing.getName());
this.thing = thing;
}
@Override
protected Sheet createSheet() {
Sheet s = super.createSheet();

View File

@ -34,6 +34,7 @@ import org.openide.nodes.ChildFactory;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
@ -230,7 +231,7 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
final Content content = thingContent.getContent();
final String query = thingContent.getQuery();
Node kvNode = new KeyValueNode(thingContent, Children.LEAF);
Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content));
//wrap in KeywordSearchFilterNode for the markup content, might need to override FilterNode for more customization
HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, query);
return new KeywordSearchFilterNode(highlights, kvNode, query);
@ -306,7 +307,7 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
//postprocess
//make sure Solr result contains a match (this gets rid of large number of false positives)
boolean postprocess = true;
final boolean postprocess = false;
boolean matchFound = true;
if (postprocess) {
if (contentStr != null) {//if not null, some error getting from Solr, handle it by not filtering out
@ -323,7 +324,7 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
}
if (matchFound) {
Node kvNode = new KeyValueNode(thingContent, Children.LEAF);
Node kvNode = new KeyValueNode(thingContent, Children.LEAF, Lookups.singleton(content));
//wrap in KeywordSearchFilterNode for the markup content
HighlightedMatchesSource highlights = new HighlightedMatchesSource(content, query);
return new KeywordSearchFilterNode(highlights, kvNode, query);