diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java index d1d277f2a7..ec643d4d81 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java @@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import org.openide.WizardDescriptor; /** - * An abstract class which provides providing a method which can be checked by + * An abstract class providing a method which can be checked by * the iterator containing panels of this type. So that Wizards containing these * panels can enable finish before the last panel. */ @@ -32,7 +32,7 @@ abstract class EarlyFinishWizardDescriptorPanel implements WizardDescriptor.Pane * * @return true or false */ - boolean isLastPanel(){ + boolean skipRemainingPanels(){ /* * This class should be overriden by any panel that might want to * enable the finish button early for its wizard. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 898771b29c..0113651ca0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -75,7 +75,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void populateListOfCheckboxes() { profiles = getProfiles(); - addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModulesAction.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); for (IngestProfile profile : profiles) { addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); } @@ -243,7 +243,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { } } boolean wasLastPanel = isLastPanel; - if (selectedProfile.equals(RunIngestModuleWizardIterator.getDefaultContext())) { + if (selectedProfile.equals(RunIngestModulesAction.getDefaultContext())) { isLastPanel = false; } else { isLastPanel = true; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java index 71fabd2aa8..ca36bdb322 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java @@ -28,21 +28,22 @@ import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.sleuthkit.autopsy.ingest.IngestProfileMap; +/** + * Iterator class for creating a wizard for run ingest modules. + * + */ final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator { - private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; - private int index; private List panels; /** - * @return the DEFAULT_CONTEXT + * 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 */ - static String getDefaultContext() { - return DEFAULT_CONTEXT; - } - private List getPanels() { if (panels == null) { panels = new ArrayList<>(); @@ -80,9 +81,10 @@ final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator listeners = new HashSet(1); @@ -47,7 +52,7 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { 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 = RunIngestModuleWizardIterator.getDefaultContext(); + lastProfileUsed = RunIngestModulesAction.getDefaultContext(); } else { lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); } @@ -56,8 +61,15 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { return component; } + /** + * Returns whether or not this should be considered the last panel of the + * wizard. Returns true when a profile is selected, and false when + * custom settings is selected. + * + * @return true or false + */ @Override - boolean isLastPanel() { + boolean skipRemainingPanels() { return component.isLastPanel; } @@ -71,12 +83,11 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { public boolean isValid() { // If it is always OK to press Next or Finish, then: return true; - // If it depends on some condition (form filled out...) and - // this condition changes (last form field filled in...) then - // use ChangeSupport to implement add/removeChangeListener below. - // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. } + /** + * Fires a change event to notify listeners that changes have taken place. + */ protected final void fireChangeEvent() { Set ls; synchronized (listeners) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java index 6cacb9f890..91f34d4bea 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java @@ -27,7 +27,6 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { /** - * f * The visual ingestJobSettingsPanel that displays this panel. If you need * to access the ingestJobSettingsPanel from this class, just use * getComponent(). @@ -41,7 +40,7 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { @Override public IngestJobSettingsPanel getComponent() { if (ingestJobSettingsPanel == null) { - ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModuleWizardIterator.getDefaultContext())); + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModulesAction.getDefaultContext())); } return ingestJobSettingsPanel; } @@ -50,18 +49,12 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { public HelpCtx getHelp() { // Show no Help button for this panel: return HelpCtx.DEFAULT_HELP; - // If you have context help: - // return new HelpCtx("help.key.here"); } @Override public boolean isValid() { // If it is always OK to press Next or Finish, then: return true; - // If it depends on some condition (form filled out...) and - // this condition changes (last form field filled in...) then - // use ChangeSupport to implement add/removeChangeListener below. - // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. } @Override @@ -74,14 +67,13 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { @Override public void readSettings(WizardDescriptor wiz) { - // use wiz.getProperty to retrieve previous panel state } @Override public void storeSettings(WizardDescriptor wiz) { IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); - wiz.putProperty("executionContext", RunIngestModuleWizardIterator.getDefaultContext()); //NON-NLS + wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index 730b1990cf..d0ac6180d7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -39,15 +39,29 @@ import org.sleuthkit.datamodel.Directory; * modules. */ public final class RunIngestModulesAction extends AbstractAction { - + @Messages("RunIngestModulesAction.name=Run Ingest Modules") + private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; + + /** + * 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; /** - * the constructor - * @param dataSources + * 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()); @@ -56,8 +70,10 @@ public final class RunIngestModulesAction extends AbstractAction { } /** - * the constructor - * @param dir + * 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()); @@ -65,7 +81,7 @@ public final class RunIngestModulesAction extends AbstractAction { this.ingestType = IngestJobSettings.IngestType.FILES_ONLY; } /** - * Runs the ingest modules wizard on the data source. + * Opens a run ingest modules wizard with the list of data sources. * * @param e the action event */ @@ -84,6 +100,11 @@ public final class RunIngestModulesAction extends AbstractAction { } } + /** + * Display any warnings that the ingestJobSettings have. + * + * @param ingestJobSettings + */ private static void showWarnings(IngestJobSettings ingestJobSettings) { List warnings = ingestJobSettings.getWarnings(); if (warnings.isEmpty() == false) {