mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
add missing actions for local directory nodes
This commit is contained in:
@@ -18,12 +18,19 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.Action;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.datamodel.LayoutFileNode.LayoutContentPropertyType;
|
||||
import org.sleuthkit.autopsy.directorytree.ExtractAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.directorytree.TagAction;
|
||||
import org.sleuthkit.autopsy.directorytree.ViewContextAction;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
@@ -62,6 +69,24 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Right click action for this node
|
||||
*
|
||||
* @param popup
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
|
||||
actions.add(new NewWindowViewAction("View in New Window", this));
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new ExtractAction("Extract Directory", this));
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new TagAction(this));
|
||||
return actions.toArray(new Action[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sheet createSheet() {
|
||||
Sheet s = super.createSheet();
|
||||
|
||||
@@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.directorytree;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.sleuthkit.autopsy.datamodel.VolumeNode;
|
||||
import org.sleuthkit.autopsy.datamodel.DirectoryNode;
|
||||
@@ -60,12 +59,15 @@ import org.sleuthkit.autopsy.datamodel.RecentFilesNode;
|
||||
import org.sleuthkit.autopsy.datamodel.SearchFiltersNode;
|
||||
import org.sleuthkit.autopsy.datamodel.Tags.TagNodeRoot;
|
||||
import org.sleuthkit.autopsy.datamodel.Tags.TagsNodeRoot;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.DerivedFile;
|
||||
import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.File;
|
||||
import org.sleuthkit.datamodel.LayoutFile;
|
||||
import org.sleuthkit.datamodel.LocalFile;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
|
||||
/**
|
||||
@@ -156,6 +158,10 @@ public class DataResultFilterNode extends FilterNode {
|
||||
|
||||
@Override
|
||||
public List<Action> visit(BlackboardArtifactNode ban) {
|
||||
//set up actions for artifact node based on its Content object
|
||||
//TODO all actions need to be consolidated in single place!
|
||||
//they should be set in individual Node subclass and using a utility to get Actions per Content sub-type
|
||||
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
|
||||
//merge predefined specific node actions if bban subclasses have their own
|
||||
@@ -177,6 +183,7 @@ public class DataResultFilterNode extends FilterNode {
|
||||
}
|
||||
File f = ban.getLookup().lookup(File.class);
|
||||
LayoutFile lf = null;
|
||||
AbstractFile locF = null;
|
||||
Directory d = null;
|
||||
if (f != null) {
|
||||
actions.add(null); // creates a menu separator
|
||||
@@ -223,6 +230,22 @@ public class DataResultFilterNode extends FilterNode {
|
||||
actions.add(new TagAction(ba));
|
||||
}
|
||||
}
|
||||
else if ((locF = ban.getLookup().lookup(LocalFile.class)) != null
|
||||
|| (locF = ban.getLookup().lookup(DerivedFile.class)) != null) {
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new NewWindowViewAction("View in New Window", new LocalFileNode(locF)));
|
||||
actions.add(new ExternalViewerAction("Open in External Viewer", new LocalFileNode(locF)));
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new ExtractAction("Extract File", new LocalFileNode(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()) {
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new TagAction(lf));
|
||||
actions.add(new TagAction(ba));
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.FileSystem;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.LocalFile;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
import org.sleuthkit.datamodel.Volume;
|
||||
|
||||
public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
|
||||
@@ -103,7 +104,15 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
actions.add(new TagAction(d));
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final VirtualDirectory d) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
actions.add(new TagAction(d));
|
||||
actions.add(new ExtractAction("Extract Directory", d));
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final DerivedFile d) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
@@ -111,7 +120,7 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
actions.add(new TagAction(d));
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final LocalFile d) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
@@ -119,8 +128,8 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
actions.add(new TagAction(d));
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public List<? extends Action> visit(final org.sleuthkit.datamodel.File d) {
|
||||
List<Action> actions = new ArrayList<Action>();
|
||||
actions.add(new ExtractAction("Extract File", d));
|
||||
@@ -326,16 +335,16 @@ public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? ext
|
||||
}
|
||||
|
||||
Arrays.fill(rowValues, 0, 1, new Object[]{
|
||||
fs.getId(),
|
||||
fs.getImageOffset(),
|
||||
id,
|
||||
fs.getFsType(),
|
||||
fs.getBlock_size(),
|
||||
fs.getBlock_count(),
|
||||
fs.getRoot_inum(),
|
||||
fs.getFirst_inum(),
|
||||
fs.getLastInum()
|
||||
});
|
||||
fs.getId(),
|
||||
fs.getImageOffset(),
|
||||
id,
|
||||
fs.getFsType(),
|
||||
fs.getBlock_size(),
|
||||
fs.getBlock_count(),
|
||||
fs.getRoot_inum(),
|
||||
fs.getFirst_inum(),
|
||||
fs.getLastInum()
|
||||
});
|
||||
|
||||
|
||||
JTable table = new JTable(new DefaultTableModel(rowValues, columnNames));
|
||||
|
||||
@@ -90,6 +90,11 @@ public final class ExtractAction extends AbstractAction {
|
||||
public AbstractFile visit(org.sleuthkit.datamodel.LocalFile lf) {
|
||||
return lf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractFile visit(org.sleuthkit.datamodel.VirtualDirectory vd) {
|
||||
return vd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractFile visit(Directory dir) {
|
||||
|
||||
Reference in New Issue
Block a user