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

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