From b407e7d93c85240ab039ff98a7196c112f7d322f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 12:43:28 -0500 Subject: [PATCH] 2197 - removed FileIngestFilterDefsOptionsPanelController --- .../autopsy/ingest/IngestJobSettings.java | 8 +- .../autopsy/ingest/ProfileSettingsPanel.java | 11 +- ...ngestFilterDefsOptionsPanelController.java | 146 ------------------ 3 files changed, 15 insertions(+), 150 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 68e6ab7a03..15d04c51d0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -157,8 +157,14 @@ public class IngestJobSettings { this.store(); } - public void saveAs(String executionContext) { + /** + * Saves the settings with a new context name removing the old profile folder + * + * @param executionContext will be used to name the new folder for storing the settings + */ + void saveAs(String executionContext) { this.executionContext = executionContext; + this.createSavedModuleSettingsFolder(); this.store(); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index c1554d9901..e711f2f688 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -6,12 +6,12 @@ package org.sleuthkit.autopsy.ingest; //WJS-TODO hook up all labels and fields to bundle properties instead of plain text +import java.util.Map; import javax.swing.DefaultListModel; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.ingest.IngestProfileList.IngestProfile; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; @@ -19,6 +19,7 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { + private final DefaultListModel profilesListModel = new DefaultListModel<>(); /** @@ -311,9 +312,13 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op profileDescArea.setText(selectedProfile.getDescription()); filterNameText.setText(selectedProfile.getFileIngestFilter()); try { - filterDescArea.setText(FilesSetsManager.getInstance().getFileIngestFiltersWithDefaults().get(selectedProfile.getFileIngestFilter()).getDescription()); + Map fileIngestFilters = FilesSetsManager.getInstance().getCustomFileIngestFilters(); + for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { + fileIngestFilters.put(fSet.getName(), fSet); + } + filterDescArea.setText(fileIngestFilters.get(selectedProfile.getFileIngestFilter()).getDescription()); } catch (FilesSetsManager.FilesSetsManagerException ex) { - filterDescArea.setText("FAILED TO LOAD FILTER"); + filterDescArea.setText("FAILED TO LOAD FILTER"); } selectedModulesArea.setText(""); for (String moduleName : selectedProfile.getModuleNames(IngestProfile.ENABLED_MODULES_KEY)) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java deleted file mode 100644 index 6a65433120..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 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.modules.interestingitems; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.HelpCtx; -import org.openide.util.Lookup; -import org.sleuthkit.autopsy.coreutils.Logger; - -/** - * Class for creating an FilesSetDefsPanel which will be used for configuring - * the FileIngestFilter. - */ -public final class FileIngestFilterDefsOptionsPanelController extends OptionsPanelController { - - private FilesSetDefsPanel panel; - private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); - private boolean changed; - private static final Logger LOGGER = Logger.getLogger(FileIngestFilterDefsOptionsPanelController.class.getName()); - - /** - * Component should load its data here. - */ - @Override - public void update() { - getPanel().load(); - changed = false; - } - - - /** - * This method is called when both the Ok and Apply buttons are pressed. It - * applies to any of the panels that have been opened in the process of - * using the options pane. - */ - @Override - public void applyChanges() { - if (changed) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - getPanel().store(); - changed = false; - } - }); - } - } - - /** - * This method is called when the Cancel button is pressed. It applies to - * any of the panels that have been opened in the process of using the - * options pane. - */ - @Override - public void cancel() { - // need not do anything special, if no changes have been persisted yet - } - - @Override - public boolean isValid() { - return true; - } - - /** - * Used to determine whether any changes have been made to this controller's - * panel. - * - * @return Whether or not a change has been made. - */ - @Override - public boolean isChanged() { - return changed; - } - - @Override - public HelpCtx getHelpCtx() { - return null; - } - - @Override - public JComponent getComponent(Lookup masterLookup) { - return getPanel(); - } - - @Override - public void addPropertyChangeListener(PropertyChangeListener l) { - pcs.addPropertyChangeListener(l); - } - - @Override - public void removePropertyChangeListener(PropertyChangeListener l) { - pcs.removePropertyChangeListener(l); - } - - /** - * Creates an interestingItemsDefPanel that will be labeled to indicate it - * is for File Ingest Filter settings - * - * @return an FilesSetDefsPanel which has text and fields modified to - * indicate it is for File Ingest Filtering. - */ - private FilesSetDefsPanel getPanel() { - if (panel == null) { - panel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS); - panel.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) { - changed(); - } - } - }); - } - return panel; - } - - void changed() { - if (!changed) { - changed = true; - pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); - } - pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); - } - -}