Autopsy  4.11.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 
398  @NbBundle.Messages({"# {0} - nsrlUrlAddress",
399  "HashLookupSettingsPanel.removeUnindexedNsrl.text=Instead of indexing the NSRL, please download an already indexed version available here:\n{0}",
400  "# {0} - nsrlHashSet",
401  "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",
402  "# {0} - nsrlHashSets",
403  "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",
404  "HashLookupSettingsPanel.removeUnindexedNsrl.title=Unindexed NSRL(s) will be removed"})
405  private void showInvalidIndex(List<SleuthkitHashSet> unindexed) {
406  String total = "";
407  String nsrlTotal = "";
408 
409  List<SleuthkitHashSet> nsrlHashsets = new ArrayList<>();
410  for (SleuthkitHashSet hdb : unindexed) {
411  //check if this is the NSRL if so point users toward already indexed versions
412  if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
413  nsrlHashsets.add(hdb);
414  nsrlTotal += "\n" + hdb.getHashSetName();
415  } else {
416  total += "\n" + hdb.getHashSetName();
417  }
418  }
419  if (!nsrlHashsets.isEmpty()) {
420  String message;
421  if (nsrlHashsets.size() > 1) {
422  message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
423  } else {
424  message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
425  }
426  JOptionPane.showMessageDialog(this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
427  for (SleuthkitHashSet hdb : nsrlHashsets) {
428  unindexed.remove(hdb);
429  }
430  removeThese(nsrlHashsets);
431  }
432  String message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbNotIndexedMsg", total);
433  if (unindexed.isEmpty()) {
434  return;
435  } else if (unindexed.size() > 1) {
436  message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbsNotIndexedMsg", total);
437  }
438  int res = JOptionPane.showConfirmDialog(this, message,
439  NbBundle.getMessage(this.getClass(),
440  "HashDbConfigPanel.unindexedDbsMsg"),
441  JOptionPane.YES_NO_OPTION);
442  if (res == JOptionPane.YES_OPTION) {
443  ModalNoButtons indexingDialog = new ModalNoButtons(this, new Frame(), unindexed);
444  indexingDialog.setLocationRelativeTo(null);
445  indexingDialog.setVisible(true);
446  indexingDialog.setModal(true);
447  hashSetTableModel.refreshModel();
448  }
449  if (res == JOptionPane.NO_OPTION) {
450  JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(),
451  "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
452  removeThese(unindexed);
453  }
454  try {
455  hashSetManager.save();
457  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
458  }
459  }
460 
461  boolean valid() {
462  return true;
463  }
464 
468  private class HashSetTable extends JTable {
469 
470  @Override
471  public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
472  // Use the hash set name as the cell text.
473  JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
474  cellRenderer.setToolTipText((String) getValueAt(row, column));
475 
476  // Give the user a visual indication of any hash sets with a hash
477  // database that needs to be indexed by displaying the hash set name
478  // in red.
479  if (hashSetTableModel.isValid(row)) {
480  cellRenderer.setForeground(Color.black);
481  } else {
482  cellRenderer.setForeground(Color.red);
483  }
484 
485  return cellRenderer;
486  }
487 
488  public HashDb getSelection() {
489  return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
490  }
491 
492  public void setSelection(int index) {
493  if (index >= 0 && index < hashSetTable.getRowCount()) {
494  getSelectionModel().setSelectionInterval(index, index);
495  }
496  }
497 
498  public void selectRowByDatabase(HashDb db) {
499  setSelection(hashSetTableModel.getIndexByDatabase(db));
500  }
501 
502  @Deprecated
503  public void selectRowByName(String name) {
504  setSelection(hashSetTableModel.getIndexByName(name));
505  }
506  }
507 
512  private class HashSetTableModel extends AbstractTableModel {
513 
514  List<HashDb> hashSets = HashDbManager.getInstance().getAllHashSets();
515 
516  @Override
517  public int getColumnCount() {
518  return 1;
519  }
520 
521  @Override
522  public int getRowCount() {
523  return hashSets.size();
524  }
525 
526  @Override
527  public String getColumnName(int column) {
528  return NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.nameColLbl");
529  }
530 
531  @Override
532  public Object getValueAt(int rowIndex, int columnIndex) {
533  return hashSets.get(rowIndex).getDisplayName();
534  }
535 
536  private boolean isValid(int rowIndex) {
537  try {
538  return hashSets.get(rowIndex).isValid();
539  } catch (TskCoreException ex) {
540  Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash set", ex); //NON-NLS
541  return false;
542  }
543  }
544 
545  @Override
546  public boolean isCellEditable(int rowIndex, int columnIndex) {
547  return false;
548  }
549 
550  @Override
551  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
552  throw new UnsupportedOperationException(
553  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.editingCellsNotSupportedMsg"));
554  }
555 
556  @Override
557  public Class<?> getColumnClass(int c) {
558  return getValueAt(0, c).getClass();
559  }
560 
561  HashDb getHashSetAt(int index) {
562  if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
563  return hashSets.get(index);
564  } else {
565  return null;
566  }
567  }
568 
569  int getIndexByDatabase(HashDb db) {
570  for (int i = 0; i < hashSets.size(); ++i) {
571  if (hashSets.get(i).equals(db)) {
572  return i;
573  }
574  }
575  return -1;
576  }
577 
578  @Deprecated
579  int getIndexByName(String name) {
580  for (int i = 0; i < hashSets.size(); ++i) {
581  if (hashSets.get(i).getHashSetName().equals(name)) {
582  return i;
583  }
584  }
585  return -1;
586  }
587 
588  void refreshModel() {
589  hashSets = HashDbManager.getInstance().getAllHashSets();
590  refreshDisplay();
591  }
592 
593  void refreshDisplay() {
594  fireTableDataChanged();
595  }
596  }
597 
603  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
604  private void initComponents() {
605 
606  jLabel2 = new javax.swing.JLabel();
607  jLabel4 = new javax.swing.JLabel();
608  jLabel6 = new javax.swing.JLabel();
609  jButton3 = new javax.swing.JButton();
610  jScrollPane2 = new javax.swing.JScrollPane();
611  jPanel1 = new javax.swing.JPanel();
612  hashDatabasesLabel = new javax.swing.JLabel();
613  jScrollPane1 = new javax.swing.JScrollPane();
614  hashSetTable = new HashSetTable();
615  createDatabaseButton = new javax.swing.JButton();
616  importDatabaseButton = new javax.swing.JButton();
617  deleteDatabaseButton = new javax.swing.JButton();
618  informationLabel = new javax.swing.JLabel();
619  informationScrollPanel = new javax.swing.JScrollPane();
620  informationPanel = new javax.swing.JPanel();
621  nameLabel = new javax.swing.JLabel();
622  hashDbNameLabel = new javax.swing.JLabel();
623  typeLabel = new javax.swing.JLabel();
624  hashDbTypeLabel = new javax.swing.JLabel();
625  locationLabel = new javax.swing.JLabel();
626  hashDbLocationLabel = new javax.swing.JLabel();
627  versionLabel = new javax.swing.JLabel();
628  hashDbVersionLabel = new javax.swing.JLabel();
629  orgLabel = new javax.swing.JLabel();
630  hashDbOrgLabel = new javax.swing.JLabel();
631  readOnlyLabel = new javax.swing.JLabel();
632  hashDbReadOnlyLabel = new javax.swing.JLabel();
633  indexPathLabelLabel = new javax.swing.JLabel();
634  indexPathLabel = new javax.swing.JLabel();
635  indexLabel = new javax.swing.JLabel();
636  hashDbIndexStatusLabel = new javax.swing.JLabel();
637  indexButton = new javax.swing.JButton();
638  addHashesToDatabaseButton = new javax.swing.JButton();
639  sendIngestMessagesCheckBox = new javax.swing.JCheckBox();
640  ingestWarningLabel = new javax.swing.JLabel();
641 
642  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
643  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel2.text")); // NOI18N
644 
645  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
646  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel4.text")); // NOI18N
647 
648  jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
649  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel6.text")); // NOI18N
650 
651  jButton3.setFont(jButton3.getFont().deriveFont(jButton3.getFont().getStyle() & ~java.awt.Font.BOLD, 14));
652  org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jButton3.text")); // NOI18N
653 
654  hashDatabasesLabel.setFont(hashDatabasesLabel.getFont().deriveFont(hashDatabasesLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
655  org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDatabasesLabel.text")); // NOI18N
656 
657  hashSetTable.setFont(hashSetTable.getFont().deriveFont(hashSetTable.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
658  hashSetTable.setModel(new javax.swing.table.DefaultTableModel(
659  new Object [][] {
660 
661  },
662  new String [] {
663 
664  }
665  ));
666  hashSetTable.setShowHorizontalLines(false);
667  hashSetTable.setShowVerticalLines(false);
668  hashSetTable.addKeyListener(new java.awt.event.KeyAdapter() {
669  public void keyPressed(java.awt.event.KeyEvent evt) {
670  hashSetTableKeyPressed(evt);
671  }
672  });
673  jScrollPane1.setViewportView(hashSetTable);
674 
675  createDatabaseButton.setFont(createDatabaseButton.getFont().deriveFont(createDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
676  createDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"))); // NOI18N
677  org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.text")); // NOI18N
678  createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N
679  createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
680  createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
681  createDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
682  public void actionPerformed(java.awt.event.ActionEvent evt) {
683  createDatabaseButtonActionPerformed(evt);
684  }
685  });
686 
687  importDatabaseButton.setFont(importDatabaseButton.getFont().deriveFont(importDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
688  importDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/import16.png"))); // NOI18N
689  org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.text")); // NOI18N
690  importDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.toolTipText")); // NOI18N
691  importDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
692  importDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
693  importDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
694  public void actionPerformed(java.awt.event.ActionEvent evt) {
695  importDatabaseButtonActionPerformed(evt);
696  }
697  });
698 
699  deleteDatabaseButton.setFont(deleteDatabaseButton.getFont().deriveFont(deleteDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
700  deleteDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"))); // NOI18N
701  org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N
702  deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
703  deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
704  deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
705  public void actionPerformed(java.awt.event.ActionEvent evt) {
706  deleteDatabaseButtonActionPerformed(evt);
707  }
708  });
709 
710  informationLabel.setFont(informationLabel.getFont().deriveFont(informationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
711  org.openide.awt.Mnemonics.setLocalizedText(informationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.informationLabel.text")); // NOI18N
712 
713  informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
714 
715  nameLabel.setFont(nameLabel.getFont().deriveFont(nameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
716  org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.nameLabel.text")); // NOI18N
717 
718  hashDbNameLabel.setFont(hashDbNameLabel.getFont().deriveFont(hashDbNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
719  org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbNameLabel.text")); // NOI18N
720 
721  typeLabel.setFont(typeLabel.getFont().deriveFont(typeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
722  org.openide.awt.Mnemonics.setLocalizedText(typeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.typeLabel.text")); // NOI18N
723 
724  hashDbTypeLabel.setFont(hashDbTypeLabel.getFont().deriveFont(hashDbTypeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
725  org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbTypeLabel.text")); // NOI18N
726 
727  locationLabel.setFont(locationLabel.getFont().deriveFont(locationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
728  org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.locationLabel.text")); // NOI18N
729 
730  hashDbLocationLabel.setFont(hashDbLocationLabel.getFont().deriveFont(hashDbLocationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
731  org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbLocationLabel.text")); // NOI18N
732 
733  org.openide.awt.Mnemonics.setLocalizedText(versionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.versionLabel.text_1")); // NOI18N
734 
735  org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbVersionLabel.text_1")); // NOI18N
736 
737  org.openide.awt.Mnemonics.setLocalizedText(orgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.orgLabel.text_1")); // NOI18N
738 
739  org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbOrgLabel.text_1")); // NOI18N
740 
741  org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.readOnlyLabel.text_1")); // NOI18N
742 
743  org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1")); // NOI18N
744 
745  indexPathLabelLabel.setFont(indexPathLabelLabel.getFont().deriveFont(indexPathLabelLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
746  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabelLabel.text")); // NOI18N
747 
748  indexPathLabel.setFont(indexPathLabel.getFont().deriveFont(indexPathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
749  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabel.text")); // NOI18N
750 
751  indexLabel.setFont(indexLabel.getFont().deriveFont(indexLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
752  org.openide.awt.Mnemonics.setLocalizedText(indexLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexLabel.text")); // NOI18N
753 
754  hashDbIndexStatusLabel.setFont(hashDbIndexStatusLabel.getFont().deriveFont(hashDbIndexStatusLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
755  org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbIndexStatusLabel.text")); // NOI18N
756 
757  javax.swing.GroupLayout informationPanelLayout = new javax.swing.GroupLayout(informationPanel);
758  informationPanel.setLayout(informationPanelLayout);
759  informationPanelLayout.setHorizontalGroup(
760  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
761  .addGroup(informationPanelLayout.createSequentialGroup()
762  .addContainerGap()
763  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
764  .addGroup(informationPanelLayout.createSequentialGroup()
765  .addComponent(locationLabel)
766  .addGap(18, 18, 18)
767  .addComponent(hashDbLocationLabel))
768  .addGroup(informationPanelLayout.createSequentialGroup()
769  .addComponent(nameLabel)
770  .addGap(18, 18, 18)
771  .addComponent(hashDbNameLabel))
772  .addGroup(informationPanelLayout.createSequentialGroup()
773  .addComponent(typeLabel)
774  .addGap(18, 18, 18)
775  .addComponent(hashDbTypeLabel))
776  .addGroup(informationPanelLayout.createSequentialGroup()
777  .addComponent(versionLabel)
778  .addGap(18, 18, 18)
779  .addComponent(hashDbVersionLabel))
780  .addGroup(informationPanelLayout.createSequentialGroup()
781  .addComponent(orgLabel)
782  .addGap(18, 18, 18)
783  .addComponent(hashDbOrgLabel))
784  .addGroup(informationPanelLayout.createSequentialGroup()
785  .addComponent(readOnlyLabel)
786  .addGap(18, 18, 18)
787  .addComponent(hashDbReadOnlyLabel))
788  .addGroup(informationPanelLayout.createSequentialGroup()
789  .addComponent(indexLabel)
790  .addGap(18, 18, 18)
791  .addComponent(hashDbIndexStatusLabel))
792  .addGroup(informationPanelLayout.createSequentialGroup()
793  .addComponent(indexPathLabelLabel)
794  .addGap(18, 18, 18)
795  .addComponent(indexPathLabel)))
796  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
797  );
798 
799  informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
800 
801  informationPanelLayout.setVerticalGroup(
802  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
803  .addGroup(informationPanelLayout.createSequentialGroup()
804  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
805  .addComponent(nameLabel)
806  .addComponent(hashDbNameLabel))
807  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
808  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
809  .addComponent(typeLabel)
810  .addComponent(hashDbTypeLabel))
811  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
812  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
813  .addComponent(locationLabel)
814  .addComponent(hashDbLocationLabel))
815  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
816  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
817  .addComponent(versionLabel)
818  .addComponent(hashDbVersionLabel))
819  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
820  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
821  .addComponent(orgLabel)
822  .addComponent(hashDbOrgLabel))
823  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
824  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
825  .addComponent(readOnlyLabel)
826  .addComponent(hashDbReadOnlyLabel))
827  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
828  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
829  .addComponent(indexPathLabelLabel)
830  .addComponent(indexPathLabel))
831  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
832  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
833  .addComponent(indexLabel)
834  .addComponent(hashDbIndexStatusLabel))
835  .addGap(0, 49, Short.MAX_VALUE))
836  );
837 
838  informationScrollPanel.setViewportView(informationPanel);
839 
840  indexButton.setFont(indexButton.getFont().deriveFont(indexButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
841  org.openide.awt.Mnemonics.setLocalizedText(indexButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexButton.text")); // NOI18N
842  indexButton.setEnabled(false);
843  indexButton.addActionListener(new java.awt.event.ActionListener() {
844  public void actionPerformed(java.awt.event.ActionEvent evt) {
845  indexButtonActionPerformed(evt);
846  }
847  });
848 
849  addHashesToDatabaseButton.setFont(addHashesToDatabaseButton.getFont().deriveFont(addHashesToDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
850  org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.addHashesToDatabaseButton.text")); // NOI18N
851  addHashesToDatabaseButton.setEnabled(false);
852  addHashesToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
853  public void actionPerformed(java.awt.event.ActionEvent evt) {
854  addHashesToDatabaseButtonActionPerformed(evt);
855  }
856  });
857 
858  sendIngestMessagesCheckBox.setFont(sendIngestMessagesCheckBox.getFont().deriveFont(sendIngestMessagesCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
859  org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.sendIngestMessagesCheckBox.text")); // NOI18N
860  sendIngestMessagesCheckBox.addActionListener(new java.awt.event.ActionListener() {
861  public void actionPerformed(java.awt.event.ActionEvent evt) {
862  sendIngestMessagesCheckBoxActionPerformed(evt);
863  }
864  });
865 
866  ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
867  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
868  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.ingestWarningLabel.text")); // NOI18N
869 
870  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
871  jPanel1.setLayout(jPanel1Layout);
872  jPanel1Layout.setHorizontalGroup(
873  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
874  .addGroup(jPanel1Layout.createSequentialGroup()
875  .addContainerGap()
876  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
877  .addGroup(jPanel1Layout.createSequentialGroup()
878  .addGap(1, 1, 1)
879  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
880  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
881  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
882  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
883  .addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
884  .addGap(356, 356, 356))
885  .addGroup(jPanel1Layout.createSequentialGroup()
886  .addComponent(indexButton)
887  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
888  .addComponent(addHashesToDatabaseButton)
889  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
890  .addGroup(jPanel1Layout.createSequentialGroup()
891  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
892  .addComponent(informationScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
893  .addGroup(jPanel1Layout.createSequentialGroup()
894  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
895  .addComponent(sendIngestMessagesCheckBox)
896  .addComponent(ingestWarningLabel))
897  .addGap(0, 0, Short.MAX_VALUE)))
898  .addContainerGap())))
899  .addGroup(jPanel1Layout.createSequentialGroup()
900  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
901  .addComponent(hashDatabasesLabel)
902  .addGroup(jPanel1Layout.createSequentialGroup()
903  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
904  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
905  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
906  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
907  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
908  .addGap(0, 0, Short.MAX_VALUE))))
909  );
910  jPanel1Layout.setVerticalGroup(
911  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
912  .addGroup(jPanel1Layout.createSequentialGroup()
913  .addContainerGap()
914  .addComponent(hashDatabasesLabel)
915  .addGap(6, 6, 6)
916  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
917  .addGroup(jPanel1Layout.createSequentialGroup()
918  .addComponent(informationLabel)
919  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
920  .addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
921  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
922  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
923  .addComponent(indexButton)
924  .addComponent(addHashesToDatabaseButton))
925  .addGap(18, 18, 18)
926  .addComponent(sendIngestMessagesCheckBox)
927  .addGap(18, 18, 18)
928  .addComponent(ingestWarningLabel)
929  .addGap(0, 0, Short.MAX_VALUE))
930  .addComponent(jScrollPane1))
931  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
932  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
933  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
934  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
935  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
936  .addContainerGap())
937  );
938 
939  jScrollPane2.setViewportView(jPanel1);
940 
941  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
942  this.setLayout(layout);
943  layout.setHorizontalGroup(
944  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
945  .addComponent(jScrollPane2)
946  );
947  layout.setVerticalGroup(
948  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
949  .addComponent(jScrollPane2)
950  );
951  }// </editor-fold>//GEN-END:initComponents
952 
953  private void addHashesToDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addHashesToDatabaseButtonActionPerformed
954 
955  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
957  }//GEN-LAST:event_addHashesToDatabaseButtonActionPerformed
958 
959  private void createDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createDatabaseButtonActionPerformed
960  HashDb hashDb = new HashDbCreateDatabaseDialog().getHashDatabase();
961  if (null != hashDb) {
962  if (hashDb instanceof CentralRepoHashSet) {
963  int newDbIndex = ((CentralRepoHashSet) hashDb).getReferenceSetID();
964  newReferenceSetIDs.add(newDbIndex);
965  }
966 
967  hashSetTableModel.refreshModel();
968  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
969  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
970  }
971  }//GEN-LAST:event_createDatabaseButtonActionPerformed
972 
973  private void sendIngestMessagesCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendIngestMessagesCheckBoxActionPerformed
974  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
975  if (hashDb != null) {
976  hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
977  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
978  }
979  }//GEN-LAST:event_sendIngestMessagesCheckBoxActionPerformed
980 
986  private boolean isWindows() {
987  return PlatformUtil.getOSName().toLowerCase().startsWith("Windows");
988  }
989 
990  @NbBundle.Messages({"HashLookupSettingsPanel.indexNsrl.text=This hash set appears to be the NSRL, it will be removed from the list.\n",
991  "HashLookupSettingsPanel.indexNsrl.title=NSRL will not be indexed"})
992  private void indexButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indexButtonActionPerformed
993  final HashDb hashDatabase = ((HashSetTable) hashSetTable).getSelection();
994  assert hashDatabase != null;
995  assert hashDatabase instanceof SleuthkitHashSet;
996 
997  // Add a listener for the INDEXING_DONE event. This listener will update
998  // the UI.
999  SleuthkitHashSet hashDb = (SleuthkitHashSet) hashDatabase;
1000  if (isWindows() && hashDb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
1001  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_indexNsrl_text() + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL), Bundle.HashLookupSettingsPanel_indexNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
1002  try {
1003  hashSetManager.removeHashDatabaseNoSave(hashDatabase);
1004  hashSetTableModel.refreshModel();
1005  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1006  } catch (HashDbManager.HashDbManagerException ex) {
1007  logger.log(Level.WARNING, "Unable to remove unindexed NSRL from hash set list", ex);
1008  }
1009  } else {
1010  hashDb.addPropertyChangeListener(new PropertyChangeListener() {
1011  @Override
1012  public void propertyChange(PropertyChangeEvent evt) {
1013  if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
1014  HashDb selectedHashDb = ((HashSetTable) hashSetTable).getSelection();
1015  if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
1016  updateComponents();
1017  }
1018  hashSetTableModel.refreshDisplay();
1019  }
1020  }
1021  });
1022 
1023  // Display a modal dialog box to kick off the indexing on a worker thread
1024  // and try to persuade the user to wait for the indexing task to finish.
1025  // TODO: If the user waits, this defeats the purpose of doing the indexing on a worker thread.
1026  // But if the user cancels the dialog, other operations on the database
1027  // may be attempted when it is not in a suitable state.
1028  ModalNoButtons indexDialog = new ModalNoButtons(this, new Frame(), hashDb);
1029  indexDialog.setLocationRelativeTo(null);
1030  indexDialog.setVisible(true);
1031  indexDialog.setModal(true);
1032  }
1033  }//GEN-LAST:event_indexButtonActionPerformed
1034 
1035  private void importDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importDatabaseButtonActionPerformed
1036  HashDb hashDb = new HashDbImportDatabaseDialog().getHashDatabase();
1037  if (null != hashDb) {
1038  if (hashDb instanceof CentralRepoHashSet) {
1039  int newReferenceSetID = ((CentralRepoHashSet) hashDb).getReferenceSetID();
1040  newReferenceSetIDs.add(newReferenceSetID);
1041  }
1042 
1043  hashSetTableModel.refreshModel();
1044  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1045  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1046  }
1047  }//GEN-LAST:event_importDatabaseButtonActionPerformed
1048 
1049  @Messages({
1050  "HashLookupSettingsPanel.promptTitle.deleteHashDb=Delete Hash Database from Configuration",
1051  "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."
1052  })
1053  private void deleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDatabaseButtonActionPerformed
1054  if (JOptionPane.showConfirmDialog(this,
1055  Bundle.HashLookupSettingsPanel_promptMessage_deleteHashDb(),
1056  Bundle.HashLookupSettingsPanel_promptTitle_deleteHashDb(),
1057  JOptionPane.YES_NO_OPTION,
1058  JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
1059  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1060  if (hashDb != null) {
1061  try {
1062  hashSetManager.removeHashDatabaseNoSave(hashDb);
1063  } catch (HashDbManager.HashDbManagerException ex) {
1064  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1065  }
1066  hashSetTableModel.refreshModel();
1067  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1068  }
1069  }
1070  }//GEN-LAST:event_deleteDatabaseButtonActionPerformed
1071 
1072  private void hashSetTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hashSetTableKeyPressed
1073  if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1074  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1075  if (hashDb != null) {
1076  try {
1077  hashSetManager.removeHashDatabaseNoSave(hashDb);
1078  } catch (HashDbManager.HashDbManagerException ex) {
1079  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1080  }
1081  hashSetTableModel.refreshModel();
1082  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1083  }
1084  }
1085  }//GEN-LAST:event_hashSetTableKeyPressed
1086 
1087  // Variables declaration - do not modify//GEN-BEGIN:variables
1088  private javax.swing.JButton addHashesToDatabaseButton;
1089  private javax.swing.JButton createDatabaseButton;
1090  private javax.swing.JButton deleteDatabaseButton;
1091  private javax.swing.JLabel hashDatabasesLabel;
1092  private javax.swing.JLabel hashDbIndexStatusLabel;
1093  private javax.swing.JLabel hashDbLocationLabel;
1094  private javax.swing.JLabel hashDbNameLabel;
1095  private javax.swing.JLabel hashDbOrgLabel;
1096  private javax.swing.JLabel hashDbReadOnlyLabel;
1097  private javax.swing.JLabel hashDbTypeLabel;
1098  private javax.swing.JLabel hashDbVersionLabel;
1099  private javax.swing.JTable hashSetTable;
1100  private javax.swing.JButton importDatabaseButton;
1101  private javax.swing.JButton indexButton;
1102  private javax.swing.JLabel indexLabel;
1103  private javax.swing.JLabel indexPathLabel;
1104  private javax.swing.JLabel indexPathLabelLabel;
1105  private javax.swing.JLabel informationLabel;
1106  private javax.swing.JPanel informationPanel;
1107  private javax.swing.JScrollPane informationScrollPanel;
1108  private javax.swing.JLabel ingestWarningLabel;
1109  private javax.swing.JButton jButton3;
1110  private javax.swing.JLabel jLabel2;
1111  private javax.swing.JLabel jLabel4;
1112  private javax.swing.JLabel jLabel6;
1113  private javax.swing.JPanel jPanel1;
1114  private javax.swing.JScrollPane jScrollPane1;
1115  private javax.swing.JScrollPane jScrollPane2;
1116  private javax.swing.JLabel locationLabel;
1117  private javax.swing.JLabel nameLabel;
1118  private javax.swing.JLabel orgLabel;
1119  private javax.swing.JLabel readOnlyLabel;
1120  private javax.swing.JCheckBox sendIngestMessagesCheckBox;
1121  private javax.swing.JLabel typeLabel;
1122  private javax.swing.JLabel versionLabel;
1123  // End of variables declaration//GEN-END:variables
1124 }
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: Fri Jun 21 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.