Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
HashLookupSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2019 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.hashdatabase;
20 
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.awt.EventQueue;
24 import java.awt.Frame;
25 import java.awt.event.KeyEvent;
26 import java.beans.PropertyChangeEvent;
27 import java.beans.PropertyChangeListener;
28 import java.util.ArrayList;
29 import java.util.List;
30 import java.util.logging.Level;
31 import javax.swing.JComponent;
32 import javax.swing.JOptionPane;
33 import javax.swing.JTable;
34 import javax.swing.ListSelectionModel;
35 import javax.swing.SwingUtilities;
36 import javax.swing.event.ListSelectionEvent;
37 import javax.swing.event.ListSelectionListener;
38 import javax.swing.table.AbstractTableModel;
39 import javax.swing.table.TableCellRenderer;
40 import org.netbeans.spi.options.OptionsPanelController;
41 import org.openide.util.NbBundle;
42 import org.openide.util.NbBundle.Messages;
54 import org.sleuthkit.datamodel.TskCoreException;
56 
61 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
63 
64  private static final String NSRL_URL = "https://sourceforge.net/projects/autopsy/files/NSRL/";
65  private static final String NSRL_NAME_STRING = "nsrl";
66  private static final String NO_SELECTION_TEXT = NbBundle
67  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.noSelectionText");
68  private static final String ERROR_GETTING_PATH_TEXT = NbBundle
69  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingPathText");
70  private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
71  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingIndexStatusText");
72  private static final Logger logger = Logger.getLogger(HashLookupSettingsPanel.class.getName());
73  private final HashDbManager hashSetManager = HashDbManager.getInstance();
74  private final HashSetTableModel hashSetTableModel = new HashSetTableModel();
75  private final List<Integer> newReferenceSetIDs = new ArrayList<>();
76 
78  initComponents();
79  customizeComponents();
80  updateComponentsForNoSelection();
81 
82  // Listen to the ingest modules to refresh the enabled/disabled state of
83  // the components in sync with file ingest.
84  IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
85  @Override
86  public void propertyChange(PropertyChangeEvent evt) {
87  if (isLocalIngestJobEvent(evt)) {
88  EventQueue.invokeLater(new Runnable() {
89  @Override
90  public void run() {
91  updateComponents();
92  }
93  });
94  }
95  }
96  });
97  }
98 
99  @NbBundle.Messages({"HashLookupSettingsPanel.Title=Global Hash Lookup Settings"})
100  private void customizeComponents() {
101  setName(Bundle.HashLookupSettingsPanel_Title());
102  this.ingestWarningLabel.setVisible(false);
103  this.hashSetTable.setModel(hashSetTableModel);
104  this.hashSetTable.setTableHeader(null);
105  hashSetTable.getParent().setBackground(hashSetTable.getBackground());
106  hashSetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
107  hashSetTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
108  @Override
109  public void valueChanged(ListSelectionEvent e) {
110  if (!e.getValueIsAdjusting()) {
111  updateComponents();
112  }
113  }
114  });
115  }
116 
117  private void updateComponents() {
118  HashDb db = ((HashSetTable) hashSetTable).getSelection();
119  if (db != null) {
120  updateComponentsForSelection(db);
121  } else {
122  updateComponentsForNoSelection();
123  }
124  }
125 
127  boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
128 
129  // Update descriptive labels.
130  hashDbNameLabel.setText(NO_SELECTION_TEXT);
131  hashDbTypeLabel.setText(NO_SELECTION_TEXT);
132  hashDbLocationLabel.setText(NO_SELECTION_TEXT);
133  hashDbVersionLabel.setText(NO_SELECTION_TEXT);
134  hashDbOrgLabel.setText(NO_SELECTION_TEXT);
135  hashDbReadOnlyLabel.setText(NO_SELECTION_TEXT);
136  indexPathLabel.setText(NO_SELECTION_TEXT);
137 
138  // Update indexing components.
139  hashDbIndexStatusLabel.setText(NO_SELECTION_TEXT);
140  hashDbIndexStatusLabel.setForeground(Color.black);
141  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
142  indexButton.setEnabled(false);
143  addHashesToDatabaseButton.setEnabled(false);
144 
145  // Update ingest options.
146  sendIngestMessagesCheckBox.setSelected(false);
147  sendIngestMessagesCheckBox.setEnabled(false);
148 
149  // Update database action buttons.
150  createDatabaseButton.setEnabled(true);
151  importDatabaseButton.setEnabled(true);
152  deleteDatabaseButton.setEnabled(false);
153 
154  // Update ingest in progress warning label.
155  ingestWarningLabel.setVisible(ingestIsRunning);
156  }
157 
158  @NbBundle.Messages({"HashLookupSettingsPanel.readOnly=Read only",
159  "HashLookupSettingsPanel.editable=Editable",
160  "HashLookupSettingsPanel.updateStatusError=Error reading status",
161  "HashLookupSettingsPanel.notApplicable=N/A",
162  "HashLookupSettingsPanel.centralRepo=Central Repository"
163  })
165  boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
166 
167  // Update descriptive labels.
168  hashDbNameLabel.setText(db.getHashSetName());
169  hashDbTypeLabel.setText(db.getKnownFilesType().getDisplayName());
170  try {
171  if (db.isUpdateable()) {
172  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
173  } else {
174  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
175  }
176  } catch (TskCoreException ex) {
177  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
178  }
179 
180  try {
181  addHashesToDatabaseButton.setEnabled(!ingestIsRunning && db.isUpdateable());
182  } catch (TskCoreException ex) {
183  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error identifying if the hash set is updateable.", ex); //NON-NLS
184  addHashesToDatabaseButton.setEnabled(false);
185  }
186 
187  if (db instanceof SleuthkitHashSet) {
188  SleuthkitHashSet hashDb = (SleuthkitHashSet) db;
189 
190  // Disable the central repo fields
191  hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
192  hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
193 
194  // Enable the delete button if ingest is not running
195  deleteDatabaseButton.setEnabled(!ingestIsRunning);
196 
197  try {
198  hashDbLocationLabel.setText(db.getDatabasePath());
199  } catch (TskCoreException ex) {
200  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting hash set path of " + db.getHashSetName() + " hash set", ex); //NON-NLS
201  hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
202  }
203 
204  try {
205  indexPathLabel.setText(hashDb.getIndexPath());
206  } catch (TskCoreException ex) {
207  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index path of " + db.getHashSetName() + " hash set", ex); //NON-NLS
208  indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
209  }
210 
211  // Update indexing components.
212  try {
213  if (hashDb.isIndexing()) {
214  indexButton.setText(
215  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.indexing"));
216  hashDbIndexStatusLabel.setText(
217  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexGen"));
218  hashDbIndexStatusLabel.setForeground(Color.black);
219  indexButton.setEnabled(false);
220  } else if (hashDb.hasIndex()) {
221  if (hashDb.hasIndexOnly()) {
222  hashDbIndexStatusLabel.setText(
223  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexOnly"));
224  } else {
225  hashDbIndexStatusLabel.setText(
226  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexed"));
227  }
228  hashDbIndexStatusLabel.setForeground(Color.black);
229  if (hashDb.canBeReIndexed()) {
230  indexButton.setText(
231  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.reIndex"));
232  indexButton.setEnabled(true);
233  } else {
234  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
235  indexButton.setEnabled(false);
236  }
237  } else {
238  hashDbIndexStatusLabel.setText(
239  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.noIndex"));
240  hashDbIndexStatusLabel.setForeground(Color.red);
241  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
242  indexButton.setEnabled(true);
243  }
244  } catch (TskCoreException ex) {
245  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index state of hash set", ex); //NON-NLS
246  hashDbIndexStatusLabel.setText(ERROR_GETTING_INDEX_STATUS_TEXT);
247  hashDbIndexStatusLabel.setForeground(Color.red);
248  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
249  indexButton.setEnabled(false);
250  }
251  } else {
252 
253  // Disable the file type fields/buttons
254  indexPathLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
255  hashDbIndexStatusLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
256  hashDbLocationLabel.setText(Bundle.HashLookupSettingsPanel_centralRepo());
257  indexButton.setEnabled(false);
258  deleteDatabaseButton.setEnabled(false);
259 
260  CentralRepoHashSet crDb = (CentralRepoHashSet) db;
261 
262  hashDbVersionLabel.setText(crDb.getVersion());
263  hashDbOrgLabel.setText(crDb.getOrgName());
264  }
265 
266  // Disable the indexing button if ingest is in progress.
267  if (ingestIsRunning) {
268  indexButton.setEnabled(false);
269  }
270 
271  // Update ingest option components.
272  sendIngestMessagesCheckBox.setSelected(db.getSendIngestMessages());
273  sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.getKnownFilesType().equals(KnownFilesType.KNOWN_BAD));
274 
275  // Update database action buttons.
276  createDatabaseButton.setEnabled(true);
277  importDatabaseButton.setEnabled(true);
278 
279  // Update ingest in progress warning label.
280  ingestWarningLabel.setVisible(ingestIsRunning);
281  }
282 
283  private boolean isLocalIngestJobEvent(PropertyChangeEvent evt) {
284  if (evt instanceof AutopsyEvent) {
285  AutopsyEvent event = (AutopsyEvent) evt;
286  if (event.getSourceType() == AutopsyEvent.SourceType.LOCAL) {
287  String eventType = event.getPropertyName();
288  return (eventType.equals(IngestManager.IngestJobEvent.STARTED.toString())
289  || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())
290  || eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()));
291  }
292  }
293  return false;
294  }
295 
296  @Override
297  @Messages({"HashLookupSettingsPanel.saveFail.message=Couldn't save hash set settings.",
298  "HashLookupSettingsPanel.saveFail.title=Save Fail"})
299  public void saveSettings() {
300  // Clear out the list of new central repo hash sets. They don't need to be
301  // indexed so will all be saved on both code paths.
302  newReferenceSetIDs.clear();
303 
304  //Checking for for any unindexed databases
305  List<SleuthkitHashSet> unindexed = new ArrayList<>();
306  for (HashDb db : hashSetManager.getAllHashSets()) {
307  if (db instanceof SleuthkitHashSet) {
308  try {
309  SleuthkitHashSet hashDatabase = (SleuthkitHashSet) db;
310  if (!hashDatabase.hasIndex()) {
311  unindexed.add(hashDatabase);
312  }
313  } catch (TskCoreException ex) {
314  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index info for hash set", ex); //NON-NLS
315  }
316  }
317  }
318 
319  // If there are unindexed databases, give the user the option to index them now. This
320  // needs to be on the EDT, and will save the hash settings after completing
321  if (!unindexed.isEmpty()) {
322  SwingUtilities.invokeLater(new Runnable() {
323  @Override
324  public void run() {
325  //If unindexed ones are found, show a popup box that will either index them, or remove them.
326  if (!unindexed.isEmpty()) {
327  showInvalidIndex(unindexed);
328  }
329  }
330  });
331  } else {
332  try {
333  hashSetManager.save();
335  SwingUtilities.invokeLater(() -> {
336  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
337  });
338  }
339  }
340  }
341 
342  @Override
343  public void load() {
344  hashSetTable.clearSelection();
345  hashSetTableModel.refreshModel();
346  }
347 
348  @Override
349  public void store() {
350  saveSettings();
351  }
352 
353  public void cancel() {
354  /*
355  * Revert back to last settings only if the user could have made
356  * changes. Doing this while ingest is running causes hash dbs to be
357  * closed while they are still being used.
358  */
359  if (IngestManager.getInstance().isIngestRunning() == false) {
360  // Remove any new central repo hash sets from the database
361  for (int refID : newReferenceSetIDs) {
362  try {
363  if (EamDb.isEnabled()) {
365  } else {
366  // This is the case where the user imported a database, then switched over to the central
367  // repo panel and disabled it before cancelling. We can't delete the database at this point.
368  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.WARNING, "Error reverting central repository hash sets"); //NON-NLS
369  }
370  } catch (EamDbException ex) {
371  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error reverting central repository hash sets", ex); //NON-NLS
372  }
373  }
375  }
376  }
377 
378  @Messages({"# {0} - hash lookup name", "HashLookupSettingsPanel.removeDatabaseFailure.message=Failed to remove hash lookup: {0}"})
379  void removeThese(List<SleuthkitHashSet> toRemove) {
380  for (SleuthkitHashSet hashDb : toRemove) {
381  try {
382  hashSetManager.removeHashDatabaseNoSave(hashDb);
383  } catch (HashDbManager.HashDbManagerException ex) {
384  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
385  }
386  }
387  hashSetTableModel.refreshModel();
388  }
389 
397  @NbBundle.Messages({"# {0} - nsrlUrlAddress",
398  "HashLookupSettingsPanel.removeUnindexedNsrl.text=Instead of indexing the NSRL, please download an already indexed version available here:\n{0}",
399  "# {0} - nsrlHashSet",
400  "HashLookupSettingsPanel.unindexedNsrl.base=The following hash set appears to be an unindexed version of the NSRL, it will be removed from the list.\nHash set:{0}\n",
401  "# {0} - nsrlHashSets",
402  "HashLookupSettingsPanel.unindexedNsrls.base=The following hash sets appear to be unindexed versions of the NSRL, they will be removed from the list.\nHash sets:{0}\n",
403  "HashLookupSettingsPanel.removeUnindexedNsrl.title=Unindexed NSRL(s) will be removed"})
404  private void showInvalidIndex(List<SleuthkitHashSet> unindexed) {
405  String total = "";
406  String nsrlTotal = "";
407 
408  List<SleuthkitHashSet> nsrlHashsets = new ArrayList<>();
409  for (SleuthkitHashSet hdb : unindexed) {
410  //check if this is the NSRL if so point users toward already indexed versions
411  if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
412  nsrlHashsets.add(hdb);
413  nsrlTotal += "\n" + hdb.getHashSetName();
414  } else {
415  total += "\n" + hdb.getHashSetName();
416  }
417  }
418  if (!nsrlHashsets.isEmpty()) {
419  String message;
420  if (nsrlHashsets.size() > 1) {
421  message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
422  } else {
423  message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
424  }
425  JOptionPane.showMessageDialog(this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
426  for (SleuthkitHashSet hdb : nsrlHashsets) {
427  unindexed.remove(hdb);
428  }
429  removeThese(nsrlHashsets);
430  }
431  String message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbNotIndexedMsg", total);
432  if (unindexed.isEmpty()) {
433  return;
434  } else if (unindexed.size() > 1) {
435  message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbsNotIndexedMsg", total);
436  }
437  int res = JOptionPane.showConfirmDialog(this, message,
438  NbBundle.getMessage(this.getClass(),
439  "HashDbConfigPanel.unindexedDbsMsg"),
440  JOptionPane.YES_NO_OPTION);
441  if (res == JOptionPane.YES_OPTION) {
442  ModalNoButtons indexingDialog = new ModalNoButtons(this, new Frame(), unindexed);
443  indexingDialog.setLocationRelativeTo(null);
444  indexingDialog.setVisible(true);
445  indexingDialog.setModal(true);
446  hashSetTableModel.refreshModel();
447  }
448  if (res == JOptionPane.NO_OPTION) {
449  JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(),
450  "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
451  removeThese(unindexed);
452  }
453  try {
454  hashSetManager.save();
456  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
457  }
458  }
459 
460  boolean valid() {
461  return true;
462  }
463 
467  private class HashSetTable extends JTable {
468 
469  @Override
470  public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
471  // Use the hash set name as the cell text.
472  JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
473  cellRenderer.setToolTipText((String) getValueAt(row, column));
474 
475  // Give the user a visual indication of any hash sets with a hash
476  // database that needs to be indexed by displaying the hash set name
477  // in red.
478  if (hashSetTableModel.isValid(row)) {
479  cellRenderer.setForeground(Color.black);
480  } else {
481  cellRenderer.setForeground(Color.red);
482  }
483 
484  return cellRenderer;
485  }
486 
487  public HashDb getSelection() {
488  return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
489  }
490 
491  public void setSelection(int index) {
492  if (index >= 0 && index < hashSetTable.getRowCount()) {
493  getSelectionModel().setSelectionInterval(index, index);
494  }
495  }
496 
497  public void selectRowByDatabase(HashDb db) {
498  setSelection(hashSetTableModel.getIndexByDatabase(db));
499  }
500 
501  @Deprecated
502  public void selectRowByName(String name) {
503  setSelection(hashSetTableModel.getIndexByName(name));
504  }
505  }
506 
511  private class HashSetTableModel extends AbstractTableModel {
512 
513  List<HashDb> hashSets = HashDbManager.getInstance().getAllHashSets();
514 
515  @Override
516  public int getColumnCount() {
517  return 1;
518  }
519 
520  @Override
521  public int getRowCount() {
522  return hashSets.size();
523  }
524 
525  @Override
526  public String getColumnName(int column) {
527  return NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.nameColLbl");
528  }
529 
530  @Override
531  public Object getValueAt(int rowIndex, int columnIndex) {
532  return hashSets.get(rowIndex).getDisplayName();
533  }
534 
535  private boolean isValid(int rowIndex) {
536  try {
537  return hashSets.get(rowIndex).isValid();
538  } catch (TskCoreException ex) {
539  Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash set", ex); //NON-NLS
540  return false;
541  }
542  }
543 
544  @Override
545  public boolean isCellEditable(int rowIndex, int columnIndex) {
546  return false;
547  }
548 
549  @Override
550  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
551  throw new UnsupportedOperationException(
552  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.editingCellsNotSupportedMsg"));
553  }
554 
555  @Override
556  public Class<?> getColumnClass(int c) {
557  return getValueAt(0, c).getClass();
558  }
559 
560  HashDb getHashSetAt(int index) {
561  if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
562  return hashSets.get(index);
563  } else {
564  return null;
565  }
566  }
567 
568  int getIndexByDatabase(HashDb db) {
569  for (int i = 0; i < hashSets.size(); ++i) {
570  if (hashSets.get(i).equals(db)) {
571  return i;
572  }
573  }
574  return -1;
575  }
576 
577  @Deprecated
578  int getIndexByName(String name) {
579  for (int i = 0; i < hashSets.size(); ++i) {
580  if (hashSets.get(i).getHashSetName().equals(name)) {
581  return i;
582  }
583  }
584  return -1;
585  }
586 
587  void refreshModel() {
588  hashSets = HashDbManager.getInstance().getAllHashSets();
589  refreshDisplay();
590  }
591 
592  void refreshDisplay() {
593  fireTableDataChanged();
594  }
595  }
596 
602  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
603  private void initComponents() {
604 
605  jLabel2 = new javax.swing.JLabel();
606  jLabel4 = new javax.swing.JLabel();
607  jLabel6 = new javax.swing.JLabel();
608  jButton3 = new javax.swing.JButton();
609  jScrollPane2 = new javax.swing.JScrollPane();
610  jPanel1 = new javax.swing.JPanel();
611  hashDatabasesLabel = new javax.swing.JLabel();
612  jScrollPane1 = new javax.swing.JScrollPane();
613  hashSetTable = new HashSetTable();
614  createDatabaseButton = new javax.swing.JButton();
615  importDatabaseButton = new javax.swing.JButton();
616  deleteDatabaseButton = new javax.swing.JButton();
617  informationLabel = new javax.swing.JLabel();
618  informationScrollPanel = new javax.swing.JScrollPane();
619  informationPanel = new javax.swing.JPanel();
620  nameLabel = new javax.swing.JLabel();
621  hashDbNameLabel = new javax.swing.JLabel();
622  typeLabel = new javax.swing.JLabel();
623  hashDbTypeLabel = new javax.swing.JLabel();
624  locationLabel = new javax.swing.JLabel();
625  hashDbLocationLabel = new javax.swing.JLabel();
626  versionLabel = new javax.swing.JLabel();
627  hashDbVersionLabel = new javax.swing.JLabel();
628  orgLabel = new javax.swing.JLabel();
629  hashDbOrgLabel = new javax.swing.JLabel();
630  readOnlyLabel = new javax.swing.JLabel();
631  hashDbReadOnlyLabel = new javax.swing.JLabel();
632  indexPathLabelLabel = new javax.swing.JLabel();
633  indexPathLabel = new javax.swing.JLabel();
634  indexLabel = new javax.swing.JLabel();
635  hashDbIndexStatusLabel = new javax.swing.JLabel();
636  indexButton = new javax.swing.JButton();
637  addHashesToDatabaseButton = new javax.swing.JButton();
638  sendIngestMessagesCheckBox = new javax.swing.JCheckBox();
639  ingestWarningLabel = new javax.swing.JLabel();
640 
641  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
642  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel2.text")); // NOI18N
643 
644  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
645  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel4.text")); // NOI18N
646 
647  jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
648  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel6.text")); // NOI18N
649 
650  jButton3.setFont(jButton3.getFont().deriveFont(jButton3.getFont().getStyle() & ~java.awt.Font.BOLD, 14));
651  org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jButton3.text")); // NOI18N
652 
653  hashDatabasesLabel.setFont(hashDatabasesLabel.getFont().deriveFont(hashDatabasesLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
654  org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDatabasesLabel.text")); // NOI18N
655 
656  hashSetTable.setFont(hashSetTable.getFont().deriveFont(hashSetTable.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
657  hashSetTable.setModel(new javax.swing.table.DefaultTableModel(
658  new Object [][] {
659 
660  },
661  new String [] {
662 
663  }
664  ));
665  hashSetTable.setShowHorizontalLines(false);
666  hashSetTable.setShowVerticalLines(false);
667  hashSetTable.addKeyListener(new java.awt.event.KeyAdapter() {
668  public void keyPressed(java.awt.event.KeyEvent evt) {
669  hashSetTableKeyPressed(evt);
670  }
671  });
672  jScrollPane1.setViewportView(hashSetTable);
673 
674  createDatabaseButton.setFont(createDatabaseButton.getFont().deriveFont(createDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
675  createDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"))); // NOI18N
676  org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.text")); // NOI18N
677  createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N
678  createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
679  createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
680  createDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
681  public void actionPerformed(java.awt.event.ActionEvent evt) {
682  createDatabaseButtonActionPerformed(evt);
683  }
684  });
685 
686  importDatabaseButton.setFont(importDatabaseButton.getFont().deriveFont(importDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
687  importDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/import16.png"))); // NOI18N
688  org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.text")); // NOI18N
689  importDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.toolTipText")); // NOI18N
690  importDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
691  importDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
692  importDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
693  public void actionPerformed(java.awt.event.ActionEvent evt) {
694  importDatabaseButtonActionPerformed(evt);
695  }
696  });
697 
698  deleteDatabaseButton.setFont(deleteDatabaseButton.getFont().deriveFont(deleteDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
699  deleteDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"))); // NOI18N
700  org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N
701  deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
702  deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
703  deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
704  public void actionPerformed(java.awt.event.ActionEvent evt) {
705  deleteDatabaseButtonActionPerformed(evt);
706  }
707  });
708 
709  informationLabel.setFont(informationLabel.getFont().deriveFont(informationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
710  org.openide.awt.Mnemonics.setLocalizedText(informationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.informationLabel.text")); // NOI18N
711 
712  informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
713 
714  nameLabel.setFont(nameLabel.getFont().deriveFont(nameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
715  org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.nameLabel.text")); // NOI18N
716 
717  hashDbNameLabel.setFont(hashDbNameLabel.getFont().deriveFont(hashDbNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
718  org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbNameLabel.text")); // NOI18N
719 
720  typeLabel.setFont(typeLabel.getFont().deriveFont(typeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
721  org.openide.awt.Mnemonics.setLocalizedText(typeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.typeLabel.text")); // NOI18N
722 
723  hashDbTypeLabel.setFont(hashDbTypeLabel.getFont().deriveFont(hashDbTypeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
724  org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbTypeLabel.text")); // NOI18N
725 
726  locationLabel.setFont(locationLabel.getFont().deriveFont(locationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
727  org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.locationLabel.text")); // NOI18N
728 
729  hashDbLocationLabel.setFont(hashDbLocationLabel.getFont().deriveFont(hashDbLocationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
730  org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbLocationLabel.text")); // NOI18N
731 
732  org.openide.awt.Mnemonics.setLocalizedText(versionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.versionLabel.text_1")); // NOI18N
733 
734  org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbVersionLabel.text_1")); // NOI18N
735 
736  org.openide.awt.Mnemonics.setLocalizedText(orgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.orgLabel.text_1")); // NOI18N
737 
738  org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbOrgLabel.text_1")); // NOI18N
739 
740  org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.readOnlyLabel.text_1")); // NOI18N
741 
742  org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1")); // NOI18N
743 
744  indexPathLabelLabel.setFont(indexPathLabelLabel.getFont().deriveFont(indexPathLabelLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
745  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabelLabel.text")); // NOI18N
746 
747  indexPathLabel.setFont(indexPathLabel.getFont().deriveFont(indexPathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
748  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabel.text")); // NOI18N
749 
750  indexLabel.setFont(indexLabel.getFont().deriveFont(indexLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
751  org.openide.awt.Mnemonics.setLocalizedText(indexLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexLabel.text")); // NOI18N
752 
753  hashDbIndexStatusLabel.setFont(hashDbIndexStatusLabel.getFont().deriveFont(hashDbIndexStatusLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
754  org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbIndexStatusLabel.text")); // NOI18N
755 
756  javax.swing.GroupLayout informationPanelLayout = new javax.swing.GroupLayout(informationPanel);
757  informationPanel.setLayout(informationPanelLayout);
758  informationPanelLayout.setHorizontalGroup(
759  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
760  .addGroup(informationPanelLayout.createSequentialGroup()
761  .addContainerGap()
762  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
763  .addGroup(informationPanelLayout.createSequentialGroup()
764  .addComponent(locationLabel)
765  .addGap(18, 18, 18)
766  .addComponent(hashDbLocationLabel))
767  .addGroup(informationPanelLayout.createSequentialGroup()
768  .addComponent(nameLabel)
769  .addGap(18, 18, 18)
770  .addComponent(hashDbNameLabel))
771  .addGroup(informationPanelLayout.createSequentialGroup()
772  .addComponent(typeLabel)
773  .addGap(18, 18, 18)
774  .addComponent(hashDbTypeLabel))
775  .addGroup(informationPanelLayout.createSequentialGroup()
776  .addComponent(versionLabel)
777  .addGap(18, 18, 18)
778  .addComponent(hashDbVersionLabel))
779  .addGroup(informationPanelLayout.createSequentialGroup()
780  .addComponent(orgLabel)
781  .addGap(18, 18, 18)
782  .addComponent(hashDbOrgLabel))
783  .addGroup(informationPanelLayout.createSequentialGroup()
784  .addComponent(readOnlyLabel)
785  .addGap(18, 18, 18)
786  .addComponent(hashDbReadOnlyLabel))
787  .addGroup(informationPanelLayout.createSequentialGroup()
788  .addComponent(indexLabel)
789  .addGap(18, 18, 18)
790  .addComponent(hashDbIndexStatusLabel))
791  .addGroup(informationPanelLayout.createSequentialGroup()
792  .addComponent(indexPathLabelLabel)
793  .addGap(18, 18, 18)
794  .addComponent(indexPathLabel)))
795  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
796  );
797 
798  informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
799 
800  informationPanelLayout.setVerticalGroup(
801  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
802  .addGroup(informationPanelLayout.createSequentialGroup()
803  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
804  .addComponent(nameLabel)
805  .addComponent(hashDbNameLabel))
806  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
807  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
808  .addComponent(typeLabel)
809  .addComponent(hashDbTypeLabel))
810  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
811  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
812  .addComponent(locationLabel)
813  .addComponent(hashDbLocationLabel))
814  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
815  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
816  .addComponent(versionLabel)
817  .addComponent(hashDbVersionLabel))
818  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
819  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
820  .addComponent(orgLabel)
821  .addComponent(hashDbOrgLabel))
822  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
823  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
824  .addComponent(readOnlyLabel)
825  .addComponent(hashDbReadOnlyLabel))
826  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
827  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
828  .addComponent(indexPathLabelLabel)
829  .addComponent(indexPathLabel))
830  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
831  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
832  .addComponent(indexLabel)
833  .addComponent(hashDbIndexStatusLabel))
834  .addGap(0, 49, Short.MAX_VALUE))
835  );
836 
837  informationScrollPanel.setViewportView(informationPanel);
838 
839  indexButton.setFont(indexButton.getFont().deriveFont(indexButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
840  org.openide.awt.Mnemonics.setLocalizedText(indexButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexButton.text")); // NOI18N
841  indexButton.setEnabled(false);
842  indexButton.addActionListener(new java.awt.event.ActionListener() {
843  public void actionPerformed(java.awt.event.ActionEvent evt) {
844  indexButtonActionPerformed(evt);
845  }
846  });
847 
848  addHashesToDatabaseButton.setFont(addHashesToDatabaseButton.getFont().deriveFont(addHashesToDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
849  org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.addHashesToDatabaseButton.text")); // NOI18N
850  addHashesToDatabaseButton.setEnabled(false);
851  addHashesToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
852  public void actionPerformed(java.awt.event.ActionEvent evt) {
853  addHashesToDatabaseButtonActionPerformed(evt);
854  }
855  });
856 
857  sendIngestMessagesCheckBox.setFont(sendIngestMessagesCheckBox.getFont().deriveFont(sendIngestMessagesCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
858  org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.sendIngestMessagesCheckBox.text")); // NOI18N
859  sendIngestMessagesCheckBox.addActionListener(new java.awt.event.ActionListener() {
860  public void actionPerformed(java.awt.event.ActionEvent evt) {
861  sendIngestMessagesCheckBoxActionPerformed(evt);
862  }
863  });
864 
865  ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
866  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
867  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.ingestWarningLabel.text")); // NOI18N
868 
869  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
870  jPanel1.setLayout(jPanel1Layout);
871  jPanel1Layout.setHorizontalGroup(
872  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
873  .addGroup(jPanel1Layout.createSequentialGroup()
874  .addContainerGap()
875  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
876  .addGroup(jPanel1Layout.createSequentialGroup()
877  .addGap(1, 1, 1)
878  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
879  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
880  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
881  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
882  .addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
883  .addGap(356, 356, 356))
884  .addGroup(jPanel1Layout.createSequentialGroup()
885  .addComponent(indexButton)
886  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
887  .addComponent(addHashesToDatabaseButton)
888  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
889  .addGroup(jPanel1Layout.createSequentialGroup()
890  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
891  .addComponent(informationScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
892  .addGroup(jPanel1Layout.createSequentialGroup()
893  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
894  .addComponent(sendIngestMessagesCheckBox)
895  .addComponent(ingestWarningLabel))
896  .addGap(0, 0, Short.MAX_VALUE)))
897  .addContainerGap())))
898  .addGroup(jPanel1Layout.createSequentialGroup()
899  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
900  .addComponent(hashDatabasesLabel)
901  .addGroup(jPanel1Layout.createSequentialGroup()
902  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
903  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
904  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
905  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
906  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
907  .addGap(0, 0, Short.MAX_VALUE))))
908  );
909  jPanel1Layout.setVerticalGroup(
910  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
911  .addGroup(jPanel1Layout.createSequentialGroup()
912  .addContainerGap()
913  .addComponent(hashDatabasesLabel)
914  .addGap(6, 6, 6)
915  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
916  .addGroup(jPanel1Layout.createSequentialGroup()
917  .addComponent(informationLabel)
918  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
919  .addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
920  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
921  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
922  .addComponent(indexButton)
923  .addComponent(addHashesToDatabaseButton))
924  .addGap(18, 18, 18)
925  .addComponent(sendIngestMessagesCheckBox)
926  .addGap(18, 18, 18)
927  .addComponent(ingestWarningLabel)
928  .addGap(0, 0, Short.MAX_VALUE))
929  .addComponent(jScrollPane1))
930  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
931  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
932  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
933  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
934  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
935  .addContainerGap())
936  );
937 
938  jScrollPane2.setViewportView(jPanel1);
939 
940  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
941  this.setLayout(layout);
942  layout.setHorizontalGroup(
943  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
944  .addComponent(jScrollPane2)
945  );
946  layout.setVerticalGroup(
947  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
948  .addComponent(jScrollPane2)
949  );
950  }// </editor-fold>//GEN-END:initComponents
951 
952  private void addHashesToDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addHashesToDatabaseButtonActionPerformed
953 
954  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
956  }//GEN-LAST:event_addHashesToDatabaseButtonActionPerformed
957 
958  private void createDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createDatabaseButtonActionPerformed
959  HashDb hashDb = new HashDbCreateDatabaseDialog().getHashDatabase();
960  if (null != hashDb) {
961  if (hashDb instanceof CentralRepoHashSet) {
962  int newDbIndex = ((CentralRepoHashSet) hashDb).getReferenceSetID();
963  newReferenceSetIDs.add(newDbIndex);
964  }
965 
966  hashSetTableModel.refreshModel();
967  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
968  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
969  }
970  }//GEN-LAST:event_createDatabaseButtonActionPerformed
971 
972  private void sendIngestMessagesCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendIngestMessagesCheckBoxActionPerformed
973  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
974  if (hashDb != null) {
975  hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
976  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
977  }
978  }//GEN-LAST:event_sendIngestMessagesCheckBoxActionPerformed
979 
985  private boolean isWindows() {
986  return PlatformUtil.getOSName().toLowerCase().startsWith("Windows");
987  }
988 
989  @NbBundle.Messages({"HashLookupSettingsPanel.indexNsrl.text=This hash set appears to be the NSRL, it will be removed from the list.\n",
990  "HashLookupSettingsPanel.indexNsrl.title=NSRL will not be indexed"})
991  private void indexButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indexButtonActionPerformed
992  final HashDb hashDatabase = ((HashSetTable) hashSetTable).getSelection();
993  assert hashDatabase != null;
994  assert hashDatabase instanceof SleuthkitHashSet;
995 
996  // Add a listener for the INDEXING_DONE event. This listener will update
997  // the UI.
998  SleuthkitHashSet hashDb = (SleuthkitHashSet) hashDatabase;
999  if (isWindows() && hashDb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
1000  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_indexNsrl_text() + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL), Bundle.HashLookupSettingsPanel_indexNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
1001  try {
1002  hashSetManager.removeHashDatabaseNoSave(hashDatabase);
1003  hashSetTableModel.refreshModel();
1004  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1005  } catch (HashDbManager.HashDbManagerException ex) {
1006  logger.log(Level.WARNING, "Unable to remove unindexed NSRL from hash set list", ex);
1007  }
1008  } else {
1009  hashDb.addPropertyChangeListener(new PropertyChangeListener() {
1010  @Override
1011  public void propertyChange(PropertyChangeEvent evt) {
1012  if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
1013  HashDb selectedHashDb = ((HashSetTable) hashSetTable).getSelection();
1014  if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
1015  updateComponents();
1016  }
1017  hashSetTableModel.refreshDisplay();
1018  }
1019  }
1020  });
1021 
1022  // Display a modal dialog box to kick off the indexing on a worker thread
1023  // and try to persuade the user to wait for the indexing task to finish.
1024  // TODO: If the user waits, this defeats the purpose of doing the indexing on a worker thread.
1025  // But if the user cancels the dialog, other operations on the database
1026  // may be attempted when it is not in a suitable state.
1027  ModalNoButtons indexDialog = new ModalNoButtons(this, new Frame(), hashDb);
1028  indexDialog.setLocationRelativeTo(null);
1029  indexDialog.setVisible(true);
1030  indexDialog.setModal(true);
1031  }
1032  }//GEN-LAST:event_indexButtonActionPerformed
1033 
1034  private void importDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importDatabaseButtonActionPerformed
1035  HashDb hashDb = new HashDbImportDatabaseDialog().getHashDatabase();
1036  if (null != hashDb) {
1037  if (hashDb instanceof CentralRepoHashSet) {
1038  int newReferenceSetID = ((CentralRepoHashSet) hashDb).getReferenceSetID();
1039  newReferenceSetIDs.add(newReferenceSetID);
1040  }
1041 
1042  hashSetTableModel.refreshModel();
1043  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1044  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1045  }
1046  }//GEN-LAST:event_importDatabaseButtonActionPerformed
1047 
1048  @Messages({
1049  "HashLookupSettingsPanel.promptTitle.deleteHashDb=Delete Hash Database from Configuration",
1050  "HashLookupSettingsPanel.promptMessage.deleteHashDb=This will make the hash database unavailable for lookup. Do you want to proceed?\n\nNote: The hash database can still be re-imported later."
1051  })
1052  private void deleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDatabaseButtonActionPerformed
1053  if (JOptionPane.showConfirmDialog(this,
1054  Bundle.HashLookupSettingsPanel_promptMessage_deleteHashDb(),
1055  Bundle.HashLookupSettingsPanel_promptTitle_deleteHashDb(),
1056  JOptionPane.YES_NO_OPTION,
1057  JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
1058  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1059  if (hashDb != null) {
1060  try {
1061  hashSetManager.removeHashDatabaseNoSave(hashDb);
1062  } catch (HashDbManager.HashDbManagerException ex) {
1063  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1064  }
1065  hashSetTableModel.refreshModel();
1066  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1067  }
1068  }
1069  }//GEN-LAST:event_deleteDatabaseButtonActionPerformed
1070 
1071  private void hashSetTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hashSetTableKeyPressed
1072  if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1073  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1074  if (hashDb != null) {
1075  try {
1076  hashSetManager.removeHashDatabaseNoSave(hashDb);
1077  } catch (HashDbManager.HashDbManagerException ex) {
1078  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1079  }
1080  hashSetTableModel.refreshModel();
1081  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1082  }
1083  }
1084  }//GEN-LAST:event_hashSetTableKeyPressed
1085 
1086  // Variables declaration - do not modify//GEN-BEGIN:variables
1087  private javax.swing.JButton addHashesToDatabaseButton;
1088  private javax.swing.JButton createDatabaseButton;
1089  private javax.swing.JButton deleteDatabaseButton;
1090  private javax.swing.JLabel hashDatabasesLabel;
1091  private javax.swing.JLabel hashDbIndexStatusLabel;
1092  private javax.swing.JLabel hashDbLocationLabel;
1093  private javax.swing.JLabel hashDbNameLabel;
1094  private javax.swing.JLabel hashDbOrgLabel;
1095  private javax.swing.JLabel hashDbReadOnlyLabel;
1096  private javax.swing.JLabel hashDbTypeLabel;
1097  private javax.swing.JLabel hashDbVersionLabel;
1098  private javax.swing.JTable hashSetTable;
1099  private javax.swing.JButton importDatabaseButton;
1100  private javax.swing.JButton indexButton;
1101  private javax.swing.JLabel indexLabel;
1102  private javax.swing.JLabel indexPathLabel;
1103  private javax.swing.JLabel indexPathLabelLabel;
1104  private javax.swing.JLabel informationLabel;
1105  private javax.swing.JPanel informationPanel;
1106  private javax.swing.JScrollPane informationScrollPanel;
1107  private javax.swing.JLabel ingestWarningLabel;
1108  private javax.swing.JButton jButton3;
1109  private javax.swing.JLabel jLabel2;
1110  private javax.swing.JLabel jLabel4;
1111  private javax.swing.JLabel jLabel6;
1112  private javax.swing.JPanel jPanel1;
1113  private javax.swing.JScrollPane jScrollPane1;
1114  private javax.swing.JScrollPane jScrollPane2;
1115  private javax.swing.JLabel locationLabel;
1116  private javax.swing.JLabel nameLabel;
1117  private javax.swing.JLabel orgLabel;
1118  private javax.swing.JLabel readOnlyLabel;
1119  private javax.swing.JCheckBox sendIngestMessagesCheckBox;
1120  private javax.swing.JLabel typeLabel;
1121  private javax.swing.JLabel versionLabel;
1122  // End of variables declaration//GEN-END:variables
1123 }
static synchronized IngestManager getInstance()
Component prepareRenderer(TableCellRenderer renderer, int row, int column)
void addIngestJobEventListener(final PropertyChangeListener listener)
synchronized void removeHashDatabaseNoSave(HashDb hashDb)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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