Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
FilesSetDefsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.modules.interestingitems;
20 
21 import java.awt.EventQueue;
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.Comparator;
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30 import java.util.SortedSet;
31 import java.util.TreeMap;
32 import java.util.logging.Level;
33 import javax.swing.DefaultListModel;
34 import javax.swing.JButton;
35 import javax.swing.JFileChooser;
36 import javax.swing.JOptionPane;
37 import javax.swing.event.ListSelectionEvent;
38 import javax.swing.event.ListSelectionListener;
39 import javax.swing.filechooser.FileNameExtensionFilter;
40 import org.netbeans.spi.options.OptionsPanelController;
41 import org.openide.util.NbBundle;
42 import org.openide.windows.WindowManager;
50 
54 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
55 public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
56 
57  private static final long serialVersionUID = 1L;
58 
59  @NbBundle.Messages({"# {0} - filter name",
60  "# {1} - profile name",
61  "FilesSetDefsPanel.ingest.fileFilterInUseError=The selected file filter, {0}, is being used by a profile, {1}, and cannot be deleted while any profile uses it.",
62  "FilesSetDefsPanel.bytes=Bytes",
63  "FilesSetDefsPanel.kiloBytes=Kilobytes",
64  "FilesSetDefsPanel.megaBytes=Megabytes",
65  "FilesSetDefsPanel.gigaBytes=Gigabytes",
66  "FilesSetDefsPanel.loadError=Error loading interesting files sets from file.",
67  "FilesSetDefsPanel.saveError=Error saving interesting files sets to file.",
68  "FilesSetDefsPanel.interesting.copySetButton.text=Copy Set",
69  "FilesSetDefsPanel.interesting.importSetButton.text=Import Set",
70  "FilesSetDefsPanel.interesting.exportSetButton.text=Export Set"
71  })
72  public static enum PANEL_TYPE {
74  INTERESTING_FILE_SETS
75 
76  }
77  private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>();
78  private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>();
79  private final Logger logger = Logger.getLogger(FilesSetDefsPanel.class.getName());
80  private final JButton okButton = new JButton("OK");
81  private final JButton cancelButton = new JButton("Cancel");
82  private final PANEL_TYPE panelType;
83  private final String filterDialogTitle;
84  private final String ruleDialogTitle;
85  private boolean canBeEnabled = true;
86 
87  // The following is a map of interesting files set names to interesting
88  // files set definitions. It is a snapshot of the files set definitions
89  // obtained from the interesting item definitions manager at the time the
90  // the panel is loaded. When the panel saves or stores its settings, these
91  // definitions, possibly changed, are submitted back to the interesting item
92  // definitions manager. Note that it is a tree map to aid in displaying
93  // files sets in sorted order by name.
94  private TreeMap<String, FilesSet> filesSets;
95 
99  public FilesSetDefsPanel(PANEL_TYPE panelType) {
100  this.panelType = panelType;
101  this.initComponents();
102  this.customInit();
103  this.setsList.setModel(setsListModel);
104  this.setsList.addListSelectionListener(new FilesSetDefsPanel.SetsListSelectionListener());
105  this.rulesList.setModel(rulesListModel);
106  this.rulesList.addListSelectionListener(new FilesSetDefsPanel.RulesListSelectionListener());
107  this.ingestWarningLabel.setVisible(false);
108  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules
109  this.copySetButton.setVisible(false);
110  this.importSetButton.setVisible(false);
111  this.exportSetButton.setVisible(false);
112  this.mimeTypeComboBox.setVisible(false);
113  this.jLabel7.setVisible(false);
114  this.fileSizeUnitComboBox.setVisible(false);
115  this.fileSizeSpinner.setVisible(false);
116  this.filterDialogTitle = "FilesSetPanel.filter.title";
117  this.ruleDialogTitle = "FilesSetPanel.rule.title";
118  this.jLabel8.setVisible(false);
119  this.equalitySignComboBox.setVisible(false);
120  this.ignoreKnownFilesCheckbox.setVisible(false);
121  this.jLabel2.setVisible(false);
122  this.filesRadioButton.setVisible(false);
123  this.dirsRadioButton.setVisible(false);
124  this.allRadioButton.setVisible(false);
125  this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jTextArea1.text")); // NOI18N
126  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.setsListLabel.text")); // NOI18N
127  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.editSetButton.text")); // NOI18N
128  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.newSetButton.text")); // NOI18N
129  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.deleteSetButton.text")); // NOI18N
130  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jLabel6.text")); // NOI18N
131  } else {
132  this.filterDialogTitle = "FilesSetPanel.interesting.title";
133  this.ruleDialogTitle = "FilesSetPanel.interesting.title";
134  this.ingoreUnallocCheckbox.setVisible(false);
135  }
136  }
137 
138  @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings",
139  "FilesSetDefsPanel.Ingest.Title=File Filter Settings"})
140  private void customInit() {
141  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
142  setName(Bundle.FilesSetDefsPanel_Ingest_Title());
143  } else {
144  setName(Bundle.FilesSetDefsPanel_Interesting_Title());
145  }
146 
147  try {
148  SortedSet<String> detectableMimeTypes = FileTypeDetector.getDetectedTypes();
149  detectableMimeTypes.forEach((type) -> {
150  mimeTypeComboBox.addItem(type);
151  });
153  logger.log(Level.SEVERE, "Unable to get detectable file types", ex);
154  }
155 
156  this.fileSizeUnitComboBox.setSelectedIndex(1);
157  this.equalitySignComboBox.setSelectedIndex(2);
158  }
159 
160  @Override
161  public void saveSettings() {
162  try {
163  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
164  FilesSetsManager.getInstance().setCustomFileIngestFilters(this.filesSets);
165  } else {
166  FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets);
167  }
168 
170  MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_saveError());
171  logger.log(Level.WARNING, Bundle.FilesSetDefsPanel_saveError(), ex);
172  }
173  }
174 
175  public void enableButtons(boolean isEnabled) {
176  boolean setSelected = (FilesSetDefsPanel.this.setsList.getSelectedValue() != null);
177  boolean ruleSelected = (FilesSetDefsPanel.this.rulesList.getSelectedValue() != null);
178  canBeEnabled = isEnabled;
179  newRuleButton.setEnabled(isEnabled);
180  copySetButton.setEnabled(isEnabled && setSelected);
181  newSetButton.setEnabled(isEnabled);
182  editRuleButton.setEnabled(isEnabled && ruleSelected);
183  editSetButton.setEnabled(isEnabled && setSelected);
184  exportSetButton.setEnabled(setSelected);
185  importSetButton.setEnabled(isEnabled);
186  deleteRuleButton.setEnabled(isEnabled && ruleSelected);
187  deleteSetButton.setEnabled(isEnabled && setSelected);
188  ingestWarningLabel.setVisible(!isEnabled);
189  }
190 
191  @Override
192  public void store() {
193  this.saveSettings();
194  }
195 
196  @Override
197  public void load() {
198  this.resetComponents();
199 
200  try {
201  // Get a working copy of the interesting files set definitions and sort
202  // by set name.
203  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
204  this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getCustomFileIngestFilters());
205  } else {
206  this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets());
207  }
208 
210  MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_loadError());
211  logger.log(Level.WARNING, Bundle.FilesSetDefsPanel_loadError(), ex);
212  this.filesSets = new TreeMap<>();
213  }
214 
215  // Populate the list model for the interesting files sets list
216  // component.
217  this.filesSets.values().forEach((set) -> {
218  this.setsListModel.addElement(set);
219  });
220 
221  if (!this.filesSets.isEmpty()) {
222  // Select the first files set by default. The list selections
223  // listeners will then populate the other components.
224  EventQueue.invokeLater(() -> {
225  FilesSetDefsPanel.this.setsList.setSelectedIndex(0);
226  });
227  }
228  }
229 
233  private void resetComponents() {
234  this.resetRuleComponents();
235  this.setsListModel.clear();
236  this.setDescriptionTextArea.setText("");
237  this.ignoreKnownFilesCheckbox.setSelected(true);
238  this.ingoreUnallocCheckbox.setSelected(true);
239  this.newSetButton.setEnabled(true && canBeEnabled);
240  this.editSetButton.setEnabled(false);
241  this.copySetButton.setEnabled(false);
242  this.exportSetButton.setEnabled(false);
243  this.importSetButton.setEnabled(true && canBeEnabled);
244  this.deleteSetButton.setEnabled(false);
245  }
246 
251  private void resetRuleComponents() {
252  this.fileNameTextField.setText("");
253  this.fileNameRadioButton.setSelected(true);
254  this.fileNameRegexCheckbox.setSelected(false);
255  this.filesRadioButton.setSelected(true);
256  this.rulePathConditionTextField.setText("");
257  this.daysIncludedTextField.setText("");
258  this.rulePathConditionRegexCheckBox.setSelected(false);
259  this.mimeTypeComboBox.setSelectedIndex(0);
260  this.equalitySignComboBox.setSelectedIndex(2);
261  this.fileSizeUnitComboBox.setSelectedIndex(1);
262  this.fileSizeSpinner.setValue(0);
263  this.newRuleButton.setEnabled(!this.setsListModel.isEmpty() && canBeEnabled);
264  this.editRuleButton.setEnabled(false);
265  this.deleteRuleButton.setEnabled(false);
266  }
267 
271  private final class SetsListSelectionListener implements ListSelectionListener {
272 
273  @Override
274  public void valueChanged(ListSelectionEvent e) {
275  if (e.getValueIsAdjusting()) {
276  return;
277  }
278  FilesSetDefsPanel.this.rulesListModel.clear();
280  //enable the new button
281  FilesSetDefsPanel.this.newSetButton.setEnabled(canBeEnabled);
282  FilesSetDefsPanel.this.importSetButton.setEnabled(canBeEnabled);
283 
284  // Get the selected interesting files set and populate the set
285  // components.
286  FilesSet selectedSet = FilesSetDefsPanel.this.setsList.getSelectedValue();
287 
288  if (selectedSet != null) {
289  // Populate the components that display the properties of the
290  // selected files set.
291  FilesSetDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription());
292  FilesSetDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles());
293  FilesSetDefsPanel.this.ingoreUnallocCheckbox.setSelected(selectedSet.ingoresUnallocatedSpace());
294  // Enable the copy, export, edit and delete set buttons.
295  FilesSetDefsPanel.this.editSetButton.setEnabled(canBeEnabled);
296  FilesSetDefsPanel.this.deleteSetButton.setEnabled(canBeEnabled);
297  FilesSetDefsPanel.this.copySetButton.setEnabled(canBeEnabled);
298  FilesSetDefsPanel.this.exportSetButton.setEnabled(true);
299  // Populate the rule definitions list, sorted by name.
300  List<FilesSet.Rule> rules = new ArrayList<>(selectedSet.getRules().values());
301  Collections.sort(rules, new Comparator<FilesSet.Rule>() {
302  @Override
303  public int compare(FilesSet.Rule rule1, FilesSet.Rule rule2) {
304  return rule1.toString().compareTo(rule2.toString());
305  }
306  });
307  rules.forEach((rule) -> {
308  FilesSetDefsPanel.this.rulesListModel.addElement(rule);
309  });
310  // Select the first rule by default.
311  if (!FilesSetDefsPanel.this.rulesListModel.isEmpty()) {
312  FilesSetDefsPanel.this.rulesList.setSelectedIndex(0);
313  }
314  } else {
315  // Disable the edit, delete, copy, and export buttons
316  FilesSetDefsPanel.this.editSetButton.setEnabled(false);
317  FilesSetDefsPanel.this.deleteSetButton.setEnabled(false);
318  FilesSetDefsPanel.this.copySetButton.setEnabled(false);
319  FilesSetDefsPanel.this.exportSetButton.setEnabled(false);
320  }
321  }
322 
323  }
324 
329  private final class RulesListSelectionListener implements ListSelectionListener {
330 
331  @Override
332  public void valueChanged(ListSelectionEvent e) {
333  if (e.getValueIsAdjusting()) {
334  return;
335  }
336 
337  // Get the selected rule and populate the rule components.
338  FilesSet.Rule rule = FilesSetDefsPanel.this.rulesList.getSelectedValue();
339  if (rule != null) {
340  // Get the conditions that make up the rule.
341  FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition();
342  FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition();
343  FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition();
344  FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition();
345  FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition();
346  FilesSet.Rule.DateCondition dateCondition = rule.getDateCondition();
347  // Populate the components that display the properties of the
348  // selected rule.
349  if (nameCondition != null) {
350  FilesSetDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch());
351  FilesSetDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition);
352  FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition);
353  FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex());
354  } else {
355  FilesSetDefsPanel.this.fileNameTextField.setText("");
356  FilesSetDefsPanel.this.fileNameRadioButton.setSelected(true);
357  FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(false);
358  FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(false);
359  }
360  switch (typeCondition.getMetaType()) {
361  case FILES:
362  FilesSetDefsPanel.this.filesRadioButton.setSelected(true);
363  break;
364  case DIRECTORIES:
365  FilesSetDefsPanel.this.dirsRadioButton.setSelected(true);
366  break;
367  case FILES_AND_DIRECTORIES:
368  FilesSetDefsPanel.this.allRadioButton.setSelected(true);
369  break;
370  }
371  if (pathCondition != null) {
372  FilesSetDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch());
373  FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex());
374  } else {
376  FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false);
377  }
378  if (mimeTypeCondition != null) {
379  FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType());
380  } else {
381  FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0);
382  }
383  if (fileSizeCondition != null) {
384  FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName());
385  FilesSetDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol());
386  FilesSetDefsPanel.this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue());
387  } else {
388  FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1);
389  FilesSetDefsPanel.this.equalitySignComboBox.setSelectedIndex(2);
390  FilesSetDefsPanel.this.fileSizeSpinner.setValue(0);
391  }
392  if (dateCondition != null){
393  FilesSetDefsPanel.this.daysIncludedTextField.setText(Integer.toString(dateCondition.getDaysIncluded()));
394  }
395  else {
396  FilesSetDefsPanel.this.daysIncludedTextField.setText("");
397  }
398  // Enable the new, edit and delete rule buttons.
399  FilesSetDefsPanel.this.newRuleButton.setEnabled(true && canBeEnabled);
400  FilesSetDefsPanel.this.editRuleButton.setEnabled(true && canBeEnabled);
401  FilesSetDefsPanel.this.deleteRuleButton.setEnabled(true && canBeEnabled);
402  } else {
404  }
405  }
406 
407  }
408 
420  private void doFileSetsDialog(FilesSet selectedSet, boolean shouldCreateNew) {
421  // Create a files set defintion panle.
422  FilesSetPanel panel;
423  if (selectedSet != null) {
424  // Editing an existing set definition.
425  panel = new FilesSetPanel(selectedSet, panelType);
426  } else {
427  // Creating a new set definition.
428  panel = new FilesSetPanel(panelType);
429  }
430 
431  // Do a dialog box with the files set panel until the user either enters
432  // a valid definition or cancels. Note that the panel gives the user
433  // feedback when isValidDefinition() is called.
434  int option = JOptionPane.OK_OPTION;
435  do {
436  option = JOptionPane.showConfirmDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, filterDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
437  } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition());
438 
439  // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap.
440  // In case of editing an existing ruleset(selectedSet != null), following check is not performed.
441  if (this.filesSets.containsKey(panel.getFilesSetName()) && shouldCreateNew) {
442  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
443  "FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text",
444  panel.getFilesSetName()));
445  return;
446  }
447 
448  if (option == JOptionPane.OK_OPTION) {
449  Map<String, FilesSet.Rule> rules = new HashMap<>();
450  if (selectedSet != null) {
451  // Interesting file sets are immutable for thread safety,
452  // so editing a files set definition is a replacement operation.
453  // Preserve the existing rules from the set being edited.
454  rules.putAll(selectedSet.getRules());
455  }
456  if (shouldCreateNew) {
457  this.replaceFilesSet(null, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
458  } else {
459  this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
460  }
461  }
462  }
463 
471  private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) {
472  // Create a files set rule panel.
473  FilesSetRulePanel panel;
474  if (selectedRule != null) {
475  // Editing an existing rule definition.
476  panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton, panelType);
477  } else {
478  // Creating a new rule definition.
479  panel = new FilesSetRulePanel(okButton, cancelButton, panelType);
480  }
481  // Do a dialog box with the files set panel until the user either enters
482  // a valid definition or cancels. Note that the panel gives the user
483  // feedback when isValidDefinition() is called.
484  int option = JOptionPane.OK_OPTION;
485  do {
486  option = JOptionPane.showOptionDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton);
487 
488  } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition());
489 
490  if (option == JOptionPane.OK_OPTION) {
491  // Interesting file sets are immutable for thread safety,
492  // so editing a files set rule definition is a replacement
493  // operation. Preserve the existing rules from the set being edited.
494  FilesSet selectedSet = this.setsList.getSelectedValue();
495  Map<String, FilesSet.Rule> rules = new HashMap<>(selectedSet.getRules());
496 
497  // Remove the "old" rule definition and add the new/edited
498  // definition.
499  if (selectedRule != null) {
500  rules.remove(selectedRule.getUuid());
501  }
502  FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameCondition(), panel.getMetaTypeCondition(), panel.getPathCondition(), panel.getMimeTypeCondition(), panel.getFileSizeCondition(), panel.getDateCondition());
503  rules.put(newRule.getUuid(), newRule);
504 
505  // Add the new/edited files set definition, replacing any previous
506  // definition with the same name and refreshing the display.
507  this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), selectedSet.ingoresUnallocatedSpace(), rules);
508 
509  // Select the new/edited rule. Queue it up so it happens after the
510  // selection listeners react to the selection of the "new" files
511  // set.
512  EventQueue.invokeLater(() -> {
513  this.rulesList.setSelectedValue(newRule, true);
514  });
515  }
516  }
517 
533  void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean ignoresUnallocatedSpace, Map<String, FilesSet.Rule> rules) {
534  if (oldSet != null) {
535  // Remove the set to be replaced from the working copy if the files
536  // set definitions.
537  this.filesSets.remove(oldSet.getName());
538  }
539 
540  // Make the new/edited set definition and add it to the working copy of
541  // the files set definitions.
542  FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, ignoresUnallocatedSpace, rules);
543  this.filesSets.put(newSet.getName(), newSet);
544 
545  // Redo the list model for the files set list component, which will make
546  // everything stays sorted as in the working copy tree set.
547  FilesSetDefsPanel.this.setsListModel.clear();
548  this.filesSets.values().forEach((set) -> {
549  this.setsListModel.addElement(set);
550  });
551 
552  // Select the new/edited files set definition in the set definitions
553  // list. This will cause the selection listeners to repopulate the
554  // subordinate components.
555  this.setsList.setSelectedValue(newSet, true);
556  }
557 
563  @SuppressWarnings("unchecked")
564  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
565  private void initComponents() {
566 
567  fileNameButtonGroup = new javax.swing.ButtonGroup();
568  typeButtonGroup = new javax.swing.ButtonGroup();
569  jScrollPane1 = new javax.swing.JScrollPane();
570  jPanel1 = new javax.swing.JPanel();
571  jLabel6 = new javax.swing.JLabel();
572  newRuleButton = new javax.swing.JButton();
573  filesRadioButton = new javax.swing.JRadioButton();
574  editRuleButton = new javax.swing.JButton();
575  rulesListLabel = new javax.swing.JLabel();
576  rulesListScrollPane = new javax.swing.JScrollPane();
577  rulesList = new javax.swing.JList<>();
578  setDescScrollPanel = new javax.swing.JScrollPane();
579  setDescriptionTextArea = new javax.swing.JTextArea();
580  editSetButton = new javax.swing.JButton();
581  setsListScrollPane = new javax.swing.JScrollPane();
582  setsList = new javax.swing.JList<>();
583  fileNameExtensionRadioButton = new javax.swing.JRadioButton();
584  jLabel3 = new javax.swing.JLabel();
585  fileNameTextField = new javax.swing.JTextField();
586  jLabel5 = new javax.swing.JLabel();
587  fileNameRadioButton = new javax.swing.JRadioButton();
588  rulePathConditionTextField = new javax.swing.JTextField();
589  ignoreKnownFilesCheckbox = new javax.swing.JCheckBox();
590  fileNameRegexCheckbox = new javax.swing.JCheckBox();
591  separator = new javax.swing.JSeparator();
592  setsListLabel = new javax.swing.JLabel();
593  allRadioButton = new javax.swing.JRadioButton();
594  deleteSetButton = new javax.swing.JButton();
595  deleteRuleButton = new javax.swing.JButton();
596  newSetButton = new javax.swing.JButton();
597  jLabel2 = new javax.swing.JLabel();
598  dirsRadioButton = new javax.swing.JRadioButton();
599  jLabel1 = new javax.swing.JLabel();
600  jLabel4 = new javax.swing.JLabel();
601  rulePathConditionRegexCheckBox = new javax.swing.JCheckBox();
602  jScrollPane2 = new javax.swing.JScrollPane();
603  jTextArea1 = new javax.swing.JTextArea();
604  jLabel7 = new javax.swing.JLabel();
605  mimeTypeComboBox = new javax.swing.JComboBox<>();
606  jLabel8 = new javax.swing.JLabel();
607  equalitySignComboBox = new javax.swing.JComboBox<String>();
608  fileSizeSpinner = new javax.swing.JSpinner();
609  fileSizeUnitComboBox = new javax.swing.JComboBox<String>();
610  ingoreUnallocCheckbox = new javax.swing.JCheckBox();
611  ingestWarningLabel = new javax.swing.JLabel();
612  copySetButton = new javax.swing.JButton();
613  importSetButton = new javax.swing.JButton();
614  exportSetButton = new javax.swing.JButton();
615  modifiedDateLabel = new javax.swing.JLabel();
616  daysIncludedTextField = new javax.swing.JTextField();
617  daysIncludedLabel = new javax.swing.JLabel();
618 
619  setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
620 
621  jScrollPane1.setFont(jScrollPane1.getFont().deriveFont(jScrollPane1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
622 
623  jPanel1.setFont(jPanel1.getFont().deriveFont(jPanel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
624 
625  jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
626  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jLabel6.text")); // NOI18N
627 
628  newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
629  newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
630  org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.newRuleButton.text")); // NOI18N
631  newRuleButton.addActionListener(new java.awt.event.ActionListener() {
632  public void actionPerformed(java.awt.event.ActionEvent evt) {
633  newRuleButtonActionPerformed(evt);
634  }
635  });
636 
637  typeButtonGroup.add(filesRadioButton);
638  filesRadioButton.setFont(filesRadioButton.getFont().deriveFont(filesRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
639  filesRadioButton.setSelected(true);
640  org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.filesRadioButton.text")); // NOI18N
641  filesRadioButton.setEnabled(false);
642 
643  editRuleButton.setFont(editRuleButton.getFont().deriveFont(editRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
644  editRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
645  org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.editRuleButton.text")); // NOI18N
646  editRuleButton.setEnabled(false);
647  editRuleButton.addActionListener(new java.awt.event.ActionListener() {
648  public void actionPerformed(java.awt.event.ActionEvent evt) {
649  editRuleButtonActionPerformed(evt);
650  }
651  });
652 
653  rulesListLabel.setFont(rulesListLabel.getFont().deriveFont(rulesListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
654  org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulesListLabel.text")); // NOI18N
655 
656  rulesListScrollPane.setFont(rulesListScrollPane.getFont().deriveFont(rulesListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
657 
658  rulesList.setFont(rulesList.getFont().deriveFont(rulesList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
659  rulesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
660  rulesListScrollPane.setViewportView(rulesList);
661 
662  setDescScrollPanel.setFont(setDescScrollPanel.getFont().deriveFont(setDescScrollPanel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
663  setDescScrollPanel.setMinimumSize(new java.awt.Dimension(10, 22));
664  setDescScrollPanel.setPreferredSize(new java.awt.Dimension(14, 40));
665 
666  setDescriptionTextArea.setEditable(false);
667  setDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
668  setDescriptionTextArea.setColumns(20);
669  setDescriptionTextArea.setFont(setDescriptionTextArea.getFont().deriveFont(setDescriptionTextArea.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
670  setDescriptionTextArea.setLineWrap(true);
671  setDescriptionTextArea.setRows(6);
672  setDescriptionTextArea.setMinimumSize(new java.awt.Dimension(10, 22));
673  setDescriptionTextArea.setOpaque(false);
674  setDescScrollPanel.setViewportView(setDescriptionTextArea);
675 
676  editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
677  editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
678  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.editSetButton.text")); // NOI18N
679  editSetButton.setEnabled(false);
680  editSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
681  editSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
682  editSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
683  editSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
684  editSetButton.addActionListener(new java.awt.event.ActionListener() {
685  public void actionPerformed(java.awt.event.ActionEvent evt) {
686  editSetButtonActionPerformed(evt);
687  }
688  });
689 
690  setsListScrollPane.setFont(setsListScrollPane.getFont().deriveFont(setsListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
691 
692  setsList.setFont(setsList.getFont().deriveFont(setsList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
693  setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
694  setsListScrollPane.setViewportView(setsList);
695 
696  fileNameButtonGroup.add(fileNameExtensionRadioButton);
697  fileNameExtensionRadioButton.setFont(fileNameExtensionRadioButton.getFont().deriveFont(fileNameExtensionRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
698  org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N
699  fileNameExtensionRadioButton.setEnabled(false);
700 
701  jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
702  org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel3.text")); // NOI18N
703 
704  fileNameTextField.setEditable(false);
705  fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
706  fileNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameTextField.text")); // NOI18N
707 
708  jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
709  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel5.text")); // NOI18N
710 
711  fileNameButtonGroup.add(fileNameRadioButton);
712  fileNameRadioButton.setFont(fileNameRadioButton.getFont().deriveFont(fileNameRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
713  org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRadioButton.text")); // NOI18N
714  fileNameRadioButton.setEnabled(false);
715 
716  rulePathConditionTextField.setEditable(false);
717  rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
718  rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionTextField.text")); // NOI18N
719 
720  ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
721  org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N
722  ignoreKnownFilesCheckbox.setEnabled(false);
723 
724  fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
725  org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N
726  fileNameRegexCheckbox.setEnabled(false);
727  fileNameRegexCheckbox.addActionListener(new java.awt.event.ActionListener() {
728  public void actionPerformed(java.awt.event.ActionEvent evt) {
729  fileNameRegexCheckboxActionPerformed(evt);
730  }
731  });
732 
733  separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
734 
735  setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
736  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N
737 
738  typeButtonGroup.add(allRadioButton);
739  allRadioButton.setFont(allRadioButton.getFont().deriveFont(allRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
740  org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.allRadioButton.text")); // NOI18N
741  allRadioButton.setEnabled(false);
742 
743  deleteSetButton.setFont(deleteSetButton.getFont().deriveFont(deleteSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
744  deleteSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
745  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.deleteSetButton.text")); // NOI18N
746  deleteSetButton.setEnabled(false);
747  deleteSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
748  deleteSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
749  deleteSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
750  deleteSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
751  deleteSetButton.addActionListener(new java.awt.event.ActionListener() {
752  public void actionPerformed(java.awt.event.ActionEvent evt) {
753  deleteSetButtonActionPerformed(evt);
754  }
755  });
756 
757  deleteRuleButton.setFont(deleteRuleButton.getFont().deriveFont(deleteRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
758  deleteRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
759  org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteRuleButton.text")); // NOI18N
760  deleteRuleButton.setEnabled(false);
761  deleteRuleButton.addActionListener(new java.awt.event.ActionListener() {
762  public void actionPerformed(java.awt.event.ActionEvent evt) {
763  deleteRuleButtonActionPerformed(evt);
764  }
765  });
766 
767  newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
768  newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
769  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.newSetButton.text")); // NOI18N
770  newSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
771  newSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
772  newSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
773  newSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
774  newSetButton.addActionListener(new java.awt.event.ActionListener() {
775  public void actionPerformed(java.awt.event.ActionEvent evt) {
776  newSetButtonActionPerformed(evt);
777  }
778  });
779 
780  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
781  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel2.text")); // NOI18N
782 
783  typeButtonGroup.add(dirsRadioButton);
784  dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
785  org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.dirsRadioButton.text")); // NOI18N
786  dirsRadioButton.setEnabled(false);
787 
788  jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
789  org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel1.text")); // NOI18N
790 
791  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
792  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel4.text")); // NOI18N
793 
794  rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
795  org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N
796  rulePathConditionRegexCheckBox.setEnabled(false);
797 
798  jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
799 
800  jTextArea1.setEditable(false);
801  jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
802  jTextArea1.setColumns(20);
803  jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
804  jTextArea1.setLineWrap(true);
805  jTextArea1.setRows(3);
806  jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N
807  jTextArea1.setWrapStyleWord(true);
808  jTextArea1.setOpaque(false);
809  jScrollPane2.setViewportView(jTextArea1);
810 
811  org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel7.text")); // NOI18N
812 
813  mimeTypeComboBox.setBackground(new java.awt.Color(240, 240, 240));
814  mimeTypeComboBox.setEditable(true);
815  mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {""}));
816  mimeTypeComboBox.setEnabled(false);
817  mimeTypeComboBox.setMinimumSize(new java.awt.Dimension(0, 20));
818  mimeTypeComboBox.setPreferredSize(new java.awt.Dimension(12, 20));
819 
820  org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel8.text")); // NOI18N
821 
822  equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "=", ">", "≥", "<", "≤" }));
823  equalitySignComboBox.setEnabled(false);
824 
825  fileSizeSpinner.setEnabled(false);
826  fileSizeSpinner.setMinimumSize(new java.awt.Dimension(2, 20));
827 
828  fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { Bundle.FilesSetDefsPanel_bytes(), Bundle.FilesSetDefsPanel_kiloBytes(), Bundle.FilesSetDefsPanel_megaBytes(), Bundle.FilesSetDefsPanel_gigaBytes() }));
829  fileSizeUnitComboBox.setEnabled(false);
830 
831  org.openide.awt.Mnemonics.setLocalizedText(ingoreUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.text")); // NOI18N
832  ingoreUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText")); // NOI18N
833  ingoreUnallocCheckbox.setEnabled(false);
834 
835  ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
836  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
837  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingestWarningLabel.text")); // NOI18N
838 
839  copySetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/new16.png"))); // NOI18N
840  org.openide.awt.Mnemonics.setLocalizedText(copySetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.copySetButton.text")); // NOI18N
841  copySetButton.setEnabled(false);
842  copySetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
843  copySetButton.setMaximumSize(new java.awt.Dimension(111, 25));
844  copySetButton.setMinimumSize(new java.awt.Dimension(111, 25));
845  copySetButton.setPreferredSize(new java.awt.Dimension(111, 25));
846  copySetButton.addActionListener(new java.awt.event.ActionListener() {
847  public void actionPerformed(java.awt.event.ActionEvent evt) {
848  copySetButtonActionPerformed(evt);
849  }
850  });
851 
852  importSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/import16.png"))); // NOI18N
853  org.openide.awt.Mnemonics.setLocalizedText(importSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.importSetButton.text")); // NOI18N
854  importSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
855  importSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
856  importSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
857  importSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
858  importSetButton.addActionListener(new java.awt.event.ActionListener() {
859  public void actionPerformed(java.awt.event.ActionEvent evt) {
860  importSetButtonActionPerformed(evt);
861  }
862  });
863 
864  exportSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/export16.png"))); // NOI18N
865  org.openide.awt.Mnemonics.setLocalizedText(exportSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.exportSetButton.text")); // NOI18N
866  exportSetButton.setEnabled(false);
867  exportSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
868  exportSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
869  exportSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
870  exportSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
871  exportSetButton.addActionListener(new java.awt.event.ActionListener() {
872  public void actionPerformed(java.awt.event.ActionEvent evt) {
873  exportSetButtonActionPerformed(evt);
874  }
875  });
876 
877  org.openide.awt.Mnemonics.setLocalizedText(modifiedDateLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.modifiedDateLabel.text")); // NOI18N
878 
879  daysIncludedTextField.setEditable(false);
880  daysIncludedTextField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
881  daysIncludedTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedTextField.text")); // NOI18N
882  daysIncludedTextField.setMinimumSize(new java.awt.Dimension(60, 20));
883  daysIncludedTextField.setPreferredSize(new java.awt.Dimension(60, 20));
884 
885  org.openide.awt.Mnemonics.setLocalizedText(daysIncludedLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedLabel.text")); // NOI18N
886  daysIncludedLabel.setEnabled(false);
887 
888  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
889  jPanel1.setLayout(jPanel1Layout);
890  jPanel1Layout.setHorizontalGroup(
891  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
892  .addGroup(jPanel1Layout.createSequentialGroup()
893  .addContainerGap()
894  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
895  .addGroup(jPanel1Layout.createSequentialGroup()
896  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
897  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
898  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
899  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
900  .addComponent(importSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
901  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
902  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
903  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
904  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
905  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
906  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
907  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
908  .addComponent(deleteSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
909  .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
910  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
911  .addComponent(setsListLabel))
912  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
913  .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
914  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
915  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
916  .addGroup(jPanel1Layout.createSequentialGroup()
917  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
918  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
919  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
920  .addGroup(jPanel1Layout.createSequentialGroup()
921  .addGap(16, 16, 16)
922  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
923  .addComponent(jLabel7)
924  .addComponent(jLabel8)
925  .addComponent(jLabel2)
926  .addComponent(jLabel4)
927  .addComponent(modifiedDateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
928  .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
929  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
930  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
931  .addComponent(rulePathConditionTextField)
932  .addComponent(fileNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)
933  .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
934  .addGroup(jPanel1Layout.createSequentialGroup()
935  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
936  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
937  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
938  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
939  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
940  .addGroup(jPanel1Layout.createSequentialGroup()
941  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
942  .addComponent(rulePathConditionRegexCheckBox)
943  .addGroup(jPanel1Layout.createSequentialGroup()
944  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
945  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
946  .addComponent(daysIncludedLabel))
947  .addGroup(jPanel1Layout.createSequentialGroup()
948  .addComponent(filesRadioButton)
949  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
950  .addComponent(dirsRadioButton)
951  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
952  .addComponent(allRadioButton))
953  .addGroup(jPanel1Layout.createSequentialGroup()
954  .addComponent(fileNameRadioButton)
955  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
956  .addComponent(fileNameExtensionRadioButton)
957  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
958  .addComponent(fileNameRegexCheckbox)))
959  .addGap(0, 0, Short.MAX_VALUE)))))
960  .addGap(8, 8, 8))
961  .addGroup(jPanel1Layout.createSequentialGroup()
962  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
963  .addComponent(rulesListLabel)
964  .addGroup(jPanel1Layout.createSequentialGroup()
965  .addComponent(ignoreKnownFilesCheckbox)
966  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
967  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
968  .addGroup(jPanel1Layout.createSequentialGroup()
969  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
970  .addComponent(jLabel5)
971  .addComponent(jLabel6))
972  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
973  .addComponent(ingestWarningLabel))
974  .addComponent(jLabel1)
975  .addGroup(jPanel1Layout.createSequentialGroup()
976  .addComponent(newRuleButton)
977  .addGap(18, 18, 18)
978  .addComponent(editRuleButton)
979  .addGap(18, 18, 18)
980  .addComponent(deleteRuleButton)))
981  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
982  );
983 
984  jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copySetButton, deleteSetButton, editSetButton, exportSetButton, importSetButton, newSetButton});
985 
986  jPanel1Layout.setVerticalGroup(
987  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
988  .addGroup(jPanel1Layout.createSequentialGroup()
989  .addContainerGap()
990  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
991  .addComponent(separator)
992  .addGroup(jPanel1Layout.createSequentialGroup()
993  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
994  .addGroup(jPanel1Layout.createSequentialGroup()
995  .addComponent(jLabel6)
996  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
997  .addComponent(jLabel5)
998  .addGap(1, 1, 1))
999  .addComponent(ingestWarningLabel, javax.swing.GroupLayout.Alignment.TRAILING))
1000  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1001  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
1002  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1003  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1004  .addComponent(ignoreKnownFilesCheckbox)
1005  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
1006  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1007  .addComponent(rulesListLabel)
1008  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1009  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
1010  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1011  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1012  .addComponent(newRuleButton)
1013  .addComponent(editRuleButton)
1014  .addComponent(deleteRuleButton))
1015  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1016  .addComponent(jLabel1)
1017  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1018  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1019  .addComponent(jLabel2)
1020  .addComponent(filesRadioButton)
1021  .addComponent(dirsRadioButton)
1022  .addComponent(allRadioButton))
1023  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1024  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1025  .addComponent(jLabel3)
1026  .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1027  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1028  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1029  .addComponent(fileNameRadioButton)
1030  .addComponent(fileNameExtensionRadioButton)
1031  .addComponent(fileNameRegexCheckbox))
1032  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1033  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1034  .addComponent(jLabel4)
1035  .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1036  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1037  .addComponent(rulePathConditionRegexCheckBox)
1038  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1039  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1040  .addComponent(jLabel7)
1041  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1042  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1043  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1044  .addComponent(jLabel8)
1045  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1046  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1047  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1048  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1049  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1050  .addComponent(modifiedDateLabel)
1051  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1052  .addComponent(daysIncludedLabel))
1053  .addContainerGap())
1054  .addGroup(jPanel1Layout.createSequentialGroup()
1055  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1056  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1057  .addComponent(setsListLabel)
1058  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1059  .addComponent(setsListScrollPane)
1060  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1061  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1062  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1063  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1064  .addComponent(deleteSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1065  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1066  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1067  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1068  .addComponent(importSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1069  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1070  .addGap(6, 6, 6))))
1071  );
1072 
1073  jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {copySetButton, deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, exportSetButton, importSetButton, newRuleButton, newSetButton});
1074 
1075  jScrollPane1.setViewportView(jPanel1);
1076 
1077  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1078  this.setLayout(layout);
1079  layout.setHorizontalGroup(
1080  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1081  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
1082  );
1083  layout.setVerticalGroup(
1084  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1085  .addComponent(jScrollPane1)
1086  );
1087  }// </editor-fold>//GEN-END:initComponents
1088 
1089  private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed
1090  this.doFileSetsDialog(null, true);
1091  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1092  }//GEN-LAST:event_newSetButtonActionPerformed
1093 
1094  private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed
1095  // Interesting file sets are immutable for thread safety,
1096  // so editing a files set rule definition is a replacement
1097  // operation. Preserve the existing rules from the set being
1098  // edited, except for the deleted rule.
1099  FilesSet oldSet = this.setsList.getSelectedValue();
1100  Map<String, FilesSet.Rule> rules = new HashMap<>(oldSet.getRules());
1101  FilesSet.Rule selectedRule = this.rulesList.getSelectedValue();
1102  rules.remove(selectedRule.getUuid());
1103  this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.ingoresUnallocatedSpace(), rules);
1104  if (!this.rulesListModel.isEmpty()) {
1105  this.rulesList.setSelectedIndex(0);
1106  } else {
1107  this.resetRuleComponents();
1108  }
1109  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1110  }//GEN-LAST:event_deleteRuleButtonActionPerformed
1111 
1112  private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed
1113  FilesSet selectedSet = this.setsList.getSelectedValue();
1114  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
1115  for (IngestProfile profile : IngestProfiles.getIngestProfiles()) {
1116  if (profile.getFileIngestFilter().equals(selectedSet.getName())) {
1117  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
1118  "FilesSetDefsPanel.ingest.fileFilterInUseError",
1119  selectedSet.getName(), profile.toString()));
1120  return;
1121  }
1122  }
1123 
1124  }
1125  this.filesSets.remove(selectedSet.getName());
1126  this.setsListModel.removeElement(selectedSet);
1127  // Select the first of the remaining set definitions. This will cause
1128  // the selection listeners to repopulate the subordinate components.
1129  if (!this.filesSets.isEmpty()) {
1130  this.setsList.setSelectedIndex(0);
1131  } else {
1132  this.resetComponents();
1133  }
1134  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1135  }//GEN-LAST:event_deleteSetButtonActionPerformed
1136 
1137  private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed
1138  this.doFileSetsDialog(this.setsList.getSelectedValue(), false);
1139  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1140  }//GEN-LAST:event_editSetButtonActionPerformed
1141 
1142  private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed
1143  this.doFilesSetRuleDialog(this.rulesList.getSelectedValue());
1144  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1145  }//GEN-LAST:event_editRuleButtonActionPerformed
1146 
1147  private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed
1148  this.doFilesSetRuleDialog(null);
1149  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1150  }//GEN-LAST:event_newRuleButtonActionPerformed
1151 
1152  private void copySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copySetButtonActionPerformed
1153  this.doFileSetsDialog(this.setsList.getSelectedValue(), true);
1154  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1155  }//GEN-LAST:event_copySetButtonActionPerformed
1156  @NbBundle.Messages({
1157  "FilesSetDefsPanel.yesOwMsg=Yes, overwrite",
1158  "FilesSetDefsPanel.noSkipMsg=No, skip",
1159  "FilesSetDefsPanel.cancelImportMsg=Cancel import",
1160  "# {0} - FilesSet name",
1161  "FilesSetDefsPanel.interesting.overwriteSetPrompt=Interesting files set <{0}> already exists locally, overwrite?",
1162  "FilesSetDefsPanel.interesting.importOwConflict=Import Interesting files set conflict",
1163  "FilesSetDefsPanel.interesting.failImportMsg=Interesting files set not imported",
1164  "FilesSetDefsPanel.interesting.fileExtensionFilterLbl=Autopsy Interesting File Set File (xml)",
1165  "FilesSetDefsPanel.interesting.importButtonAction.featureName=Interesting Files Set Import"
1166  })
1167  private void importSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importSetButtonActionPerformed
1168  //save currently selected value as default value to select
1169  FilesSet selectedSet = this.setsList.getSelectedValue();
1170  JFileChooser chooser = new JFileChooser();
1171  final String EXTENSION = "xml"; //NON-NLS
1172  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1173  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1174  chooser.addChoosableFileFilter(autopsyFilter);
1175  chooser.setAcceptAllFileFilterUsed(false);
1176  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1177  int returnVal = chooser.showOpenDialog(this);
1178  if (returnVal == JFileChooser.APPROVE_OPTION) {
1179  File selFile = chooser.getSelectedFile();
1180  if (selFile == null) {
1181  JOptionPane.showMessageDialog(this,
1182  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1183  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1184  JOptionPane.WARNING_MESSAGE);
1185  logger.warning("Selected file was null, when trying to import interesting files set definitions");
1186  return;
1187  }
1188  Collection<FilesSet> importedSets;
1189  try {
1190  importedSets = InterestingItemsFilesSetSettings.readDefinitionsXML(selFile).values(); //read the xml from that path
1191  if (importedSets.isEmpty()) {
1192  throw new FilesSetsManager.FilesSetsManagerException("No Files Sets were read from the xml.");
1193  }
1195  JOptionPane.showMessageDialog(this,
1196  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1197  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1198  JOptionPane.WARNING_MESSAGE);
1199  logger.log(Level.WARNING, "No Interesting files set definitions were read from the selected file, exception", ex);
1200  return;
1201  }
1202  for (FilesSet set : importedSets) {
1203  int choice = JOptionPane.OK_OPTION;
1204  if (filesSets.containsKey(set.getName())) {
1205  Object[] options = {NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.yesOwMsg"),
1206  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.noSkipMsg"),
1207  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.cancelImportMsg")};
1208  choice = JOptionPane.showOptionDialog(this,
1209  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.overwriteSetPrompt", set.getName()),
1210  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importOwConflict"),
1211  JOptionPane.YES_NO_CANCEL_OPTION,
1212  JOptionPane.QUESTION_MESSAGE,
1213  null,
1214  options,
1215  options[0]);
1216  }
1217  if (choice == JOptionPane.OK_OPTION) {
1218  selectedSet = set;
1219  this.filesSets.put(set.getName(), set);
1220  } else if (choice == JOptionPane.CANCEL_OPTION) {
1221  break;
1222  }
1223  }
1224  // Redo the list model for the files set list component
1225  FilesSetDefsPanel.this.setsListModel.clear();
1226  this.filesSets.values().forEach((set) -> {
1227  this.setsListModel.addElement(set);
1228  });
1229  // Select the new/edited files set definition in the set definitions
1230  // list. This will cause the selection listeners to repopulate the
1231  // subordinate components.
1232  this.setsList.setSelectedValue(selectedSet, true);
1233  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1234  }
1235 
1236  }//GEN-LAST:event_importSetButtonActionPerformed
1237 
1238  @NbBundle.Messages({"FilesSetDefsPanel.interesting.exportButtonAction.featureName=Interesting Files Set Export",
1239  "# {0} - file name",
1240  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt=File {0} exists, overwrite?",
1241  "FilesSetDefsPanel.interesting.ExportedMsg=Interesting files set exported",
1242  "FilesSetDefsPanel.interesting.failExportMsg=Export of interesting files set failed"})
1243  private void exportSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportSetButtonActionPerformed
1244  //display warning that existing filessets with duplicate names will be overwritten
1245  //create file chooser to get xml filefinal String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1246  JFileChooser chooser = new JFileChooser();
1247  final String EXTENSION = "xml"; //NON-NLS
1248  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1249  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1250  chooser.addChoosableFileFilter(autopsyFilter);
1251  chooser.setSelectedFile(new File(this.setsList.getSelectedValue().getName()));
1252  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1253  int returnVal = chooser.showSaveDialog(this);
1254  if (returnVal == JFileChooser.APPROVE_OPTION) {
1255  final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1256  "FilesSetDefsPanel.interesting.exportButtonAction.featureName");
1257  File selFile = chooser.getSelectedFile();
1258  if (selFile == null) {
1259  JOptionPane.showMessageDialog(this,
1260  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1261  FEATURE_NAME,
1262  JOptionPane.WARNING_MESSAGE);
1263  logger.warning("Selected file was null, when trying to export interesting files set definitions");
1264  return;
1265  }
1266  //force append extension if not given
1267  String fileAbs = selFile.getAbsolutePath();
1268  if (!fileAbs.endsWith("." + EXTENSION)) {
1269  fileAbs = fileAbs + "." + EXTENSION;
1270  selFile = new File(fileAbs);
1271  }
1272  if (selFile.exists()) {
1273  //if the file already exists ask the user how to proceed
1274  final String FILE_EXISTS_MESSAGE = NbBundle.getMessage(this.getClass(),
1275  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt", selFile.getName());
1276  boolean shouldWrite = JOptionPane.showConfirmDialog(this, FILE_EXISTS_MESSAGE, FEATURE_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION;
1277  if (!shouldWrite) {
1278  return;
1279  }
1280  }
1281  List<FilesSet> exportSets;
1282  exportSets = new ArrayList<>();
1283  //currently only exports selectedValue
1284  exportSets.add(this.setsList.getSelectedValue());
1285  boolean written = InterestingItemsFilesSetSettings.exportXmlDefinitionsFile(selFile, exportSets);
1286  if (written) {
1287  JOptionPane.showMessageDialog(
1288  WindowManager.getDefault().getMainWindow(),
1289  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.ExportedMsg"),
1290  FEATURE_NAME,
1291  JOptionPane.INFORMATION_MESSAGE);
1292  } else {
1293  JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
1294  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1295  FEATURE_NAME,
1296  JOptionPane.WARNING_MESSAGE);
1297  logger.warning("Export of interesting files set failed unable to write definitions xml file");
1298  }
1299  }
1300  }//GEN-LAST:event_exportSetButtonActionPerformed
1301 
1302  private void fileNameRegexCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameRegexCheckboxActionPerformed
1303  // TODO add your handling code here:
1304  }//GEN-LAST:event_fileNameRegexCheckboxActionPerformed
1305 
1306  // Variables declaration - do not modify//GEN-BEGIN:variables
1307  private javax.swing.JRadioButton allRadioButton;
1308  private javax.swing.JButton copySetButton;
1309  private javax.swing.JLabel daysIncludedLabel;
1310  private javax.swing.JTextField daysIncludedTextField;
1311  private javax.swing.JButton deleteRuleButton;
1312  private javax.swing.JButton deleteSetButton;
1313  private javax.swing.JRadioButton dirsRadioButton;
1314  private javax.swing.JButton editRuleButton;
1315  private javax.swing.JButton editSetButton;
1316  private javax.swing.JComboBox<String> equalitySignComboBox;
1317  private javax.swing.JButton exportSetButton;
1318  private javax.swing.ButtonGroup fileNameButtonGroup;
1319  private javax.swing.JRadioButton fileNameExtensionRadioButton;
1320  private javax.swing.JRadioButton fileNameRadioButton;
1321  private javax.swing.JCheckBox fileNameRegexCheckbox;
1322  private javax.swing.JTextField fileNameTextField;
1323  private javax.swing.JSpinner fileSizeSpinner;
1324  private javax.swing.JComboBox<String> fileSizeUnitComboBox;
1325  private javax.swing.JRadioButton filesRadioButton;
1326  private javax.swing.JCheckBox ignoreKnownFilesCheckbox;
1327  private javax.swing.JButton importSetButton;
1328  private javax.swing.JLabel ingestWarningLabel;
1329  private javax.swing.JCheckBox ingoreUnallocCheckbox;
1330  private javax.swing.JLabel jLabel1;
1331  private javax.swing.JLabel jLabel2;
1332  private javax.swing.JLabel jLabel3;
1333  private javax.swing.JLabel jLabel4;
1334  private javax.swing.JLabel jLabel5;
1335  private javax.swing.JLabel jLabel6;
1336  private javax.swing.JLabel jLabel7;
1337  private javax.swing.JLabel jLabel8;
1338  private javax.swing.JPanel jPanel1;
1339  private javax.swing.JScrollPane jScrollPane1;
1340  private javax.swing.JScrollPane jScrollPane2;
1341  private javax.swing.JTextArea jTextArea1;
1342  private javax.swing.JComboBox<String> mimeTypeComboBox;
1343  private javax.swing.JLabel modifiedDateLabel;
1344  private javax.swing.JButton newRuleButton;
1345  private javax.swing.JButton newSetButton;
1346  private javax.swing.JCheckBox rulePathConditionRegexCheckBox;
1347  private javax.swing.JTextField rulePathConditionTextField;
1348  private javax.swing.JList<FilesSet.Rule> rulesList;
1349  private javax.swing.JLabel rulesListLabel;
1350  private javax.swing.JScrollPane rulesListScrollPane;
1351  private javax.swing.JSeparator separator;
1352  private javax.swing.JScrollPane setDescScrollPanel;
1353  private javax.swing.JTextArea setDescriptionTextArea;
1354  private javax.swing.JList<FilesSet> setsList;
1355  private javax.swing.JLabel setsListLabel;
1356  private javax.swing.JScrollPane setsListScrollPane;
1357  private javax.swing.ButtonGroup typeButtonGroup;
1358  // End of variables declaration//GEN-END:variables
1359 
1360 }
static synchronized List< IngestProfile > getIngestProfiles()
void doFileSetsDialog(FilesSet selectedSet, boolean shouldCreateNew)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
static synchronized SortedSet< String > getDetectedTypes()

Copyright © 2012-2018 Basis Technology. Generated on: Wed Sep 18 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.