mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 17:57:43 +00:00
1903 JCombo Box populated with options for file Filter
This commit is contained in:
parent
b253bb156d
commit
94e7dc21fb
@ -115,3 +115,6 @@ gest
|
||||
IngestJobSettingsPanel.globalSettingsButton.actionCommand=Advanced
|
||||
IngestJobSettingsPanel.globalSettingsButton.text=Global Settings
|
||||
IngestJobSettingsPanel.pastJobsButton.text=View Ingest History
|
||||
IngestJobSettingsPanel.jLabel1.text=
|
||||
IngestJobSettingsPanel.jLabel2.text=Run Ingest Modules on:
|
||||
IngestJobSettingsPanel.jLabel1.text_1=Run Ingest Modules on:
|
||||
|
@ -107,15 +107,13 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="jComboBox1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="All Files and Unallocated Space"/>
|
||||
<StringItem index="1" value="All Files"/>
|
||||
<StringItem index="2" value="Create New..."/>
|
||||
<StringItem index="3" value="Filter 3242"/>
|
||||
</StringArray>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new DefaultComboBoxModel(controller.getComboBoxContents().toArray())" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox1ActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
|
@ -28,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JDialog;
|
||||
@ -43,6 +44,7 @@ import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel;
|
||||
import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog;
|
||||
import org.sleuthkit.autopsy.modules.interestingitems.FileFilterDefsOptionsPanelController;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.IngestJobInfo;
|
||||
import org.sleuthkit.datamodel.IngestModuleInfo;
|
||||
@ -63,7 +65,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel {
|
||||
private final List<IngestModuleModel> modules = new ArrayList<>();
|
||||
private final IngestModulesTableModel tableModel = new IngestModulesTableModel();
|
||||
private IngestModuleModel selectedModule;
|
||||
private static final Logger logger = Logger.getLogger(IngestJobSettingsPanel.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(IngestJobSettingsPanel.class.getName());
|
||||
private final FileFilterDefsOptionsPanelController controller;
|
||||
|
||||
/**
|
||||
* Construct a panel to allow a user to make ingest job settings.
|
||||
@ -72,9 +75,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
public IngestJobSettingsPanel(IngestJobSettings settings) {
|
||||
this.settings = settings;
|
||||
this.controller = new FileFilterDefsOptionsPanelController();
|
||||
controller.getComponent(controller.getLookup());
|
||||
for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) {
|
||||
modules.add(new IngestModuleModel(moduleTemplate));
|
||||
}
|
||||
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
@ -88,17 +94,20 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel {
|
||||
IngestJobSettingsPanel(IngestJobSettings settings, List<Content> dataSources) {
|
||||
this.settings = settings;
|
||||
this.dataSources.addAll(dataSources);
|
||||
this.controller = new FileFilterDefsOptionsPanelController();
|
||||
controller.getComponent(controller.getLookup());
|
||||
try {
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
ingestJobs.addAll(skCase.getIngestJobs());
|
||||
} catch (IllegalStateException ex) {
|
||||
logger.log(Level.SEVERE, "No open case", ex);
|
||||
LOGGER.log(Level.SEVERE, "No open case", ex);
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to load ingest job information", ex);
|
||||
LOGGER.log(Level.SEVERE, "Failed to load ingest job information", ex);
|
||||
}
|
||||
for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) {
|
||||
this.modules.add(new IngestModuleModel(moduleTemplate));
|
||||
}
|
||||
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
@ -209,7 +218,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel {
|
||||
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text_1")); // NOI18N
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "All Files and Unallocated Space", "All Files", "Create New...", "Filter 3242" }));
|
||||
jComboBox1.setModel(new DefaultComboBoxModel(controller.getComboBoxContents().toArray()));
|
||||
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jComboBox1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
modulesScrollPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160)));
|
||||
modulesScrollPane.setMinimumSize(new java.awt.Dimension(0, 0));
|
||||
@ -407,6 +421,25 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel {
|
||||
dialog.setVisible(true);
|
||||
}//GEN-LAST:event_pastJobsButtonActionPerformed
|
||||
|
||||
/**
|
||||
* Perform the appropriate action when Jcombobox items are selected, most
|
||||
* notably opening the File filter settings when Create New is chosen.
|
||||
*
|
||||
* @param evt
|
||||
*/
|
||||
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
|
||||
|
||||
if (evt.toString().contains("Create New...")) {
|
||||
final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true);
|
||||
// values.controller.getComboBoxContents().toArray();
|
||||
dialog.addApplyButtonListener((ActionEvent e) -> {
|
||||
controller.applyChanges();
|
||||
dialog.close();
|
||||
});
|
||||
dialog.display((IngestModuleGlobalSettingsPanel)controller.getComponent(controller.getLookup()));
|
||||
}
|
||||
}//GEN-LAST:event_jComboBox1ActionPerformed
|
||||
|
||||
private void SelectAllModules(boolean set) {
|
||||
for (IngestModuleModel module : modules) {
|
||||
module.setEnabled(set);
|
||||
|
@ -4,6 +4,8 @@ OpenIDE-Module-Short-Description=Interesting Files Identifier ingest module.
|
||||
OpenIDE-Module-Name=Interesting Files Identifier
|
||||
OptionsCategory_Name_InterestingItemDefinitions=Interesting Files
|
||||
OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions
|
||||
OptionsCategory_Name_FileFilterDefinitions=File Filter
|
||||
OptionsCategory_Keywords_FileFilterDefinitions=FileFilterDefinitions
|
||||
InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier
|
||||
InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets.
|
||||
FilesSetPanel.title=Interesting Files Set
|
||||
@ -65,3 +67,30 @@ FilesSetRulePanel.fileSizeCheck.text=File Size:
|
||||
FilesSetRulePanel.filesRadioButton.text=Files
|
||||
FilesSetRulePanel.dirsRadioButton.text=Directories
|
||||
FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories
|
||||
FileFilterRuleDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns.
|
||||
FileFilterRuleDefsPanel.editSetButton.text=Edit Set
|
||||
FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=Regex
|
||||
FileFilterRuleDefsPanel.jLabel4.text=Path Pattern:
|
||||
FileFilterRuleDefsPanel.jLabel1.text=Rule Details
|
||||
FileFilterRuleDefsPanel.dirsRadioButton.text=Directories
|
||||
FileFilterRuleDefsPanel.jLabel2.text=File Type:
|
||||
FileFilterRuleDefsPanel.rulesListLabel.text=Rules:
|
||||
FileFilterRuleDefsPanel.newSetButton.text=New Set
|
||||
FileFilterRuleDefsPanel.editRuleButton.text=Edit Rule
|
||||
FileFilterRuleDefsPanel.deleteRuleButton.text=Delete Rule
|
||||
FileFilterRuleDefsPanel.filesRadioButton.text=Files
|
||||
FileFilterRuleDefsPanel.deleteSetButton.text=Delete Set
|
||||
FileFilterRuleDefsPanel.newRuleButton.text=New Rule
|
||||
FileFilterRuleDefsPanel.bothRadioButton.text=Files and Directories
|
||||
FileFilterRuleDefsPanel.setsListLabel.text=Rule Sets
|
||||
FileFilterRuleDefsPanel.jLabel6.text=Set Details
|
||||
FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=Regex
|
||||
FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files
|
||||
FileFilterRuleDefsPanel.rulePathConditionTextField.text=
|
||||
FileFilterRuleDefsPanel.fileNameRadioButton.text=File Name
|
||||
FileFilterRuleDefsPanel.jLabel5.text=Description:
|
||||
FileFilterRuleDefsPanel.fileNameTextField.text=
|
||||
FileFilterRuleDefsPanel.jLabel8.text=File Size:
|
||||
FileFilterRuleDefsPanel.jLabel3.text=Name Pattern:
|
||||
FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=Extension Only
|
||||
FileFilterRuleDefsPanel.jLabel7.text=MIME Type:
|
||||
|
@ -72,3 +72,26 @@ InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb
|
||||
|
||||
InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30
|
||||
InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe
|
||||
FileFilterRuleDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6
|
||||
FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe
|
||||
FileFilterRuleDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a
|
||||
FileFilterRuleDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30
|
||||
FileFilterRuleDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
|
||||
FileFilterRuleDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a
|
||||
FileFilterRuleDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a
|
||||
FileFilterRuleDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8
|
||||
FileFilterRuleDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6
|
||||
FileFilterRuleDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664
|
||||
FileFilterRuleDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb
|
||||
FileFilterRuleDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664
|
||||
FileFilterRuleDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb
|
||||
FileFilterRuleDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
|
||||
FileFilterRuleDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8
|
||||
FileFilterRuleDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30
|
||||
FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe
|
||||
FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996
|
||||
FileFilterRuleDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d
|
||||
FileFilterRuleDefsPanel.jLabel5.text=\u6982\u8981\uff1a
|
||||
FileFilterRuleDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3
|
||||
FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f
|
||||
FileFilterRuleDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002
|
||||
|
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2014 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.Lookup;
|
||||
|
||||
@OptionsPanelController.TopLevelRegistration(
|
||||
categoryName = "#OptionsCategory_Name_FileFilterDefinitions",
|
||||
iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png",
|
||||
keywords = "#OptionsCategory_Keywords_FileFilterDefinitions",
|
||||
keywordsCategory = "FileFilterDefinitions",
|
||||
position = 7
|
||||
)
|
||||
public final class FileFilterDefsOptionsPanelController extends OptionsPanelController {
|
||||
|
||||
private InterestingItemDefsPanel panel;
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
private boolean changed;
|
||||
|
||||
/**
|
||||
* Component should load its data here.
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
getPanel().load();
|
||||
changed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array which will contain the names of all options which should
|
||||
* exist in the "Run Ingest Modules On:" JCombobox
|
||||
*
|
||||
* @return -filterNames an array of all established filter names as well as
|
||||
* a 'Create New...' option
|
||||
*/
|
||||
public List<String> getComboBoxContents() {
|
||||
List<String> nameSet = new ArrayList<>();
|
||||
nameSet.add("All Files");
|
||||
if (!(panel == null)) {
|
||||
nameSet.addAll(panel.getKeys());
|
||||
System.out.println("THIS IS THE SET, PANEL NOT NULL");
|
||||
System.out.println(nameSet.toString());
|
||||
}
|
||||
nameSet.add("Create New...");
|
||||
return nameSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
private InterestingItemDefsPanel getPanel() {
|
||||
if (panel == null) {
|
||||
panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "");
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -20,13 +20,13 @@ public class FilesFilter {
|
||||
|
||||
public static Set<String> getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException {
|
||||
InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance();
|
||||
return manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").keySet();
|
||||
return manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").keySet();
|
||||
}
|
||||
|
||||
public FilesFilter() {
|
||||
InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance();
|
||||
try {
|
||||
for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").values()) {
|
||||
for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").values()) {
|
||||
currentRules = fs;
|
||||
break;
|
||||
}
|
||||
@ -39,7 +39,7 @@ public class FilesFilter {
|
||||
public FilesFilter(String key) {
|
||||
InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance();
|
||||
try {
|
||||
currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").get(key);
|
||||
currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").get(key);
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS
|
||||
*/
|
||||
List<FilesSetRow> filesSetRows = new ArrayList<>();
|
||||
try {
|
||||
this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME));
|
||||
this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()));
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError());
|
||||
this.filesSetSnapshot = new TreeMap<>();
|
||||
@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS
|
||||
List<FilesSetRow> rowModels = new ArrayList<>();
|
||||
TreeMap<String, FilesSet> newFilesSetSnapshot;
|
||||
try {
|
||||
newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME));
|
||||
newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()));
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError());
|
||||
return;
|
||||
|
@ -83,7 +83,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
|
||||
// to disable the interesting files set definition UI during ingest.
|
||||
List<FilesSet> filesSets = new ArrayList<>();
|
||||
try {
|
||||
for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).values()) {
|
||||
for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).values()) {
|
||||
if (settings.interestingFilesSetIsEnabled(set.getName())) {
|
||||
filesSets.add(set);
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ final class InterestingItemDefsManager extends Observable {
|
||||
|
||||
private static final List<String> ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">")));
|
||||
private static final List<String> ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">")));
|
||||
static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
||||
static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings";
|
||||
static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings";
|
||||
private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
||||
private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings";
|
||||
private static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings";
|
||||
private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator;
|
||||
private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator;
|
||||
private static InterestingItemDefsManager instance;
|
||||
@ -87,6 +87,27 @@ final class InterestingItemDefsManager extends Observable {
|
||||
return InterestingItemDefsManager.ILLEGAL_FILE_PATH_CHARS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the LEGACY_FILES_SET_DEFS_FILE_NAME
|
||||
*/
|
||||
static String getLEGACY_FILES_SET_DEFS_FILE_NAME() {
|
||||
return LEGACY_FILES_SET_DEFS_FILE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME
|
||||
*/
|
||||
static String getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME() {
|
||||
return INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the FILE_FILTER_SET_DEFS_SERIALIZATION_NAME
|
||||
*/
|
||||
static String getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME() {
|
||||
return FILE_FILTER_SET_DEFS_SERIALIZATION_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a copy of the current interesting files set definitions.
|
||||
*
|
||||
|
@ -115,7 +115,7 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane
|
||||
|
||||
private InterestingItemDefsPanel getPanel() {
|
||||
if (panel == null) {
|
||||
panel = new InterestingItemDefsPanel();
|
||||
panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME());
|
||||
panel.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
@ -57,12 +57,14 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
"InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file."
|
||||
})
|
||||
|
||||
private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
|
||||
private static final SortedSet<MediaType> MEDIA_TYPES = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
|
||||
private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>();
|
||||
private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>();
|
||||
private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName());
|
||||
private JButton okButton = new JButton("OK");
|
||||
private JButton cancelButton = new JButton("Cancel");
|
||||
private final JButton okButton = new JButton("OK");
|
||||
private final JButton cancelButton = new JButton("Cancel");
|
||||
private final String settingsFileName;
|
||||
private final String settingsLegacyFileName;
|
||||
|
||||
// The following is a map of interesting files set names to interesting
|
||||
// files set definitions. It is a snapshot of the files set definitions
|
||||
@ -76,13 +78,20 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
/**
|
||||
* Constructs an interesting item definitions panel.
|
||||
*/
|
||||
InterestingItemDefsPanel() {
|
||||
InterestingItemDefsPanel(String settingsName, String legacySettingsName) {
|
||||
this.initComponents();
|
||||
this.customInit();
|
||||
this.setsList.setModel(setsListModel);
|
||||
this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener());
|
||||
this.rulesList.setModel(rulesListModel);
|
||||
this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener());
|
||||
this.settingsFileName = settingsName;
|
||||
this.settingsLegacyFileName = legacySettingsName;
|
||||
}
|
||||
|
||||
Set<String> getKeys(){
|
||||
load();
|
||||
return filesSets.keySet();
|
||||
}
|
||||
|
||||
@NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings"})
|
||||
@ -90,7 +99,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
setName(Bundle.InterestingItemDefsPanel_Title());
|
||||
|
||||
Set<String> fileTypesCollated = new HashSet<>();
|
||||
for (MediaType mediaType : mediaTypes) {
|
||||
for (MediaType mediaType : MEDIA_TYPES) {
|
||||
fileTypesCollated.add(mediaType.toString());
|
||||
}
|
||||
|
||||
@ -126,7 +135,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
@Override
|
||||
public void saveSettings() {
|
||||
try {
|
||||
InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME);
|
||||
InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, settingsFileName);
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError());
|
||||
}
|
||||
@ -150,7 +159,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
try {
|
||||
// Get a working copy of the interesting files set definitions and sort
|
||||
// by set name.
|
||||
this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME));
|
||||
this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(settingsFileName, settingsLegacyFileName));
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError());
|
||||
this.filesSets = new TreeMap<>();
|
||||
|
@ -70,7 +70,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto
|
||||
|
||||
@Override
|
||||
public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() {
|
||||
InterestingItemDefsPanel panel = new InterestingItemDefsPanel();
|
||||
InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME());
|
||||
panel.load();
|
||||
return panel;
|
||||
}
|
||||
@ -84,7 +84,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto
|
||||
// Doing so also keeps the serialization simple.
|
||||
List<String> enabledFilesSetNames = new ArrayList<>();
|
||||
try {
|
||||
for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).keySet()) {
|
||||
for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).keySet()) {
|
||||
enabledFilesSetNames.add(name);
|
||||
}
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user