mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 17:57:43 +00:00
Made adding run ingest modules more efficient.
This commit is contained in:
parent
1445da7503
commit
31857d846f
@ -28,15 +28,11 @@ import org.openide.nodes.Sheet;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.directorytree.ExplorerNodeActionVisitor;
|
||||
import org.sleuthkit.autopsy.directorytree.ExtractAction;
|
||||
import org.sleuthkit.autopsy.directorytree.FileSearchAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
|
||||
/**
|
||||
* This class is used to represent the "Node" for the image. The children of
|
||||
@ -84,47 +80,14 @@ public class ImageNode extends AbstractContentNode<Image> {
|
||||
actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
|
||||
actionsList.add(new FileSearchAction(
|
||||
NbBundle.getMessage(this.getClass(), "ImageNode.getActions.openFileSearchByAttr.text")));
|
||||
|
||||
//extract dir action
|
||||
Directory dir = this.getLookup().lookup(Directory.class);
|
||||
if (dir != null) {
|
||||
actionsList.add(ExtractAction.getInstance());
|
||||
actionsList.add(new AbstractAction(
|
||||
Bundle.ImageNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(dir);
|
||||
ingestDialog.display();
|
||||
}
|
||||
});
|
||||
}
|
||||
final Image img = this.getLookup().lookup(Image.class);
|
||||
|
||||
VirtualDirectory virtualDirectory = this.getLookup().lookup(VirtualDirectory.class);
|
||||
// determine if the virtualDireory is at root-level (Logical File Set).
|
||||
boolean isRootVD = false;
|
||||
if (virtualDirectory != null) {
|
||||
try {
|
||||
if (virtualDirectory.getParent() == null) {
|
||||
isRootVD = true;
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
//logger.log(Level.WARNING, "Error determining the parent of the virtual directory", ex); // NON-NLS
|
||||
actionsList.add(new AbstractAction(
|
||||
Bundle.ImageNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.<Content>singletonList(content));
|
||||
ingestDialog.display();
|
||||
}
|
||||
}
|
||||
|
||||
// 'run ingest' action and 'file search' action are added only if the
|
||||
// selected node is img node or a root level virtual directory.
|
||||
if (img != null || isRootVD) {
|
||||
actionsList.add(new AbstractAction(
|
||||
Bundle.ImageNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.<Content>singletonList(content));
|
||||
ingestDialog.display();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
actionsList.add(new NewWindowViewAction(
|
||||
NbBundle.getMessage(this.getClass(), "ImageNode.getActions.viewInNewWin.text"), this));
|
||||
|
@ -35,9 +35,6 @@ import org.sleuthkit.autopsy.directorytree.FileSearchAction;
|
||||
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||
import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
|
||||
@ -83,58 +80,27 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
|
||||
*/
|
||||
@Override
|
||||
@NbBundle.Messages({"VirtualDirectoryNode.action.runIngestMods.text=Run Ingest Modules",
|
||||
"VirtualDirectoryNode.action.openFileSrcByAttr.text=Open File Search by Attributes",})
|
||||
"VirtualDirectoryNode.action.openFileSrcByAttr.text=Open File Search by Attributes"})
|
||||
public Action[] getActions(boolean popup) {
|
||||
List<Action> actions = new ArrayList<>();
|
||||
if (this.content.isDataSource()) {
|
||||
//extract dir action
|
||||
Directory dir = this.getLookup().lookup(Directory.class);
|
||||
if (dir != null) {
|
||||
actions.add(ExtractAction.getInstance());
|
||||
actions.add(new AbstractAction(
|
||||
Bundle.VirtualDirectoryNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(dir);
|
||||
ingestDialog.display();
|
||||
}
|
||||
});
|
||||
}
|
||||
final Image img = this.getLookup().lookup(Image.class);
|
||||
|
||||
VirtualDirectory virtualDirectory = this.getLookup().lookup(VirtualDirectory.class);
|
||||
// determine if the virtualDireory is at root-level (Logical File Set).
|
||||
boolean isRootVD = false;
|
||||
if (virtualDirectory != null) {
|
||||
try {
|
||||
if (virtualDirectory.getParent() == null) {
|
||||
isRootVD = true;
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
//logger.log(Level.WARNING, "Error determining the parent of the virtual directory", ex); // NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
// 'run ingest' action and 'file search' action are added only if the
|
||||
// selected node is img node or a root level virtual directory.
|
||||
if (img != null || isRootVD) {
|
||||
actions.add(new FileSearchAction(
|
||||
Bundle.VirtualDirectoryNode_action_openFileSrcByAttr_text()));
|
||||
actions.add(new AbstractAction(
|
||||
Bundle.VirtualDirectoryNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.<Content>singletonList(content));
|
||||
ingestDialog.display();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
actions.add(new NewWindowViewAction(
|
||||
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.getActions.viewInNewWin.text"), this));
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(ExtractAction.getInstance());
|
||||
actions.add(null); // creates a menu separator
|
||||
actions.add(new FileSearchAction(
|
||||
Bundle.VirtualDirectoryNode_action_openFileSrcByAttr_text()));
|
||||
if (this.content.isDataSource()) {
|
||||
actions.add(new AbstractAction(
|
||||
Bundle.VirtualDirectoryNode_action_runIngestMods_text()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.<Content>singletonList(content));
|
||||
ingestDialog.display();
|
||||
}
|
||||
});
|
||||
}
|
||||
actions.addAll(ContextMenuExtensionPoint.getActions());
|
||||
return actions.toArray(new Action[0]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user