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

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.