diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index ff4d3d8b2c..04887603a9 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -105,6 +105,14 @@ class DirectoryTreeFilterNode extends FilterNode { Directory dir = this.getLookup().lookup(Directory.class); if (dir != null) { actions.add(ExtractAction.getInstance()); + actions.add(new AbstractAction( + NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.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); @@ -124,14 +132,14 @@ class DirectoryTreeFilterNode extends FilterNode { // 'run ingest' action and 'file search' action are added only if the // selected node is img node or a root level virtual directory or a directory. - if (img != null || isRootVD || dir !=null) { + if (img != null || isRootVD) { actions.add(new FileSearchAction( NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); actions.add(new AbstractAction( NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { @Override public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content), dir != null); + final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); ingestDialog.display(); } }); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 2997f90754..fc56739cb3 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -58,7 +58,6 @@ public class IngestJobSettings { private final List moduleTemplates; private boolean processUnallocatedSpace; private final List warnings; - private final boolean isDir; /** * Constructs an ingest job settings object for a given context. @@ -70,23 +69,6 @@ public class IngestJobSettings { this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); this.warnings = new ArrayList<>(); - this.isDir = false; - this.createSavedModuleSettingsFolder(); - this.load(); - } - - /** - * Constructs an ingest job settings object for a given context. - * - * @param context The context identifier string. - * @param isDir Whether the dataSources are directories - */ - public IngestJobSettings(String context, boolean isDir) { - this.context = context; - this.moduleTemplates = new ArrayList<>(); - this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); - this.warnings = new ArrayList<>(); - this.isDir = isDir; this.createSavedModuleSettingsFolder(); this.load(); } @@ -201,7 +183,7 @@ public class IngestJobSettings { HashSet loadedModuleNames = new HashSet<>(); for(IngestModuleFactory moduleFactory : tempModuleFactories) { - if(!isDir || moduleFactory.isFileIngestModuleFactory()) + if(!context.endsWith(".isDir") || moduleFactory.isFileIngestModuleFactory()) moduleFactories.add(moduleFactory); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java index 88bdf182cb..29e6cfe79e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java @@ -35,6 +35,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.Directory; /** * Dialog box that allows a user to configure and run an ingest job on one or @@ -43,7 +44,7 @@ import org.sleuthkit.datamodel.Content; public final class RunIngestModulesDialog extends JDialog { private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); - private final boolean isDir; + private final String context; private static Dimension DIMENSIONS = new Dimension(500, 300); private final List dataSources = new ArrayList<>(); private IngestJobSettingsPanel ingestJobSettingsPanel; @@ -60,23 +61,7 @@ public final class RunIngestModulesDialog extends JDialog { public RunIngestModulesDialog(JFrame frame, String title, boolean modal, List dataSources) { super(frame, title, modal); this.dataSources.addAll(dataSources); - this.isDir = false; - } - - /** - * Construct a dialog box that allows a user to configure and run an ingest - * job on one or more data sources. - * - * @param frame The dialog parent window. - * @param title The title for the dialog. - * @param modal True if the dialog should be modal, false otherwise. - * @param dataSources The data sources to be processed. - * @param isDir Whether the data sources are directories - */ - public RunIngestModulesDialog(JFrame frame, String title, boolean modal, List dataSources, boolean isDir) { - super(frame, title, modal); - this.dataSources.addAll(dataSources); - this.isDir = isDir; + this.context = RunIngestModulesDialog.class.getCanonicalName(); } /** @@ -89,15 +74,9 @@ public final class RunIngestModulesDialog extends JDialog { this(new JFrame(TITLE), TITLE, true, dataSources); } - /** - * Construct a dialog box that allows a user to configure and run an ingest - * job on one or more data sources. - * - * @param dataSources The data sources to be processed. - * @param isDir Whether the data sources are directories - */ - public RunIngestModulesDialog(List dataSources, boolean isDir) { - this(new JFrame(TITLE), TITLE, true, dataSources, isDir); + public RunIngestModulesDialog(Directory dir) { + this.dataSources.add(dir); + this.context = RunIngestModulesDialog.class.getCanonicalName() + ".isDir"; } /** @@ -113,7 +92,7 @@ public final class RunIngestModulesDialog extends JDialog { @Deprecated public RunIngestModulesDialog(JFrame frame, String title, boolean modal) { super(frame, title, modal); - this.isDir = false; + this.context = RunIngestModulesDialog.class.getCanonicalName(); } /** @@ -159,7 +138,7 @@ public final class RunIngestModulesDialog extends JDialog { * Get the default or saved ingest job settings for this context and use * them to create and add an ingest job settings panel. */ - IngestJobSettings ingestJobSettings = new IngestJobSettings(RunIngestModulesDialog.class.getCanonicalName(), isDir); + IngestJobSettings ingestJobSettings = new IngestJobSettings(context); RunIngestModulesDialog.showWarnings(ingestJobSettings); this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); add(this.ingestJobSettingsPanel, BorderLayout.PAGE_START);