diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 28a8815bca..fb43fea301 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -31,6 +31,14 @@ 1.46.1 + + org.netbeans.api.templates + + + + 1.6.1 + + org.netbeans.core @@ -155,6 +163,14 @@ 9.7.1 + + org.openide.loaders + + + + 7.63.2 + + org.openide.modules diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index 6291ff7521..d217e740ec 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java @@ -30,8 +30,10 @@ import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; +import org.omg.CORBA.BAD_CONTEXT; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.Content; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; @@ -47,7 +49,7 @@ import org.sleuthkit.autopsy.ingest.IngestManager; * 3rd panel( {@link AddImageWizardAddingProgressPanel}) separate class -jm */ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel { - + @Messages("AddImageWizardIngestConfigPanel.name.text=Configure Ingest Modules") private final IngestJobSettingsPanel ingestJobSettingsPanel; /** @@ -79,6 +81,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.datamodel; -import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.sql.ResultSet; @@ -27,7 +26,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.Children; import org.openide.nodes.Sheet; @@ -40,7 +38,7 @@ import org.sleuthkit.autopsy.directorytree.FileSearchAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleContentEvent; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery; @@ -101,22 +99,14 @@ public class ImageNode extends AbstractContentNode { "ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes",}) public Action[] getActions(boolean context) { - List actionsList = new ArrayList(); + List actionsList = new ArrayList<>(); for (Action a : super.getActions(true)) { actionsList.add(a); } actionsList.addAll(ExplorerNodeActionVisitor.getActions(content)); actionsList.add(new FileSearchAction( Bundle.ImageNode_getActions_openFileSearchByAttr_text())); - actionsList.add(new AbstractAction( - Bundle.ImageNode_action_runIngestMods_text()) { - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); - ingestDialog.display(); - } - }); - + actionsList.add(new RunIngestModulesAction(Collections.singletonList(content))); actionsList.add(new NewWindowViewAction( NbBundle.getMessage(this.getClass(), "ImageNode.getActions.viewInNewWin.text"), this)); return actionsList.toArray(new Action[0]); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 246c6d6e1d..40f14bf63a 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2011-2014 Basis Technology Corp. + * + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.datamodel; -import java.awt.event.ActionEvent; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -27,7 +26,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; @@ -38,7 +36,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; 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.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -100,14 +98,7 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNodesingletonList(content)); - ingestDialog.display(); - } - }); + actions.add(new RunIngestModulesAction(Collections.singletonList(content))); actions.addAll(ContextMenuExtensionPoint.getActions()); return actions.toArray(new Action[0]); } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 0ae016bd00..d5786333aa 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2014 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,9 @@ */ package org.sleuthkit.autopsy.directorytree; -import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; @@ -33,7 +30,7 @@ import org.openide.util.lookup.ProxyLookup; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.AbstractContentNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Directory; @@ -75,7 +72,7 @@ class DirectoryTreeFilterNode extends FilterNode { if (file != null) { try { final int numChildren = file.getChildrenCount(); - + // left-to-right marks here are necessary to keep the count and parens together // for mixed right-to-left and left-to-right names name = name + " \u200E(\u200E" + numChildren + ")\u200E"; @@ -108,14 +105,7 @@ 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(); - } - }); + actions.add(new RunIngestModulesAction(dir)); } final Image img = this.getLookup().lookup(Image.class); @@ -138,14 +128,7 @@ class DirectoryTreeFilterNode extends FilterNode { 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)); - ingestDialog.display(); - } - }); + actions.add(new RunIngestModulesAction(dir)); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index e2d25014e3..f23dd57f84 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -23,7 +23,6 @@ IngestJob.progress.fileIngest.displayName=Analyzing files from {0} IngestJob.progress.fileIngest.cancelMessage=Waiting for {0} on {1} IngestJob.progress.cancelling={0} (Cancelling...) IngestJob.cancellationDialog.title=Cancel Ingest -IngestDialog.title.text=Run Ingest Modules IngestDialog.startButton.title=Start IngestDialog.closeButton.title=Close IngestManager.moduleErr=Module Error diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties index 7f83c8c5c0..f7af8964cc 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties @@ -2,7 +2,6 @@ CTL_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8 HINT_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8\u30a6\u30a3\u30f3\u30c9\u30a6 IngestDialog.closeButton.title=\u9589\u3058\u308b IngestDialog.startButton.title=\u958b\u59cb -IngestDialog.title.text=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 IngestJob.progress.cancelling={0}\uff08\u30ad\u30e3\u30f3\u30bb\u30eb\u4e2d\u2026\uff09 IngestJob.progress.dataSourceIngest.displayName={1}\u306e{0} IngestJob.progress.fileIngest.displayName={0}\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u89e3\u6790\u4e2d diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 0bb16b90f9..a154fcb6db 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java index ca1ee1f498..7ee74a726e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java @@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TY /** * Global options panel for keyword searching. */ -class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { +public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { @NbBundle.Messages({"IngestOptionsPanel.settingsTab.text=Settings", "IngestOptionsPanel.settingsTab.toolTipText=Settings regarding resources available to ingest.", @@ -52,7 +52,7 @@ class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements Opti */ IngestJobEventPropertyChangeListener ingestJobEventsListener; - IngestOptionsPanel() { + public IngestOptionsPanel() { initComponents(); customizeComponents(); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index 3eebf068fe..00018249c8 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -117,7 +117,7 @@ public final class IngestProfiles { * * @return the description */ - String getDescription() { + public String getDescription() { return description; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java index deb9d14ede..69416bf6c7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2014 Basis Technology Corp. + * + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ import org.openide.windows.WindowManager; */ public final class IngestProgressSnapshotDialog extends JDialog { - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestProgressSnapshotDialog.title.text"); + private static final String TITLE = NbBundle.getMessage(IngestProgressSnapshotDialog.class, "IngestProgressSnapshotDialog.title.text"); private static final Dimension DIMENSIONS = new Dimension(500, 300); /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form index c6edecaca9..8434d1f38d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form @@ -1,6 +1,11 @@
+ + + + + @@ -16,7 +21,7 @@ - + @@ -36,6 +41,11 @@ + + + + + @@ -67,7 +77,7 @@ - + @@ -99,7 +109,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java index 918b93108b..2605ec0b0f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java @@ -30,7 +30,7 @@ import org.sleuthkit.autopsy.core.UserPreferences; /** * Options panel that allow users to set application preferences. */ -final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { +final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { IngestSettingsPanel() { initComponents(); @@ -108,23 +108,23 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { UserPreferences.setProcessTimeOutHrs((int) timeOutHrs); } } - + boolean valid() { return true; } /** * Enable or Disable buttons based on whether Ingest is running. - * - * @param isEnabled + * + * @param isEnabled */ - void enableButtons(boolean isEnabled){ + void enableButtons(boolean isEnabled) { numberOfFileIngestThreadsComboBox.setEnabled(isEnabled); jFormattedTextFieldProcTimeOutHrs.setEnabled(isEnabled); jCheckBoxEnableProcTimeout.setEnabled(isEnabled); - ingestWarningLabel.setVisible(!isEnabled); + ingestWarningLabel.setVisible(!isEnabled); } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -144,8 +144,12 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { jLabelProcessTimeOutUnits = new javax.swing.JLabel(); ingestWarningLabel = new javax.swing.JLabel(); + setPreferredSize(new java.awt.Dimension(693, 413)); + jScrollPane1.setBorder(null); + jPanel1.setPreferredSize(new java.awt.Dimension(664, 400)); + org.openide.awt.Mnemonics.setLocalizedText(jLabelNumThreads, org.openide.util.NbBundle.getMessage(IngestSettingsPanel.class, "IngestSettingsPanel.jLabelNumThreads.text")); // NOI18N numberOfFileIngestThreadsComboBox.addActionListener(new java.awt.event.ActionListener() { @@ -205,7 +209,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelProcessTimeOutUnits))) .addGap(213, 213, 213))) - .addGap(215, 215, 215)) + .addContainerGap(52, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ingestWarningLabel) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) @@ -229,7 +233,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { .addComponent(jLabelProcessTimeOutUnits))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ingestWarningLabel) - .addContainerGap(277, Short.MAX_VALUE)) + .addContainerGap(257, Short.MAX_VALUE)) ); jScrollPane1.setViewportView(jPanel1); @@ -238,7 +242,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -246,18 +250,18 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { ); }// //GEN-END:initComponents - private void numberOfFileIngestThreadsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numberOfFileIngestThreadsComboBoxActionPerformed + private void jFormattedTextFieldProcTimeOutHrsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_numberOfFileIngestThreadsComboBoxActionPerformed + }//GEN-LAST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed private void jCheckBoxEnableProcTimeoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxEnableProcTimeoutActionPerformed jFormattedTextFieldProcTimeOutHrs.setEditable(jCheckBoxEnableProcTimeout.isSelected()); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_jCheckBoxEnableProcTimeoutActionPerformed - private void jFormattedTextFieldProcTimeOutHrsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed + private void numberOfFileIngestThreadsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numberOfFileIngestThreadsComboBoxActionPerformed firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed + }//GEN-LAST:event_numberOfFileIngestThreadsComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel ingestWarningLabel; @@ -274,6 +278,6 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { @Override public void saveSettings() { - this.store(); + this.store(); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index f22ef93d94..f7c32930c0 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -32,6 +32,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form index 6c37eb6522..d9d1e54aeb 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form @@ -7,6 +7,9 @@ + + + @@ -24,26 +27,25 @@ + - - - - - - - - - - - - - - + + + + + + + + + + + - + + @@ -59,70 +61,62 @@ - + - - - + + + - - - - - - - - + - - - - - - - - + + + - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + @@ -156,16 +150,17 @@ - - - - - + + + + + + @@ -182,9 +177,15 @@ + + + + + + @@ -201,9 +202,18 @@ + + + + + + + + + @@ -325,5 +335,10 @@ + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index 7cac1db1e1..1b1fbc40c0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -79,7 +79,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op profileListPane = new javax.swing.JScrollPane(); profileList = new javax.swing.JList<>(); profileListLabel = new javax.swing.JLabel(); - jSeparator1 = new javax.swing.JSeparator(); newProfileButton = new javax.swing.JButton(); editProfileButton = new javax.swing.JButton(); deleteProfileButton = new javax.swing.JButton(); @@ -95,17 +94,19 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op selectedModulesArea = new javax.swing.JTextArea(); selectedModulesLabel = new javax.swing.JLabel(); ingestWarningLabel = new javax.swing.JLabel(); + jSeparator2 = new javax.swing.JSeparator(); setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setPreferredSize(new java.awt.Dimension(800, 488)); profileList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); profileListPane.setViewportView(profileList); org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.profileListLabel.text")); // NOI18N - jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL); - + newProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.newProfileButton.text")); // NOI18N + newProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); newProfileButton.setMaximumSize(new java.awt.Dimension(97, 23)); newProfileButton.setMinimumSize(new java.awt.Dimension(97, 23)); newProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); @@ -115,7 +116,9 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op } }); + editProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(editProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.editProfileButton.text")); // NOI18N + editProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); editProfileButton.setMaximumSize(new java.awt.Dimension(97, 23)); editProfileButton.setMinimumSize(new java.awt.Dimension(97, 23)); editProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); @@ -125,7 +128,10 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op } }); + deleteProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(deleteProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.deleteProfileButton.text")); // NOI18N + deleteProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); + deleteProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); deleteProfileButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteProfileButtonActionPerformed(evt); @@ -168,26 +174,28 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.ingestWarningLabel.text")); // NOI18N + jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(profileListLabel)) - .addGroup(layout.createSequentialGroup() - .addGap(20, 20, 20) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(profileListPane) - .addGroup(layout.createSequentialGroup() - .addComponent(newProfileButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(profileListLabel) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(profileListPane, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(editProfileButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 98, Short.MAX_VALUE))))) - .addGap(18, 18, 18) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(6, 6, 6))) + .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(filterNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -200,56 +208,53 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addComponent(profileDescLabel)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() - .addGap(10, 10, 10) + .addGap(8, 8, 8) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(ingestWarningLabel) .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(filterDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE) - .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(selectedModulesPane, javax.swing.GroupLayout.Alignment.TRAILING)))) - .addGap(14, 14, 14)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(330, Short.MAX_VALUE) - .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(564, Short.MAX_VALUE))) + .addComponent(filterDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE) + .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE) + .addComponent(selectedModulesPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)))) + .addGap(12, 12, 12)) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteProfileButton, editProfileButton, newProfileButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(profileListLabel) - .addComponent(profileDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(profileDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(profileListLabel) + .addComponent(profileDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(filterNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(filterNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filterDescLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filterDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(selectedModulesLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(selectedModulesPane)) - .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)) - .addGap(4, 4, 4) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(deleteProfileButton) - .addComponent(ingestWarningLabel)) - .addContainerGap()) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(profileDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(filterNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(filterNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filterDescLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filterDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(selectedModulesLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(selectedModulesPane)) + .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)) + .addGap(4, 4, 4) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ingestWarningLabel)) + .addContainerGap()) + .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING))) ); }// //GEN-END:initComponents @@ -356,15 +361,16 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op option = JOptionPane.showConfirmDialog(null, panel, Bundle.ProfileSettingsPanel_title(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition()); - // While adding new profile(selectedPRofile == null), if a profile with same name already exists, do not add to the profiles hashMap. - // In case of editing an existing profile(selectedProfile != null), following check is not performed. - if (this.profiles.containsKey(panel.getProfileName()) && selectedProfile == null) { - MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), - "ProfileSettingsPanel.doFileSetsDialog.duplicateProfile.text", - panel.getProfileName())); - return; - } if (option == JOptionPane.OK_OPTION) { + + // While adding new profile(selectedPRofile == null), if a profile with same name already exists, do not add to the profiles hashMap. + // In case of editing an existing profile(selectedProfile != null), following check is not performed. + if (this.profiles.containsKey(panel.getProfileName()) && selectedProfile == null) { + MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), + "ProfileSettingsPanel.doFileSetsDialog.duplicateProfile.text", + panel.getProfileName())); + return; + } panel.saveSettings(); load(); } @@ -377,7 +383,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op @Override public void store() { - saveSettings(); } /** @@ -444,7 +449,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op private javax.swing.JLabel filterNameLabel; private javax.swing.JLabel filterNameText; private javax.swing.JLabel ingestWarningLabel; - private javax.swing.JSeparator jSeparator1; + private javax.swing.JSeparator jSeparator2; private javax.swing.JButton newProfileButton; private javax.swing.JTextArea profileDescArea; private javax.swing.JLabel profileDescLabel; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java deleted file mode 100755 index 285b916c81..0000000000 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2015 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.ingest; - -import java.awt.event.ActionEvent; -import java.util.Collections; -import javax.swing.AbstractAction; -import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Image; - -/** - * This class is used to add the action to the run ingest modules menu item. - * When the data source is pressed, it should open the wizard for ingest - * modules. - */ -final class RunIngestModulesAction extends AbstractAction { - - Content dataSource; - - /** - * the constructor - */ - public RunIngestModulesAction(Content dataSource) { - this.dataSource = dataSource; - } - - /** - * Runs the ingest modules wizard on the data source. - * - * @param e the action event - */ - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(dataSource)); - ingestDialog.display(); - } -} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java deleted file mode 100644 index f2cab6ecd1..0000000000 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2016 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.ingest; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.ArrayList; -import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; -import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType; -import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Directory; - -/** - * - * A dialog box that allows a user to configure and execute analysis of one or - * more data sources with ingest modules or analysis of the contents of a - * directory with file-level ingest modules. - */ -public final class RunIngestModulesDialog extends JDialog { - - private static final long serialVersionUID = 1L; - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); - private final IngestType ingestType; - private final List dataSources = new ArrayList<>(); - private IngestJobSettingsPanel ingestJobSettingsPanel; - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @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 analyzed. - */ - public RunIngestModulesDialog(JFrame frame, String title, boolean modal, List dataSources) { - super(frame, title, modal); - this.dataSources.addAll(dataSources); - this.ingestType = IngestType.ALL_MODULES; - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @param dataSources The data sources to be processed. - */ - public RunIngestModulesDialog(List dataSources) { - this((JFrame) WindowManager.getDefault().getMainWindow(), TITLE, true, dataSources); - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of the contents of a directory with file-level ingest modules. - * - * @param dir - */ - public RunIngestModulesDialog(Directory dir) { - this.dataSources.add(dir); - this.ingestType = IngestType.FILES_ONLY; - } - - /** - * Displays this dialog. - */ - public void display() { - setLayout(new BorderLayout()); - - /** - * Center the dialog. - */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();; - - /** - * 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(), this.ingestType); - RunIngestModulesDialog.showWarnings(ingestJobSettings); - this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings, dataSources); - setPreferredSize(this.ingestJobSettingsPanel.getPreferredSize()); - add(this.ingestJobSettingsPanel, BorderLayout.CENTER); - - // Add a start ingest button. - JButton startButton = new JButton(NbBundle.getMessage(this.getClass(), "IngestDialog.startButton.title")); - startButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - doButtonAction(true); - } - }); - - // Add a close button. - JButton closeButton = new JButton(NbBundle.getMessage(this.getClass(), "IngestDialog.closeButton.title")); - closeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - doButtonAction(false); - } - }); - - // Put the buttons in their own panel, under the settings panel. - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); - buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - buttonPanel.add(startButton); - buttonPanel.add(new javax.swing.Box.Filler(new Dimension(5, 10), new Dimension(5, 10), new Dimension(5, 10))); - buttonPanel.add(closeButton); - - add(buttonPanel, BorderLayout.SOUTH); - - /** - * Add a handler for when the dialog window is closed directly, - * bypassing the buttons. - */ - this.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - doButtonAction(false); - } - }); - - /** - * Show the dialog. - */ - int width = this.getPreferredSize().width; - int height = this.getPreferredSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); - pack(); - setVisible(true); - } - - /** - * Closes this dialog. - */ - @Deprecated - public void close() { - setVisible(false); - dispose(); - } - - /** - * Saves the ingest job settings, optionally starts an ingest job for each - * data source, then closes the dialog - * - * @param startIngestJob True if ingest job(s) should be started, false - * otherwise. - */ - private void doButtonAction(boolean startIngestJob) { - IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); - ingestJobSettings.save(); - showWarnings(ingestJobSettings); - if (startIngestJob) { - IngestManager.getInstance().queueIngestJob(RunIngestModulesDialog.this.dataSources, ingestJobSettings); - } - setVisible(false); - dispose(); - } - - private static void showWarnings(IngestJobSettings ingestJobSettings) { - List warnings = ingestJobSettings.getWarnings(); - if (warnings.isEmpty() == false) { - StringBuilder warningMessage = new StringBuilder(); - for (String warning : warnings) { - warningMessage.append(warning).append("\n"); - } - JOptionPane.showMessageDialog(null, warningMessage.toString()); - } - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @param frame The dialog parent window. - * @param title The title for the dialog. - * @param modal True if the dialog should be modal, false otherwise. - * - * @deprecated - */ - @Deprecated - public RunIngestModulesDialog(JFrame frame, String title, boolean modal) { - super(frame, title, modal); - this.ingestType = IngestType.ALL_MODULES; - } - - /** - * Constructs a dialog box that allows a user to configure and run an ingest - * job on one or more data sources. - * - * @deprecated - */ - @Deprecated - public RunIngestModulesDialog() { - this(new JFrame(TITLE), TITLE, true); - } - - /** - * Sets the data sources to be processed. - * - * @param dataSources The data sources. - * - * @deprecated - */ - @Deprecated - public void setDataSources(List dataSources) { - this.dataSources.clear(); - this.dataSources.addAll(dataSources); - } - -} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index 8c2892c558..0900e3041d 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2015 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +18,9 @@ */ package org.sleuthkit.autopsy.ingest; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.JComponent; import javax.swing.JMenuItem; @@ -26,34 +28,33 @@ import org.openide.awt.DynamicMenuContent; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Image; -import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** - * This class is used to populate the list of open dataSources to run ingest on them + * This class is used to populate the list of open dataSources to run ingest on + * them */ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { - + /** - * Creates main menu/popup menu items. It's called each time a popup menu - * is constructed and just once for the main menu. - * Main menu updates happen through the synchMenuPresenters() method. + * Creates main menu/popup menu items. It's called each time a popup menu is + * constructed and just once for the main menu. Main menu updates happen + * through the synchMenuPresenters() method. * * @return */ @Override public JComponent[] getMenuPresenters() { List dataSources = new ArrayList<>(); - - try { + + try { dataSources = Case.getCurrentCase().getDataSources(); } catch (IllegalStateException ex) { // No open Cases, create a disabled empty menu return getEmpty(); } catch (TskCoreException e) { System.out.println("Exception getting images: " + e.getMessage()); //NON-NLS - } + } JComponent[] comps = new JComponent[dataSources.size()]; // Add Images to the component list @@ -61,7 +62,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { String action = dataSources.get(i).getName(); JMenuItem menuItem = new JMenuItem(action); menuItem.setActionCommand(action.toUpperCase()); - menuItem.addActionListener(new RunIngestModulesAction(dataSources.get(i))); + menuItem.addActionListener(new RunIngestModulesAction(Collections.singletonList(dataSources.get(i)))); comps[i] = menuItem; } // If no dataSources are open, create a disabled empty menu @@ -70,7 +71,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { } return comps; } - + // returns a disabled empty menu private JComponent[] getEmpty() { JComponent[] comps = new JComponent[1]; @@ -95,5 +96,4 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { return getMenuPresenters(); } - } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties new file mode 100644 index 0000000000..6171140190 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties @@ -0,0 +1,2 @@ +IngestProfileSelectionPanel.ingestSettingsButton.text=Ingest Settings +IngestProfileSelectionPanel.profileListLabel.text=Select Profile: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties new file mode 100644 index 0000000000..39d7a2632b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties @@ -0,0 +1 @@ +RunIngestModulesAction.name=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java new file mode 100644 index 0000000000..15a83b38cf --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java @@ -0,0 +1,87 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; + +class IngestModulesConfigWizardPanel implements WizardDescriptor.FinishablePanel { + + @NbBundle.Messages("IngestModulesConfigWizardPanel.name.text=Configure Ingest Modules") + /** + * The visual ingestJobSettingsPanel that displays this panel. If you need + * to access the ingestJobSettingsPanel from this class, just use + * getComponent(). + */ + private IngestJobSettingsPanel ingestJobSettingsPanel; + + // Get the visual ingestJobSettingsPanel for the panel. In this template, the ingestJobSettingsPanel + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + @Override + public IngestJobSettingsPanel getComponent() { + if (ingestJobSettingsPanel == null) { + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModulesAction.getDefaultContext())); + } + ingestJobSettingsPanel.setName(Bundle.IngestModulesConfigWizardPanel_name_text()); + return ingestJobSettingsPanel; + } + + @Override + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + } + + @Override + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + } + + @Override + public void addChangeListener(ChangeListener l) { + } + + @Override + public void removeChangeListener(ChangeListener l) { + } + + @Override + public void readSettings(WizardDescriptor wiz) { + } + + @Override + public void storeSettings(WizardDescriptor wiz) { + IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); + ingestJobSettings.save(); + wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS + } + + @Override + public boolean isFinishPanel() { + return true; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form new file mode 100644 index 0000000000..b5442660c1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form @@ -0,0 +1,102 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java new file mode 100644 index 0000000000..7be4dcdc5f --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -0,0 +1,289 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.Color; +import java.awt.Component; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Collections; +import java.util.List; +import static javax.swing.Box.createVerticalGlue; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; +import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; +import org.sleuthkit.autopsy.ingest.IngestProfiles; +import org.sleuthkit.autopsy.ingest.IngestProfiles.IngestProfile; + +/** + * Visual panel for the choosing of ingest profiles by the user when running + * ingest. + */ +final class IngestProfileSelectionPanel extends JPanel implements ItemListener { + + @Messages({"IngestProfileSelectionPanel.customSettings.name=Custom Settings", + "IngestProfileSelectionPanel.customSettings.description=configure individual module settings in next step of wizard"}) + + private static final String CUSTOM_SETTINGS_DISPLAY_NAME = Bundle.IngestProfileSelectionPanel_customSettings_name(); + private static final String CUSTOM_SETTINGS_DESCRIPTION = Bundle.IngestProfileSelectionPanel_customSettings_description(); + private final IngestProfileSelectionWizardPanel wizardPanel; + private String selectedProfile; + private List profiles = Collections.emptyList(); + + /** + * Creates new IngestProfileSelectionPanel + * + * @param panel - the WizardPanel which contains this panel + * @param lastSelectedProfile - the profile that will be selected initially + */ + IngestProfileSelectionPanel(IngestProfileSelectionWizardPanel panel, String lastSelectedProfile) { + initComponents(); + wizardPanel = panel; + selectedProfile = lastSelectedProfile; + + populateListOfCheckboxes(); + } + + /** + * Returns the profile that is currently selected in this panel + * + * @return selectedProfile + */ + String getLastSelectedProfile() { + return selectedProfile; + } + + /** + * Adds a radio button for custom settings as well as one for each profile + * that has been created to the panel containing them. + */ + private void populateListOfCheckboxes() { + profiles = getProfiles(); + GridBagLayout gridBagLayout = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridx = 0; + constraints.gridy = 0; + constraints.weighty = .0; + constraints.anchor = GridBagConstraints.FIRST_LINE_START; + + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModulesAction.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION, gridBagLayout, constraints); + for (IngestProfile profile : profiles) { + constraints.weightx = 0; + constraints.gridy++; + constraints.gridx = 0; + addRadioButton(profile.toString(), profile.toString(), profile.getDescription(), gridBagLayout, constraints); + } + //Add vertical glue at the bottom of the scroll panel so spacing + //between elements is less dependent on the number of elements + constraints.gridy++; + constraints.gridx = 0; + constraints.weighty = 1; + Component vertGlue = createVerticalGlue(); + profileListPanel.add(vertGlue); + gridBagLayout.setConstraints(vertGlue, constraints); + profileListPanel.setLayout(gridBagLayout); + } + + /** + * Creates and configures a single radio button before adding it to both the + * button group and the panel. + * + * @param profileDisplayName - the name of the profile the user should see + * @param profileContextName - the name the profile will be recognized as + * programmatically + * @param profileDesc - the description of the profile + */ + private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc, GridBagLayout layout, GridBagConstraints constraints) { + String displayText = profileDisplayName + " - " + profileDesc; + JRadioButton myRadio = new JRadioButton(); + //Using a JTextArea as though it is a label in order to get multi-line support + JTextArea myLabel = new JTextArea(displayText); + Color gray = new Color(240, 240, 240); //matches background of panel + myLabel.setBackground(gray); + myLabel.setEditable(false); + myLabel.setWrapStyleWord(true); + myLabel.setLineWrap(true); + myRadio.setName(profileContextName); + myRadio.setToolTipText(profileDesc); + myRadio.addItemListener(this); + if (profileContextName.equals(selectedProfile)) { + myRadio.setSelected(true); + } + profileListButtonGroup.add(myRadio); + profileListPanel.add(myRadio); + layout.setConstraints(myRadio, constraints); + constraints.gridx++; + constraints.weightx = 1; + profileListPanel.add(myLabel); + layout.setConstraints(myLabel, constraints); + } + + /** + * Getter for the list of profiles + * + * @return profiles + */ + private List getProfiles() { + if (profiles.isEmpty()) { + fetchProfileList(); + } + return profiles; + } + + /** + * Remove everything from the list of checkboxes. + */ + private void clearListOfCheckBoxes() { + profileListButtonGroup = new javax.swing.ButtonGroup(); + profileListPanel.removeAll(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + profileListButtonGroup = new javax.swing.ButtonGroup(); + ingestSettingsButton = new javax.swing.JButton(); + profileListScrollPane = new javax.swing.JScrollPane(); + profileListPanel = new javax.swing.JPanel(); + profileListLabel = new javax.swing.JLabel(); + + setMaximumSize(new java.awt.Dimension(5750, 3000)); + setPreferredSize(new java.awt.Dimension(625, 450)); + + org.openide.awt.Mnemonics.setLocalizedText(ingestSettingsButton, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.ingestSettingsButton.text")); // NOI18N + ingestSettingsButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ingestSettingsButtonActionPerformed(evt); + } + }); + + profileListScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + profileListPanel.setAutoscrolls(true); + profileListPanel.setLayout(new java.awt.GridBagLayout()); + profileListScrollPane.setViewportView(profileListPanel); + + org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.profileListLabel.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(profileListScrollPane) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ingestSettingsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(profileListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 523, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(profileListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(profileListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(ingestSettingsButton) + .addGap(18, 18, 18)) + ); + }// //GEN-END:initComponents + + /** + * Opens up a dialog with an IngestOptionsPanel so the user can modify any + * settings from that options panel. + * + * @param evt the button press + */ + private void ingestSettingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestSettingsButtonActionPerformed + final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); + IngestOptionsPanel ingestOptions = new IngestOptionsPanel(); + ingestOptions.load(); + dialog.addApplyButtonListener( + (ActionEvent e) -> { + ingestOptions.store(); + clearListOfCheckBoxes(); + fetchProfileList(); + profileListPanel.revalidate(); + profileListPanel.repaint(); + populateListOfCheckboxes(); + dialog.close(); + } + ); + dialog.display(ingestOptions); + }//GEN-LAST:event_ingestSettingsButtonActionPerformed + + boolean isLastPanel = false; + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton ingestSettingsButton; + private javax.swing.ButtonGroup profileListButtonGroup; + private javax.swing.JLabel profileListLabel; + private javax.swing.JPanel profileListPanel; + private javax.swing.JScrollPane profileListScrollPane; + // End of variables declaration//GEN-END:variables + + /** + * Listens for changes and checks the currently selected radio button if + * custom settings button is enabled it enables the next button, otherwise + * it enables the Finish button. + * + * @param e + */ + @Override + public void itemStateChanged(ItemEvent e) { + for (Component rButton : profileListPanel.getComponents()) { + if (rButton instanceof JRadioButton){ + JRadioButton jrb = (JRadioButton) rButton; + if (jrb.isSelected()) { + selectedProfile = jrb.getName(); + break; + } + } + } + boolean wasLastPanel = isLastPanel; + isLastPanel = !selectedProfile.equals(RunIngestModulesAction.getDefaultContext()); + wizardPanel.fireChangeEvent(); + this.firePropertyChange("LAST_ENABLED", wasLastPanel, isLastPanel); //NON-NLS + } + + /** + * Get all the currently existing ingest profiles. + */ + private void fetchProfileList() { + profiles = IngestProfiles.getIngestProfiles(); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java new file mode 100644 index 0000000000..ed164a585b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -0,0 +1,124 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.util.HashSet; +import java.util.Set; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.autopsy.coreutils.ModuleSettings; + +/** + * The first wizard panel of the run ingest modules wizard. Displays the profile + * selection panel and is only created when profiles exist. + * + */ +class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePanel { + + @Messages("IngestProfileWizardPanel.panelName=Ingest Profile Selection") + + private final Set listeners = new HashSet<>(1); + private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS + private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private IngestProfileSelectionPanel component; + private String lastProfileUsed; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + @Override + public IngestProfileSelectionPanel getComponent() { + if (component == null) { + if (ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null + || ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { + lastProfileUsed = RunIngestModulesAction.getDefaultContext(); + } else { + lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); + } + component = new IngestProfileSelectionPanel(this, lastProfileUsed); + component.setName(Bundle.IngestProfileWizardPanel_panelName()); + } + return component; + } + + @Override + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + } + + @Override + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + } + + /** + * Fires a change event to notify listeners that changes have taken place. + */ + protected final void fireChangeEvent() { + Set ls; + synchronized (listeners) { + ls = new HashSet<>(listeners); + } + ChangeEvent ev = new ChangeEvent(this); + for (ChangeListener l : ls) { + l.stateChanged(ev); + } + } + + @Override + public void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + + @Override + public void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + + @Override + public void readSettings(WizardDescriptor wiz) { + } + + @Override + public void storeSettings(WizardDescriptor wiz) { + lastProfileUsed = component.getLastSelectedProfile(); + wiz.putProperty("executionContext", lastProfileUsed); //NON-NLS + ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME, lastProfileUsed); + } + + @Override + public boolean isFinishPanel() { + return component.isLastPanel; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java new file mode 100755 index 0000000000..4636ff72f4 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -0,0 +1,120 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.event.ActionEvent; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JOptionPane; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestManager; +import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.Directory; + +/** + * This class is used to add the action to the run ingest modules menu item. + * When the data source is pressed, it should open the wizard for ingest + * modules. + */ +public final class RunIngestModulesAction extends AbstractAction { + + @Messages("RunIngestModulesAction.name=Run Ingest Modules") + + //'dialog' context name required so existing settings do not need to be reconfigured + private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog"; + + /** + * Returns the name of the default context which will be used when profiles + * are not available. + * + * @return the DEFAULT_CONTEXT + */ + static String getDefaultContext() { + return DEFAULT_CONTEXT; + } + + private final List dataSources = new ArrayList<>(); + private final IngestJobSettings.IngestType ingestType; + + /** + * Creates an action which will make a run ingest modules wizard when it is + * performed. + * + * @param dataSources - the data sources you want to run ingest on + */ + public RunIngestModulesAction(List dataSources) { + this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); + this.dataSources.addAll(dataSources); + this.ingestType = IngestJobSettings.IngestType.ALL_MODULES; + } + + /** + * Creates an action which will make a run ingest modules wizard when it is + * performed. + * + * @param dir - the directory you want to run ingest on + */ + public RunIngestModulesAction(Directory dir) { + this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); + this.dataSources.add(dir); + this.ingestType = IngestJobSettings.IngestType.FILES_ONLY; + } + + /** + * Opens a run ingest modules wizard with the list of data sources. + * + * @param e the action event + */ + @Override + public void actionPerformed(ActionEvent e) { + WizardDescriptor wiz = new WizardDescriptor(new RunIngestModulesWizardIterator()); + // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() + wiz.setTitleFormat(new MessageFormat("{0}")); + wiz.setTitle(Bundle.RunIngestModulesAction_name()); + + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { + String executionContext = (String) wiz.getProperty("executionContext"); //NON-NLS + IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext, this.ingestType); + showWarnings(ingestJobSettings); + IngestManager.getInstance().queueIngestJob(this.dataSources, ingestJobSettings); + } + } + + /** + * Display any warnings that the ingestJobSettings have. + * + * @param ingestJobSettings + */ + private static void showWarnings(IngestJobSettings ingestJobSettings) { + List warnings = ingestJobSettings.getWarnings(); + if (warnings.isEmpty() == false) { + StringBuilder warningMessage = new StringBuilder(); + for (String warning : warnings) { + warningMessage.append(warning).append("\n"); + } + JOptionPane.showMessageDialog(null, warningMessage.toString()); + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java new file mode 100644 index 0000000000..c02b2153f4 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -0,0 +1,122 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import javax.swing.JComponent; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.sleuthkit.autopsy.ingest.IngestProfiles; + +/** + * Iterator class for creating a wizard for run ingest modules. + * + */ +final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator { + + private int index; + + private List> panels; + + /** + * Gets the list of panels used by this wizard for iterating over. + * Constructing it when it is null. + * + * @return panels - the list of of WizardDescriptor panels + */ + private List> getPanels() { + if (panels == null) { + panels = new ArrayList<>(); + List profiles = IngestProfiles.getIngestProfiles(); + if (!profiles.isEmpty()) { + panels.add(new IngestProfileSelectionWizardPanel()); + } + + panels.add(new IngestModulesConfigWizardPanel()); + String[] steps = new String[panels.size()]; + for (int i = 0; i < panels.size(); i++) { + Component c = panels.get(i).getComponent(); + // Default step name to component name of panel. + steps[i] = c.getName(); + if (c instanceof JComponent) { // assume Swing components + JComponent jc = (JComponent) c; + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); + jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true); + } + } + } + return panels; + } + + @Override + public WizardDescriptor.FinishablePanel current() { + return getPanels().get(index); + } + + @Override + public String name() { + return index + 1 + ". from " + getPanels().size(); + } + + @Override + public boolean hasNext() { + return (index < getPanels().size() - 1) && !current().isFinishPanel(); + } + + @Override + public boolean hasPrevious() { + return index > 0; + } + + @Override + public void nextPanel() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + index++; + } + + @Override + public void previousPanel() { + if (!hasPrevious()) { + throw new NoSuchElementException(); + } + index--; + } + + // If nothing unusual changes in the middle of the wizard, simply: + @Override + public void addChangeListener(ChangeListener l) { + } + + @Override + public void removeChangeListener(ChangeListener l) { + } + // If something changes dynamically (besides moving between panels), e.g. + // the number of panels changes in response to user input, then use + // ChangeSupport to implement add/removeChangeListener and call fireChange + // when needed + +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java index 3365d33eb3..3d63742c2e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2011-2016 Basis Technology Corp. + * + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature; /** @@ -43,7 +43,7 @@ final class AddFileTypeSignatureDialog extends JDialog { private static final long serialVersionUID = 1L; private final AddFileTypeSignaturePanel addFileTypeSigPanel; - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); + private static final String TITLE = NbBundle.getMessage(RunIngestModulesAction.class, "RunIngestModulesAction.name"); private Signature signature; private BUTTON_PRESSED result; diff --git a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties index 8eb490c76e..2588954fb9 100644 --- a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties +++ b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties @@ -1,5 +1,5 @@ #Updated by build script -#Mon, 02 Jan 2017 18:41:13 -0500 +#Mon, 30 Jan 2017 13:39:12 -0500 LBL_splash_window_title=Starting Autopsy SPLASH_HEIGHT=314 SPLASH_WIDTH=538 diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties index 756018bd64..0fe774eeab 100644 --- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties +++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties @@ -1,4 +1,4 @@ #Updated by build script -#Mon, 02 Jan 2017 18:41:13 -0500 +#Mon, 30 Jan 2017 13:39:12 -0500 CTL_MainWindow_Title=Autopsy 4.3.0 CTL_MainWindow_Title_No_Project=Autopsy 4.3.0