diff --git a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties index 0ec34f970d..45e8fc9a6e 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties @@ -17,7 +17,6 @@ FileSearchDialog.jLabel5.text=Order files by: FileSearchDialog.parentCheckBox.text=Parent ResultsDialog.exitButton.text=Exit ResultsDialog.searchButton.text=Run another search -FileSearchDialog.errorLabel.text=jLabel6 FileSearchPanel.sortingPanel.border.title=Sorting FileSearchPanel.searchButton.text=Show FileSearchPanel.fileTypeLabel.text=File Type: @@ -45,3 +44,4 @@ FileSearchDialog.objCheckBox.text=Objects FileSearchDialog.exifCheckBox.text=Must contain EXIF data FileSearchDialog.notableCheckBox.text=Must have been tagged as notable FileSearchDialog.scoreCheckBox.text=Has score +FileSearchPanel.cancelButton.text=Cancel diff --git a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED index cacf6af227..463f25721a 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED @@ -112,7 +112,6 @@ FileSorter.SortingMethod.parent.displayName=By parent path ResultsDialog.dialogTitle.text=File search results ResultsDialog.exitButton.text=Exit ResultsDialog.searchButton.text=Run another search -FileSearchDialog.errorLabel.text=jLabel6 FileSearchPanel.sortingPanel.border.title=Sorting FileSearchPanel.searchButton.text=Show FileSearchPanel.fileTypeLabel.text=File Type: @@ -140,4 +139,5 @@ FileSearchDialog.objCheckBox.text=Objects FileSearchDialog.exifCheckBox.text=Must contain EXIF data FileSearchDialog.notableCheckBox.text=Must have been tagged as notable FileSearchDialog.scoreCheckBox.text=Has score +FileSearchPanel.cancelButton.text=Cancel SearchNode.getName.text=Search Result diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryDialog.java b/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryDialog.java index 3b28c248ab..902104fe66 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryDialog.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryDialog.java @@ -123,6 +123,7 @@ class FileDiscoveryDialog extends javax.swing.JDialog { @Override public void dispose() { + fileSearchPanel.cancelSearch(); DiscoveryEvents.getDiscoveryEventBus().unregister(groupListPanel); DiscoveryEvents.getDiscoveryEventBus().unregister(this); super.dispose(); diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryTestAction.java b/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryTestAction.java index 2c064b586a..87851c897d 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryTestAction.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileDiscoveryTestAction.java @@ -64,8 +64,8 @@ public final class FileDiscoveryTestAction extends CallableSystemAction { return; } } - - FileDiscoveryDialog dialog = new FileDiscoveryDialog(WindowManager.getDefault().getMainWindow(), false, Case.getCurrentCase().getSleuthkitCase(), crDb); + //modal set to true currently to prevent multiple dialogs being opened because messaging uses a shared eventbus + FileDiscoveryDialog dialog = new FileDiscoveryDialog(WindowManager.getDefault().getMainWindow(), true, Case.getCurrentCase().getSleuthkitCase(), crDb); //register the dialog with the event bus DiscoveryEvents.getDiscoveryEventBus().register(dialog); // Display the dialog diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.form b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.form index f649f3c3c7..75f65c9595 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.form +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.form @@ -437,9 +437,6 @@ - - - @@ -539,9 +536,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java index 0f5fc222db..deb60e5d0b 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java @@ -745,7 +745,6 @@ public class FileSearchDialog extends javax.swing.JDialog implements ActionListe } }); - parentTextField.setText(org.openide.util.NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.parentTextField.text")); // NOI18N parentTextField.setEnabled(false); parentTextField.setMaximumSize(new java.awt.Dimension(6, 20)); @@ -775,7 +774,6 @@ public class FileSearchDialog extends javax.swing.JDialog implements ActionListe }); errorLabel.setForeground(new java.awt.Color(255, 0, 0)); - org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.errorLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(hashCheckBox, org.openide.util.NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.hashCheckBox.text")); // NOI18N hashCheckBox.addActionListener(new java.awt.event.ActionListener() { diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form index 079683830a..894b1c8e1f 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form @@ -33,7 +33,9 @@ - + + + @@ -61,9 +63,12 @@ - - - + + + + + + @@ -586,5 +591,15 @@ + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.java index a78b91813c..53b33d5e8f 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.java @@ -59,12 +59,12 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener private DefaultListModel parentListModel; private final SleuthkitCase caseDb; private final EamDb centralRepoDb; + private SearchWorker searchWorker = null; /** * Creates new form FileSearchDialog */ - @NbBundle.Messages({ - "FileSearchPanel.dialogTitle.text=Test file search",}) + @NbBundle.Messages({"FileSearchPanel.dialogTitle.text=Test file search"}) FileSearchPanel(SleuthkitCase caseDb, EamDb centralRepoDb) { this.caseDb = caseDb; this.centralRepoDb = centralRepoDb; @@ -439,6 +439,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener groupByLabel = new javax.swing.JLabel(); fileTypeComboBox = new javax.swing.JComboBox<>(); errorLabel = new javax.swing.JLabel(); + cancelButton = new javax.swing.JButton(); setMinimumSize(new java.awt.Dimension(408, 0)); @@ -754,6 +755,13 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener errorLabel.setForeground(new java.awt.Color(255, 0, 0)); + org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.cancelButton.text")); // NOI18N + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -764,6 +772,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener .addGroup(layout.createSequentialGroup() .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(searchButton)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(6, 6, 6) @@ -774,6 +784,9 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener .addComponent(filtersScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(4, 4, 4)) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, searchButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() @@ -786,9 +799,11 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(filtersScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(searchButton) - .addComponent(errorLabel)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(searchButton) + .addComponent(cancelButton)) + .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// //GEN-END:initComponents @@ -808,7 +823,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener // Get the file sorting method FileSorter.SortingMethod fileSort = getFileSortingMethod(); - SearchWorker searchWorker = new SearchWorker(centralRepoDb, searchButton, filters, groupingAttr, groupSortAlgorithm, fileSort); + searchWorker = new SearchWorker(centralRepoDb, searchButton, filters, groupingAttr, groupSortAlgorithm, fileSort); searchWorker.execute(); }//GEN-LAST:event_searchButtonActionPerformed @@ -846,6 +861,12 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener } }//GEN-LAST:event_addButtonActionPerformed + void cancelSearch(){ + if (searchWorker != null){ + searchWorker.cancel(true); + } + } + private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed int index = parentList.getSelectedIndex(); parentListModel.remove(index); @@ -863,10 +884,15 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener dataSourceList.setEnabled(dataSourceCheckbox.isSelected()); }//GEN-LAST:event_dataSourceCheckboxActionPerformed + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + cancelSearch(); + }//GEN-LAST:event_cancelButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; private javax.swing.JRadioButton attributeRadioButton; + private javax.swing.JButton cancelButton; private javax.swing.JCheckBox crFrequencyCheckbox; private javax.swing.JList crFrequencyList; private javax.swing.JScrollPane crFrequencyScrollPane; diff --git a/Core/src/org/sleuthkit/autopsy/filequery/SearchWorker.java b/Core/src/org/sleuthkit/autopsy/filequery/SearchWorker.java index 12279fd260..a76de6b61c 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/SearchWorker.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/SearchWorker.java @@ -93,5 +93,6 @@ final class SearchWorker extends SwingWorker { if (searchButtonToEnable != null) { searchButtonToEnable.setEnabled(true); } + System.out.println("SEARCH FINISHED"); } }