From b99efaf031cb4a28efe399851c36bdafab53bf21 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 6 Feb 2017 16:05:00 -0500 Subject: [PATCH 1/6] 2199 addImageWizard working with profiles --- .../AddImageWizardChooseDataSourcePanel.java | 7 ++- .../AddImageWizardIngestConfigPanel.java | 48 ++++++++++++++++--- .../casemodule/AddImageWizardIterator.java | 26 ++++++++-- .../ingest/IngestJobSettingsPanel.java | 2 +- .../IngestProfileSelectionPanel.java | 4 +- .../IngestProfileSelectionWizardPanel.java | 26 +++++++--- .../RunIngestModulesWizardIterator.java | 14 ++++-- 7 files changed, 102 insertions(+), 25 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java index 88762ba96a..e845b89349 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java @@ -38,7 +38,7 @@ import java.awt.Cursor; * The "Add Image" wizard panel1 handling the logic of selecting image file(s) * to add to Case, and pick the time zone. */ -class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.Panel, PropertyChangeListener { +class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.FinishablePanel, PropertyChangeListener { /** * The visual component that displays this panel. If you need to access the @@ -232,4 +232,9 @@ class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.Panel { +class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePanel { - private final IngestJobSettingsPanel ingestJobSettingsPanel; + private IngestJobSettingsPanel ingestJobSettingsPanel; /** * The visual component that displays this panel. If you need to access the * component from this class, just use getComponent(). */ private Component component = null; - + private String lastProfileUsed = AddImageWizardIngestConfigPanel.class.getCanonicalName(); private final List newContents = Collections.synchronizedList(new ArrayList()); private boolean ingested = false; private boolean readyToIngest = false; @@ -76,8 +77,9 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel> panels; private AddImageAction action; + private int progressPanelIndex; + private int profileSelectionIndex; AddImageWizardIterator(AddImageAction action) { this.action = action; @@ -53,11 +58,17 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator profileMap = new IngestProfileMap().getIngestProfileMap(); + if (!profileMap.isEmpty()) { + panels.add(profileSelectionPanel); + } + panels.add(ingestConfigPanel); panels.add(progressPanel); - + progressPanelIndex = panels.indexOf(progressPanel); //Doing programatically incase more panels added + profileSelectionIndex = panels.indexOf(profileSelectionPanel); //will be -1 if it wasn't added String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); @@ -146,7 +157,16 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator { +public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel { private final Set listeners = new HashSet<>(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS @@ -42,6 +42,18 @@ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePa */ private IngestProfileSelectionPanel component; private String lastProfileUsed; + private final String defaultContext; + + public IngestProfileSelectionWizardPanel(String defaultContext) { + this.defaultContext = defaultContext; + } + + /** + * @return the defaultContext + */ + String getDefaultContext() { + return defaultContext; + } // 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 @@ -50,17 +62,17 @@ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePa @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 { + if (!(ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null) + && !ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); + } else { + lastProfileUsed = getDefaultContext(); } component = new IngestProfileSelectionPanel(this, lastProfileUsed); } return component; } - + @Override public HelpCtx getHelp() { // Show no Help button for this panel: @@ -110,9 +122,9 @@ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePa lastProfileUsed = component.getLastSelectedProfile(); wiz.putProperty("executionContext", lastProfileUsed); //NON-NLS ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME, lastProfileUsed); + System.out.println("STORED LAST PROFILE USED AS: " + lastProfileUsed); } - @Override public boolean isFinishPanel() { return component.isLastPanel; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index 7354255456..c7bae2a5e0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -35,8 +35,9 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap; final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator { private int index; + private int profilePanelIndex; - private List> panels; + private List> panels; /** * Gets the list of panels used by this wizard for iterating over. @@ -44,15 +45,17 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< * * @return panels - the list of of WizardDescriptor panels */ - private List> getPanels() { + private List> getPanels() { if (panels == null) { panels = new ArrayList<>(); + IngestProfileSelectionWizardPanel profilePanel = new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext()); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { - panels.add(new IngestProfileSelectionWizardPanel()); + panels.add(profilePanel); } panels.add(new IngestModulesConfigWizardPanel()); + profilePanelIndex=panels.indexOf(profilePanel); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); @@ -72,7 +75,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< } @Override - public WizardDescriptor.FinishablePanel current() { + public WizardDescriptor.Panel current() { return getPanels().get(index); } @@ -84,7 +87,8 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< @Override public boolean hasNext() { - return (index < getPanels().size() - 1) && !current().isFinishPanel(); + return (index < getPanels().size() - 1 && + !(index == profilePanelIndex && ((IngestProfileSelectionWizardPanel)current()).isFinishPanel())); } @Override From 288a993aafbfb55cfe71470511f49d434b797321 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 6 Feb 2017 17:43:47 -0500 Subject: [PATCH 2/6] 2199 Changed from casting to abstract class use and other clean up --- .../AddImageWizardAddingProgressPanel.java | 7 +- .../AddImageWizardChooseDataSourcePanel.java | 8 +-- .../AddImageWizardIngestConfigPanel.java | 34 ++++------ .../casemodule/AddImageWizardIterator.java | 49 +++++++++----- .../IngestModulesConfigWizardPanel.java | 7 +- .../IngestProfileSelectionWizardPanel.java | 37 +++++++---- .../RunIngestModulesWizardIterator.java | 14 ++-- .../ShortcutWizardDescriptorPanel.java | 64 +++++++++++++++++++ 8 files changed, 145 insertions(+), 75 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java index 7204664d2f..50134fa88a 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java @@ -30,6 +30,7 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; /** * The final panel of the add image wizard. It displays a progress bar and @@ -39,7 +40,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgress * {@link AddImageWizardIngestConfigPanel} (which is a bit weird if you ask m * -jm) */ -class AddImageWizardAddingProgressPanel implements WizardDescriptor.FinishablePanel { +class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel { /** * flag to indicate that the image adding process is finished and this panel @@ -239,8 +240,4 @@ class AddImageWizardAddingProgressPanel implements WizardDescriptor.FinishablePa getComponent().showErrors(errorString, critical); } - @Override - public boolean isFinishPanel() { - return true; - } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java index e845b89349..259cb4f4d3 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java @@ -33,12 +33,13 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.openide.windows.WindowManager; import java.awt.Cursor; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; /** * The "Add Image" wizard panel1 handling the logic of selecting image file(s) * to add to Case, and pick the time zone. */ -class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.FinishablePanel, PropertyChangeListener { +class AddImageWizardChooseDataSourcePanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener { /** * The visual component that displays this panel. If you need to access the @@ -232,9 +233,4 @@ class AddImageWizardChooseDataSourcePanel implements WizardDescriptor.Finishable public void propertyChange(PropertyChangeEvent evt) { fireChangeEvent(); } - - @Override - public boolean isFinishPanel() { - return false; - } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index ccdd0c1426..a37df4227a 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java @@ -40,6 +40,8 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; import org.sleuthkit.autopsy.ingest.IngestManager; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; /** * second panel of add image wizard, allows user to configure ingest modules. @@ -47,7 +49,7 @@ import org.sleuthkit.autopsy.ingest.IngestManager; * TODO: review this for dead code. think about moving logic of adding image to * 3rd panel( {@link AddImageWizardAddingProgressPanel}) separate class -jm */ -class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePanel { +class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { private IngestJobSettingsPanel ingestJobSettingsPanel; @@ -60,7 +62,6 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane private final List newContents = Collections.synchronizedList(new ArrayList()); private boolean ingested = false; private boolean readyToIngest = false; - // task that will clean up the created database file if the wizard is cancelled before it finishes private AddImageAction.CleanupTask cleanupTask; @@ -79,7 +80,6 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); showWarnings(ingestJobSettings); - System.out.println("LAST PROFILE USED CREATE: " + lastProfileUsed); this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); } @@ -162,12 +162,9 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane */ @Override public void readSettings(WizardDescriptor settings) { - String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS //WJS-TODO remove these copies, leaving copies in IngestProfileSelectionWizardPanel - String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS - if (!(ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null) - && !ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { - lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); - System.out.println("LAST PROFILE USED READ: " + lastProfileUsed); + if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null) + && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) { + lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()); } IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); showWarnings(ingestJobSettings); @@ -200,7 +197,6 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane public void storeSettings(WizardDescriptor settings) { IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); - System.out.println("LAST PROFILE USED STORE: " + lastProfileUsed); ingestJobSettings.save(); showWarnings(ingestJobSettings); @@ -220,13 +216,12 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane } } - void skippingThisPanel() { - String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS //WJS-TODO remove these copies, leaving copies in IngestProfileSelectionWizardPanel - String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS - if (!(ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null) - && !ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { - lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); - System.out.println("LAST PROFILE USED READ: " + lastProfileUsed); + + @Override + public void processThisPanelBeforeSkipped() { + if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null) + && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) { + lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()); } IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); showWarnings(ingestJobSettings); @@ -355,9 +350,4 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.FinishablePane } } - - @Override - public boolean isFinishPanel() { - return false; - } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java index c8bc86b17b..51aaab6313 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java @@ -29,6 +29,7 @@ import org.openide.WizardDescriptor; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.ingest.IngestProfileMap; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; /** * The iterator class for the "Add Image" wizard panel. This class is used to @@ -37,11 +38,11 @@ import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelection class AddImageWizardIterator implements WizardDescriptor.Iterator { private int index = 0; - private List> panels; + private List panels; private AddImageAction action; private int progressPanelIndex; - private int profileSelectionIndex; - + private final static String PROP_LASTPROFILE_NAME = "AIW_LASTPROFILE_NAME"; //NON-NLS + AddImageWizardIterator(AddImageAction action) { this.action = action; } @@ -50,25 +51,23 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator> getPanels() { + private List getPanels() { if (panels == null) { - panels = new ArrayList>(); + panels = new ArrayList<>(); AddImageWizardAddingProgressPanel progressPanel = new AddImageWizardAddingProgressPanel(); AddImageWizardChooseDataSourcePanel dsPanel = new AddImageWizardChooseDataSourcePanel(progressPanel); AddImageWizardIngestConfigPanel ingestConfigPanel = new AddImageWizardIngestConfigPanel(dsPanel, action, progressPanel); - IngestProfileSelectionWizardPanel profileSelectionPanel = new IngestProfileSelectionWizardPanel(AddImageWizardIngestConfigPanel.class.getCanonicalName()); + IngestProfileSelectionWizardPanel profileSelectionPanel = new IngestProfileSelectionWizardPanel(AddImageWizardIngestConfigPanel.class.getCanonicalName(), getPropLastprofileName()); panels.add(dsPanel); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { panels.add(profileSelectionPanel); } - panels.add(ingestConfigPanel); panels.add(progressPanel); - progressPanelIndex = panels.indexOf(progressPanel); //Doing programatically incase more panels added - profileSelectionIndex = panels.indexOf(profileSelectionPanel); //will be -1 if it wasn't added + progressPanelIndex = panels.indexOf(progressPanel); //Doing programatically because number of panels is variable String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); @@ -101,14 +100,32 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator current() { + public ShortcutWizardDescriptorPanel current() { if (panels != null) { return panels.get(index); } else { @@ -157,14 +174,12 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator { +class IngestModulesConfigWizardPanel extends ShortcutWizardDescriptorPanel { /** * The visual ingestJobSettingsPanel that displays this panel. If you need @@ -76,9 +76,4 @@ class IngestModulesConfigWizardPanel implements WizardDescriptor.FinishablePanel wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS } - @Override - public boolean isFinishPanel() { - return true; - } - } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index edfe5e1513..67abe8d3f7 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -31,10 +31,11 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; * selection panel and is only created when profiles exist. * */ -public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel { +public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorPanel { + + 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 @@ -42,9 +43,11 @@ public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel */ private IngestProfileSelectionPanel component; private String lastProfileUsed; + private final String lastProfilePropertyName; private final String defaultContext; - public IngestProfileSelectionWizardPanel(String defaultContext) { + public IngestProfileSelectionWizardPanel(String defaultContext, String lastProfilePropertyName) { + this.lastProfilePropertyName = lastProfilePropertyName; this.defaultContext = defaultContext; } @@ -54,7 +57,15 @@ public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel String getDefaultContext() { return defaultContext; } - + + /** + * Gets the name of the file which stores the last profile used properties. + * + * @return the LAST_PROFILE_PROPERTIES_FILE + */ + public static String getLastProfilePropertiesFile() { + return LAST_PROFILE_PROPERTIES_FILE; + } // 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 @@ -62,9 +73,9 @@ public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel @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 = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); + if (!(ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName) == null) + && !ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName).isEmpty()) { + lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName); } else { lastProfileUsed = getDefaultContext(); } @@ -121,12 +132,16 @@ public class IngestProfileSelectionWizardPanel implements WizardDescriptor.Panel public void storeSettings(WizardDescriptor wiz) { lastProfileUsed = component.getLastSelectedProfile(); wiz.putProperty("executionContext", lastProfileUsed); //NON-NLS - ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME, lastProfileUsed); - System.out.println("STORED LAST PROFILE USED AS: " + lastProfileUsed); + ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName, lastProfileUsed); } - public boolean isFinishPanel() { + @Override + public boolean skipNextPanel() { return component.isLastPanel; } - + + @Override + public boolean panelEnablesSkipping(){ + return true; + } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index c7bae2a5e0..092b616f73 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -35,9 +35,8 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap; final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator { private int index; - private int profilePanelIndex; - - private List> panels; + private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS + private List panels; /** * Gets the list of panels used by this wizard for iterating over. @@ -45,17 +44,16 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< * * @return panels - the list of of WizardDescriptor panels */ - private List> getPanels() { + private List getPanels() { if (panels == null) { panels = new ArrayList<>(); - IngestProfileSelectionWizardPanel profilePanel = new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext()); + IngestProfileSelectionWizardPanel profilePanel = new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext(), PROP_LASTPROFILE_NAME); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { panels.add(profilePanel); } panels.add(new IngestModulesConfigWizardPanel()); - profilePanelIndex=panels.indexOf(profilePanel); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); @@ -75,7 +73,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< } @Override - public WizardDescriptor.Panel current() { + public ShortcutWizardDescriptorPanel current() { return getPanels().get(index); } @@ -88,7 +86,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< @Override public boolean hasNext() { return (index < getPanels().size() - 1 && - !(index == profilePanelIndex && ((IngestProfileSelectionWizardPanel)current()).isFinishPanel())); + !(current().panelEnablesSkipping() && current().skipNextPanel())); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java new file mode 100644 index 0000000000..35c9cf7705 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java @@ -0,0 +1,64 @@ +/* + * 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 org.openide.WizardDescriptor; + +/** + * An abstract class providing a methods which can be checked by + * the iterator containing panels of this type. So that Wizards containing these + * panels can skip panels, but still call necessary methods of those panels. + */ +public abstract class ShortcutWizardDescriptorPanel implements WizardDescriptor.Panel { + + /** + * Whether or not this panel under the correct conditions can enable the skipping of the panel after it. + * @return true or false + */ + public boolean panelEnablesSkipping(){ + /* + * This method should be overriden by any panel that might want to + * enable the iterator to skip the panel that comes after it. + */ + return false; + } + + /** + * Whether or not the panel immediately following this one should be skipped . + * + * @return true or false + */ + public boolean skipNextPanel(){ + /* + * This method should be overriden by any panel that might want to + * enable the iterator to skip the panel that comes after it. + */ + return false; + } + + /** + * Provides a method which will allow code to be executed in a panel you plan to skip + */ + public void processThisPanelBeforeSkipped(){ + /* + * If you need to perform some actions of this panel before it is skipped + * override this method to have it call the necessary code. + */ + } +} From cd82f49d45a15e9869b60fded558b657eae929d6 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 14 Feb 2017 17:12:15 -0500 Subject: [PATCH 3/6] 2199 resolve conflicts from merge and fix formatting on modified files --- .../AddImageWizardAddingProgressPanel.java | 2 +- .../AddImageWizardChooseDataSourcePanel.java | 2 +- .../AddImageWizardIngestConfigPanel.java | 3 +- .../casemodule/AddImageWizardIterator.java | 29 ++++++-------- .../ingest/IngestJobSettingsPanel.java | 2 +- .../IngestProfileSelectionWizardPanel.java | 15 ++++--- .../RunIngestModulesWizardIterator.java | 13 ++---- .../ShortcutWizardDescriptorPanel.java | 40 ++++++++++--------- 8 files changed, 49 insertions(+), 57 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java index 50134fa88a..c39e541f25 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.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"); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java index 259cb4f4d3..65847a6eba 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 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/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index a37df4227a..e137875e1a 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.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"); @@ -216,7 +216,6 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { } } - @Override public void processThisPanelBeforeSkipped() { if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java index 51aaab6313..8616f5bc67 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,12 +22,11 @@ import java.awt.Component; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; -import java.util.TreeMap; import javax.swing.JComponent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.ingest.IngestProfileMap; +import org.sleuthkit.autopsy.ingest.IngestProfiles; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; @@ -42,7 +41,7 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator profileMap = new IngestProfileMap().getIngestProfileMap(); - if (!profileMap.isEmpty()) { - panels.add(profileSelectionPanel); + List profiles = IngestProfiles.getIngestProfiles(); + if (!profiles.isEmpty()) { + panels.add(new IngestProfileSelectionWizardPanel(AddImageWizardIngestConfigPanel.class.getCanonicalName(), getPropLastprofileName())); } panels.add(ingestConfigPanel); panels.add(progressPanel); @@ -100,25 +98,24 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator listeners = new HashSet<>(1); private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS /** @@ -57,15 +55,16 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP String getDefaultContext() { return defaultContext; } - + /** * Gets the name of the file which stores the last profile used properties. - * + * * @return the LAST_PROFILE_PROPERTIES_FILE */ public static String getLastProfilePropertiesFile() { return LAST_PROFILE_PROPERTIES_FILE; } + // 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 @@ -139,9 +138,9 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP public boolean skipNextPanel() { return component.isLastPanel; } - + @Override - public boolean panelEnablesSkipping(){ - return true; - } + public boolean panelEnablesSkipping() { + return true; + } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index 21db01eb8b..ca242095fd 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -46,16 +46,9 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< private List getPanels() { if (panels == null) { panels = new ArrayList<>(); -<<<<<<< HEAD - IngestProfileSelectionWizardPanel profilePanel = new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext(), PROP_LASTPROFILE_NAME); - TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); - if (!profileMap.isEmpty()) { - panels.add(profilePanel); -======= List profiles = IngestProfiles.getIngestProfiles(); if (!profiles.isEmpty()) { - panels.add( new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext(), PROP_LASTPROFILE_NAME)); ->>>>>>> c4c7cbb9f8c52b7aa09e9e4f83ecbfe599dd2254 + panels.add(new IngestProfileSelectionWizardPanel(RunIngestModulesAction.getDefaultContext(), PROP_LASTPROFILE_NAME)); } panels.add(new IngestModulesConfigWizardPanel()); @@ -89,8 +82,8 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< @Override public boolean hasNext() { - return (index < getPanels().size() - 1 && - !(current().panelEnablesSkipping() && current().skipNextPanel())); + return (index < getPanels().size() - 1 + && !(current().panelEnablesSkipping() && current().skipNextPanel())); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java index 35c9cf7705..589ebdee14 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortcutWizardDescriptorPanel.java @@ -21,44 +21,48 @@ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import org.openide.WizardDescriptor; /** - * An abstract class providing a methods which can be checked by - * the iterator containing panels of this type. So that Wizards containing these - * panels can skip panels, but still call necessary methods of those panels. + * An abstract class providing a methods which can be checked by the iterator + * containing panels of this type. So that Wizards containing these panels can + * skip panels, but still call necessary methods of those panels. */ public abstract class ShortcutWizardDescriptorPanel implements WizardDescriptor.Panel { - + /** - * Whether or not this panel under the correct conditions can enable the skipping of the panel after it. + * Whether or not this panel under the correct conditions can enable the + * skipping of the panel after it. + * * @return true or false */ - public boolean panelEnablesSkipping(){ - /* - * This method should be overriden by any panel that might want to + public boolean panelEnablesSkipping() { + /* + * This method should be overriden by any panel that might want to * enable the iterator to skip the panel that comes after it. */ return false; } - + /** - * Whether or not the panel immediately following this one should be skipped . - * + * Whether or not the panel immediately following this one should be skipped + * . + * * @return true or false */ - public boolean skipNextPanel(){ + public boolean skipNextPanel() { /* - * This method should be overriden by any panel that might want to + * This method should be overriden by any panel that might want to * enable the iterator to skip the panel that comes after it. */ return false; } - + /** - * Provides a method which will allow code to be executed in a panel you plan to skip + * Provides a method which will allow code to be executed in a panel you + * plan to skip */ - public void processThisPanelBeforeSkipped(){ + public void processThisPanelBeforeSkipped() { /* - * If you need to perform some actions of this panel before it is skipped - * override this method to have it call the necessary code. + * If you need to perform some actions of this panel before it is + * skipped override this method to have it call the necessary code. */ } } From 6c3d2804243f607a02d2cd37a9d0d1bfac28b42d Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Feb 2017 11:19:10 -0500 Subject: [PATCH 4/6] 2199 fixed bug with highlighting of proper step in AddImageWizard --- .../AddImageWizardIngestConfigPanel.java | 33 +++++++++---------- .../IngestModulesConfigWizardPanel.java | 3 +- .../IngestProfileSelectionPanel.java | 1 - .../IngestProfileSelectionWizardPanel.java | 23 ++++++------- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index 9e970ffd97..ce4aa13c89 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java @@ -30,7 +30,6 @@ 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; @@ -55,7 +54,6 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { @Messages("AddImageWizardIngestConfigPanel.name.text=Configure Ingest Modules") private IngestJobSettingsPanel ingestJobSettingsPanel; - /** * The visual component that displays this panel. If you need to access the * component from this class, just use getComponent(). @@ -80,11 +78,12 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { this.addImageAction = action; this.progressPanel = proPanel; this.dataSourcePanel = dsPanel; - - IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); + IngestJobSettings ingestJobSettings = new IngestJobSettings(AddImageWizardIngestConfigPanel.class.getCanonicalName()); showWarnings(ingestJobSettings); + //When this panel is viewed by the user it will always be displaying the + //IngestJobSettingsPanel with the AddImageWizardIngestConfigPanel.class.getCanonicalName(); this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); - this.ingestJobSettingsPanel.setName(Bundle.AddImageWizardIngestConfigPanel_name_text()); + } /** @@ -99,6 +98,7 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { public Component getComponent() { if (component == null) { component = new AddImageWizardIngestConfigVisual(this.ingestJobSettingsPanel); + component.setName(Bundle.AddImageWizardIngestConfigPanel_name_text()); } return component; } @@ -166,23 +166,13 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { */ @Override public void readSettings(WizardDescriptor settings) { - if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null) - && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) { - lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()); - } - IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); - showWarnings(ingestJobSettings); - this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); - component = new AddImageWizardIngestConfigVisual(this.ingestJobSettingsPanel); JButton cancel = new JButton( NbBundle.getMessage(this.getClass(), "AddImageWizardIngestConfigPanel.CANCEL_BUTTON.text")); cancel.setEnabled(false); settings.setOptions(new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, cancel}); cleanupTask = null; readyToIngest = false; - newContents.clear(); - // Start processing the data source by handing it off to the selected DSP, // so it gets going in the background while the user is still picking the Ingest modules startDataSourceProcessing(); @@ -199,8 +189,7 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { */ @Override public void storeSettings(WizardDescriptor settings) { - - IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); + IngestJobSettings ingestJobSettings = ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); showWarnings(ingestJobSettings); @@ -220,15 +209,23 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { } } + /** + * Loads the proper settings for this panel to use the previously selected + * Ingest profile when this panel would be skipped due to a profile being + * chosen. + */ @Override public void processThisPanelBeforeSkipped() { if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null) && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) { lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()); } + //Because this panel kicks off ingest during the wizard we need to + //swap out the ingestJobSettings for the ones of the chosen profile before + //we start processing IngestJobSettings ingestJobSettings = new IngestJobSettings(lastProfileUsed); + ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); showWarnings(ingestJobSettings); - this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings); component = new AddImageWizardIngestConfigVisual(this.ingestJobSettingsPanel); readyToIngest = true; startDataSourceProcessing(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java index 1ed524998b..0124db327b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; +import java.awt.Component; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; @@ -42,7 +43,7 @@ class IngestModulesConfigWizardPanel extends ShortcutWizardDescriptorPanel { // 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() { + public Component getComponent() { if (ingestJobSettingsPanel == null) { ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModulesAction.getDefaultContext())); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 70c0d8056d..30c137e99d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -22,7 +22,6 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.swing.JPanel; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index b30f878733..08c416998e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; +import java.awt.Component; import java.util.HashSet; import java.util.Set; import javax.swing.event.ChangeEvent; @@ -39,10 +40,10 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP private final Set listeners = new HashSet<>(1); 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(). + * The visual ingestProfileSelectionPanel that displays this panel. If you need to access the + ingestProfileSelectionPanel from this class, just use getComponent(). */ - private IngestProfileSelectionPanel component; + private IngestProfileSelectionPanel ingestProfileSelectionPanel; private String lastProfileUsed; private final String lastProfilePropertyName; private final String defaultContext; @@ -68,23 +69,23 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP return LAST_PROFILE_PROPERTIES_FILE; } - // Get the visual component for the panel. In this template, the component + // Get the visual ingestProfileSelectionPanel for the panel. In this template, the ingestProfileSelectionPanel // 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) { + public Component getComponent() { + if (ingestProfileSelectionPanel == null) { if (!(ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName) == null) && !ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName).isEmpty()) { lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName); } else { lastProfileUsed = getDefaultContext(); } - component = new IngestProfileSelectionPanel(this, lastProfileUsed); - component.setName(Bundle.IngestProfileWizardPanel_panelName()); + ingestProfileSelectionPanel = new IngestProfileSelectionPanel(this, lastProfileUsed); + ingestProfileSelectionPanel.setName(Bundle.IngestProfileWizardPanel_panelName()); } - return component; + return ingestProfileSelectionPanel; } @Override @@ -133,14 +134,14 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP @Override public void storeSettings(WizardDescriptor wiz) { - lastProfileUsed = component.getLastSelectedProfile(); + lastProfileUsed = ingestProfileSelectionPanel.getLastSelectedProfile(); wiz.putProperty("executionContext", lastProfileUsed); //NON-NLS ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, lastProfilePropertyName, lastProfileUsed); } @Override public boolean skipNextPanel() { - return component.isLastPanel; + return ingestProfileSelectionPanel.isLastPanel; } @Override From 773cf2619898289e6950e7325ea27a752b543cfa Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Feb 2017 12:18:35 -0500 Subject: [PATCH 5/6] 2199 Formatting, copyright, and netbeans tips resolution --- .../AddImageWizardAddingProgressPanel.java | 4 ++-- .../AddImageWizardChooseDataSourcePanel.java | 8 +++----- .../casemodule/AddImageWizardIterator.java | 4 ++-- .../MultiUserSettingsPanelController.java | 2 +- .../datamodel/VirtualDirectoryNode.java | 2 +- .../DirectoryTreeTopComponent.java | 8 ++++++-- .../ExternalViewerOptionsPanelController.java | 10 +++++----- .../ingest/IngestOptionsPanelController.java | 2 +- .../autopsy/ingest/IngestTasksScheduler.java | 3 +-- .../IngestModulesConfigWizardPanel.java | 3 +-- .../IngestProfileSelectionWizardPanel.java | 5 +++-- ...FileExtMismatchOptionsPanelController.java | 18 ++++++++++++++++-- .../FileTypeIdOptionsPanelController.java | 19 ++++++++++++++++--- .../HashDatabaseOptionsPanelController.java | 2 +- .../modules/interestingitems/FilesSet.java | 2 +- .../interestingitems/FilesSetDefsPanel.java | 2 +- ...restingItemDefsOptionsPanelController.java | 2 +- 17 files changed, 62 insertions(+), 34 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java index c39e541f25..8b1a4dd1e0 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardAddingProgressPanel.java @@ -54,7 +54,7 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel { private AddImageWizardAddingProgressVisual component; private final Set listeners = new HashSet<>(1); // or can use ChangeSupport in NB 6.0 - private DSPProgressMonitorImpl dspProgressMonitorImpl = new DSPProgressMonitorImpl(); + private final DSPProgressMonitorImpl dspProgressMonitorImpl = new DSPProgressMonitorImpl(); public DSPProgressMonitorImpl getDSPProgressMonitorImpl() { return dspProgressMonitorImpl; @@ -193,7 +193,7 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel { protected final void fireChangeEvent() { Iterator it; synchronized (listeners) { - it = new HashSet(listeners).iterator(); + it = new HashSet<>(listeners).iterator(); } ChangeEvent ev = new ChangeEvent(this); while (it.hasNext()) { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java index 65847a6eba..3d58017ecb 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourcePanel.java @@ -45,7 +45,7 @@ class AddImageWizardChooseDataSourcePanel extends ShortcutWizardDescriptorPanel * The visual component that displays this panel. If you need to access the * component from this class, just use getComponent(). */ - private AddImageWizardAddingProgressPanel progressPanel; + private final AddImageWizardAddingProgressPanel progressPanel; private AddImageWizardChooseDataSourceVisual component; private boolean isNextEnable = false; private static final String PROP_LASTDATASOURCE_PATH = "LBL_LastDataSource_PATH"; //NON-NLS @@ -123,7 +123,7 @@ class AddImageWizardChooseDataSourcePanel extends ShortcutWizardDescriptorPanel isNextEnable = isEnabled; fireChangeEvent(); } - private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + private final Set listeners = new HashSet<>(1); // or can use ChangeSupport in NB 6.0 /** * Adds a listener to changes of the panel's validity. @@ -156,7 +156,7 @@ class AddImageWizardChooseDataSourcePanel extends ShortcutWizardDescriptorPanel protected final void fireChangeEvent() { Iterator it; synchronized (listeners) { - it = new HashSet(listeners).iterator(); + it = new HashSet<>(listeners).iterator(); } ChangeEvent ev = new ChangeEvent(this); while (it.hasNext()) { @@ -219,8 +219,6 @@ class AddImageWizardChooseDataSourcePanel extends ShortcutWizardDescriptorPanel */ @Override public void storeSettings(WizardDescriptor settings) { - - return; } /** diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java index 8616f5bc67..3dafa75479 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIterator.java @@ -38,7 +38,7 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator panels; - private AddImageAction action; + private final AddImageAction action; private int progressPanelIndex; private final static String PROP_LASTPROFILE_NAME = "AIW_LASTPROFILE_NAME"; //NON-NLS @@ -74,7 +74,7 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 40f14bf63a..8a056b2318 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -48,7 +48,7 @@ import org.sleuthkit.datamodel.VirtualDirectory; */ public class VirtualDirectoryNode extends AbstractAbstractFileNode { - private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName()); + private static final Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName()); //prefix for special VirtualDirectory root nodes grouping local files public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet"; //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index 22b4677c36..4cbf5fa283 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.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"); @@ -297,6 +297,8 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat * only, i.e. deserialization routines; otherwise you could get a * non-deserialized instance. To obtain the singleton instance, use * {@link #findInstance}. + * + * @return instance - the default instance */ public static synchronized DirectoryTreeTopComponent getDefault() { if (instance == null) { @@ -308,6 +310,8 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat /** * Obtain the DirectoryTreeTopComponent instance. Never call * {@link #getDefault} directly! + * + * @return getDefault() - the default instance */ public static synchronized DirectoryTreeTopComponent findInstance() { WindowManager winManager = WindowManager.getDefault(); @@ -667,7 +671,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat try { displayName = content.getUniquePath(); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for node: " + originNode); //NON-NLS + LOGGER.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for node: {0}", originNode); //NON-NLS } } else if (originNode.getLookup().lookup(String.class) != null) { displayName = originNode.getLookup().lookup(String.class); diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerOptionsPanelController.java index 5df5b89e56..ee65dfbf1c 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerOptionsPanelController.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. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java index b9c4ea9546..9c908d9ebb 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 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/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index f7c32930c0..a9ad8c7634 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2016 Basis Technology Corp. + * Copyright 2012-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,7 +32,6 @@ 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/runIngestModuleWizard/IngestModulesConfigWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java index 0124db327b..c330df974e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java @@ -26,9 +26,8 @@ import org.openide.util.NbBundle; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; - class IngestModulesConfigWizardPanel extends ShortcutWizardDescriptorPanel { - + @NbBundle.Messages("IngestModulesConfigWizardPanel.name.text=Configure Ingest Modules") /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index 08c416998e..207e577bf1 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -40,8 +40,9 @@ public class IngestProfileSelectionWizardPanel extends ShortcutWizardDescriptorP private final Set listeners = new HashSet<>(1); private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS /** - * The visual ingestProfileSelectionPanel that displays this panel. If you need to access the - ingestProfileSelectionPanel from this class, just use getComponent(). + * The visual ingestProfileSelectionPanel that displays this panel. If you + * need to access the ingestProfileSelectionPanel from this class, just use + * getComponent(). */ private IngestProfileSelectionPanel ingestProfileSelectionPanel; private String lastProfileUsed; diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchOptionsPanelController.java index 93eef3c0a0..be5d476c5b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchOptionsPanelController.java @@ -1,6 +1,20 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * 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.modules.fileextmismatch; diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdOptionsPanelController.java index 434e17d463..624cdb747c 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdOptionsPanelController.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * 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.modules.filetypeid; diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java index c2c52a4097..cd320258ce 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDatabaseOptionsPanelController.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 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/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index cbb3576b41..6fb44839b5 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -1,7 +1,7 @@ /* * 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"); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 184b5d8b46..b4743bd360 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.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/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index 7280f3b7ab..3a579d7b51 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -1,7 +1,7 @@ /* * 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"); From 7b634fbad9f4353aad4ec00a0648c53b723404f7 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Feb 2017 16:38:00 -0500 Subject: [PATCH 6/6] 2198- made Ingest Options panel save and load filters in a more logical manner --- .../autopsy/ingest/IngestOptionsPanel.java | 26 +++++++++++-------- .../autopsy/ingest/ProfileSettingsPanel.java | 16 ------------ 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java index 7ee74a726e..28bf7a623e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java @@ -42,8 +42,11 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen "IngestOptionsPanel.profilesTab.toolTipText=Settings for creating and editing profiles."}) private FilesSetDefsPanel filterPanel; + private final static int INDEX_OF_FILTER_PANEL = 0; private IngestSettingsPanel settingsPanel; + private final static int INDEX_OF_SETTINGS_PANEL = 2; private ProfileSettingsPanel profilePanel; + private final static int INDEX_OF_PROFILE_PANEL = 1; /** * This panel implements a property change listener that listens to ingest * job events so it can disable the buttons on the panel if ingest is @@ -63,11 +66,11 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen profilePanel = new ProfileSettingsPanel(); tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.text"), null, - filterPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.toolTipText"), 0); + filterPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.toolTipText"), INDEX_OF_FILTER_PANEL); tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.text"), null, - profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), 1); + profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), INDEX_OF_PROFILE_PANEL); tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.text"), null, - settingsPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.toolTipText"), 2); + settingsPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.toolTipText"), INDEX_OF_SETTINGS_PANEL); //Listener for when tabbed panes are switched, because we can have two file filter definitions panels open at the same time //we may wind up in a situation where the user has created and saved one in the profiles panel //so we need to refresh the filterPanel in those cases before proceeding. @@ -75,10 +78,15 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen @Override public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { - profilePanel.shouldFiltersBeRefreshed(); - { - filterPanel.load(); - } + //because we can have two filterPanels open at the same time + //we need to save the settings when we change tabs otherwise + //they could be overwritten with out of date + if (tabbedPane.getSelectedIndex() == INDEX_OF_FILTER_PANEL) { + filterPanel.load(); + } + else { + filterPanel.saveSettings(); + } } } }); @@ -152,10 +160,6 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen */ @Override public void saveSettings() { - //if a new filter was created in the profilePanel we don't want to save over it accidently - if (profilePanel.shouldFiltersBeRefreshed()) { - filterPanel.load(); - } filterPanel.store(); settingsPanel.store(); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index 1b1fbc40c0..1db29f0b5f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -51,7 +51,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op private final DefaultListModel profilesListModel; private Map profiles; private ProfilePanel panel; - private boolean filtersShouldBeRefreshed; /** * Creates new form ProfileOptionsPanel @@ -59,7 +58,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op ProfileSettingsPanel() { this.profilesListModel = new DefaultListModel<>(); initComponents(); - this.filtersShouldBeRefreshed = false; this.profileList.setModel(profilesListModel); this.profileList.addListSelectionListener(new ProfileSettingsPanel.ProfileListSelectionListener()); ingestWarningLabel.setVisible(false); @@ -275,20 +273,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_deleteProfileButtonActionPerformed - /** - * Returns whether there were possible changes to the filter list since the - * last time this was called. - * - * Resets value to false after being called. - * - * @return true or false - */ - boolean shouldFiltersBeRefreshed() { - boolean shouldRefresh = filtersShouldBeRefreshed; - filtersShouldBeRefreshed = false; - return shouldRefresh; - } - /** * Enable / disable buttons, so they can be disabled while ingest is * running.