diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentChildren.java b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentChildren.java index 25f5fe50b1..bab7ef58f9 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentChildren.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractContentChildren.java @@ -23,6 +23,7 @@ import org.openide.nodes.AbstractNode; import org.openide.nodes.Children.Keys; import org.openide.nodes.Node; import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode; +import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.Directory; import org.sleuthkit.datamodel.File; import org.sleuthkit.datamodel.Image; @@ -91,6 +92,11 @@ abstract class AbstractContentChildren extends Keys { return new LayoutFileNode(lf); } + @Override + public AbstractContentNode visit(DerivedFile df) { + return new DerivedFileNode(df); + } + @Override public AbstractContentNode visit(VirtualDirectory ld) { return new VirtualDirectoryNode(ld); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DirectoryNode.java index 5e2b9dd4da..7f2bfa0041 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DirectoryNode.java @@ -67,7 +67,7 @@ public class DirectoryNode extends AbstractFsContentNode { return v.visit(this); } - @Override + @Override public TYPE getDisplayableItemNodeType() { return TYPE.CONTENT; } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterChildren.java b/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterChildren.java index 0179322bff..e81cd2dfbc 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterChildren.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterChildren.java @@ -26,7 +26,6 @@ import org.openide.nodes.Node; * This class is used for the creation of all the children for the * DataResultFilterNode that created in the DataResultFilterNode.java. * - * @author jantonius */ public class DataResultFilterChildren extends FilterNode.Children { diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java index 35d86fb70c..846b4895fe 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DataResultFilterNode.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.directorytree; -import com.google.common.collect.Lists; import java.awt.event.ActionEvent; import java.beans.PropertyVetoException; import java.util.ArrayList; @@ -38,6 +37,7 @@ import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode; import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode.FsContentPropertyType; import org.sleuthkit.autopsy.datamodel.ArtifactTypeNode; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; +import org.sleuthkit.autopsy.datamodel.DerivedFileNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor; import org.sleuthkit.autopsy.datamodel.EmailExtracted.EmailExtractedAccountNode; @@ -180,11 +180,11 @@ public class DataResultFilterNode extends FilterNode { actions.add(new TagFileAction(dir)); return actions; } - + @Override public List visit(LayoutFileNode lf) { List actions = new ArrayList(); - + actions.add(new NewWindowViewAction("View in New Window", lf)); actions.add(new ExternalViewerAction("Open in External Viewer", lf)); actions.add(null); // creates a menu separator @@ -193,11 +193,11 @@ public class DataResultFilterNode extends FilterNode { actions.add(new TagFileAction(lf)); return actions; } - + @Override public List visit(VirtualDirectoryNode ld) { List actions = new ArrayList(); - + actions.add(new TagFileAction(ld)); return actions; } @@ -222,7 +222,7 @@ public class DataResultFilterNode extends FilterNode { @Override public List visit(BlackboardArtifactNode ban) { List actions = new ArrayList(); - + //merge predefined specific node actions if bban sublcasses have their own for (Action a : ban.getActions(true)) { actions.add(a); @@ -250,53 +250,49 @@ public class DataResultFilterNode extends FilterNode { actions.add(null); // creates a menu separator actions.add(new ExtractAction("Extract File", new FileNode(f))); actions.add(new HashSearchAction("Search for files with the same MD5 hash", new FileNode(f))); - + //add file/result tag if itself is not a tag if (artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE.getTypeID() - && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID() - ) { + && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID()) { actions.add(null); // creates a menu separator actions.add(new TagFileAction(f)); actions.add(new TagResultAction(ba)); } } - if (( d = ban.getLookup().lookup(Directory.class)) != null) { + if ((d = ban.getLookup().lookup(Directory.class)) != null) { actions.add(null); // creates a menu separator actions.add(new NewWindowViewAction("View in New Window", new DirectoryNode(d))); actions.add(new ExternalViewerAction("Open in External Viewer", new DirectoryNode(d))); actions.add(null); // creates a menu separator actions.add(new ExtractAction("Extract Directory", new DirectoryNode(d))); - + //add file/result tag if itself is not a tag if (artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE.getTypeID() - && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID() - ) { + && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID()) { actions.add(null); // creates a menu separator - actions.add(new TagFileAction( d)); + actions.add(new TagFileAction(d)); actions.add(new TagResultAction(ba)); } - } - else if ( ( lf = ban.getLookup().lookup(LayoutFile.class)) != null) { + } else if ((lf = ban.getLookup().lookup(LayoutFile.class)) != null) { actions.add(null); // creates a menu separator actions.add(new NewWindowViewAction("View in New Window", new LayoutFileNode(lf))); actions.add(new ExternalViewerAction("Open in External Viewer", new LayoutFileNode(lf))); actions.add(null); // creates a menu separator actions.add(new ExtractAction("Extract File", new LayoutFileNode(lf))); - + //add tag if itself is not a tag if (artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE.getTypeID() - && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID() - ) { + && artifactTypeID != BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT.getTypeID()) { actions.add(null); // creates a menu separator - actions.add(new TagFileAction(lf)); + actions.add(new TagFileAction(lf)); actions.add(new TagResultAction(ba)); } } //if (artifactTypeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) { - //actions.add(null); // creates a menu separator - //actions.add(new ResultDeleteAction("Delete Result", ba)); + //actions.add(null); // creates a menu separator + //actions.add(new ResultDeleteAction("Delete Result", ba)); //} - + return actions; } @@ -422,18 +418,11 @@ public class DataResultFilterNode extends FilterNode { public AbstractAction visit(TagNodeRoot tnr) { return openChild(tnr); } - + @Override public AbstractAction visit(TagsNodeRoot tnr) { return openChild(tnr); } - - - - - - - @Override public AbstractAction visit(DirectoryNode dn) { @@ -445,12 +434,30 @@ public class DataResultFilterNode extends FilterNode { return null; } } - + @Override public AbstractAction visit(VirtualDirectoryNode ldn) { return openChild(ldn); } + @Override + public AbstractAction visit(FileNode fn) { + if (fn.hasContentChildren()) { + return openChild(fn); + } else { + return null; + } + } + + @Override + public AbstractAction visit(DerivedFileNode dfn) { + if (dfn.hasContentChildren()) { + return openChild(dfn); + } else { + return null; + } + } + @Override public AbstractAction visit(FileSearchFilterNode fsfn) { return openChild(fsfn); @@ -490,7 +497,8 @@ public class DataResultFilterNode extends FilterNode { @Override public void actionPerformed(ActionEvent e) { if (parentContext != null) { - for (int i = 0; i < parentContext.getChildren().getNodesCount(); i++) { + final int childrenNodesCount = parentContext.getChildren().getNodesCount(); + for (int i = 0; i < childrenNodesCount; i++) { Node selectedNode = parentContext.getChildren().getNodeAt(i); if (selectedNode != null && selectedNode.getName().equals(original.getName())) { try {